mirror of
https://github.com/GTNewHorizons/Chisel.git
synced 2026-11-25 14:44:35 +00:00
Compare commits
194
Commits
2.10.4-GTNH
...
master
| 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 | ||
|
|
e8d9d77299 | ||
|
|
91a5d63a24 | ||
|
|
ddd7f5ec2e | ||
|
|
423f72ab21 | ||
|
|
3c0729591f | ||
|
|
b809eb9d0b | ||
|
|
9db6baf768 | ||
|
|
52915ac97f | ||
|
|
00cf0d5229 | ||
|
|
1ce8c85dce | ||
|
|
e903c37913 | ||
|
|
1a9e366204 | ||
|
|
0dfa701ae3 | ||
|
|
802295bb6a | ||
|
|
5d6b5c945d | ||
|
|
764885d239 | ||
|
|
baf3c712bd | ||
|
|
bd2fe1d272 | ||
|
|
f2447d415b |
No files matched your search
@@ -0,0 +1,19 @@
|
|||||||
|
# This is the universal Text Editor Configuration
|
||||||
|
# for all GTNewHorizons projects
|
||||||
|
# See: https://editorconfig.org/
|
||||||
|
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
indent_size = 4
|
||||||
|
indent_style = space
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
[*.{bat,ini}]
|
||||||
|
end_of_line = crlf
|
||||||
|
|
||||||
|
[*.{dtd,json,info,mcmeta,md,sh,svg,xml,xsd,xsl,yaml,yml}]
|
||||||
|
indent_size = 2
|
||||||
@@ -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,9 +0,0 @@
|
|||||||
directory="run/crash-reports"
|
|
||||||
if [ -d $directory ]; then
|
|
||||||
echo "Crash reports detected:"
|
|
||||||
cat $directory/*
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "No crash reports detected"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bashsupport disable=BP5006 # Global environment variables
|
||||||
|
RUNDIR="run" \
|
||||||
|
CRASH="crash-reports" \
|
||||||
|
SERVERLOG="server.log"
|
||||||
|
|
||||||
|
# enable nullglob to get 0 results when no match rather than the pattern
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
# store matches in array
|
||||||
|
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||||
|
|
||||||
|
# if array not empty there are crash_reports
|
||||||
|
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||||
|
# get the latest crash_report from array
|
||||||
|
latest_crash_report="${crash_reports[-1]}"
|
||||||
|
{
|
||||||
|
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||||
|
cat "$latest_crash_report"
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Fatal errors detected:\n'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||||
|
"$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server force stopped:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server did not finish startup:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'No crash reports detected'
|
||||||
|
exit 0
|
||||||
@@ -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 minute
|
|
||||||
run: |
|
|
||||||
mkdir run
|
|
||||||
echo "eula=true" > run/eula.txt
|
|
||||||
timeout 60 ./gradlew runServer || true
|
|
||||||
|
|
||||||
- name: Test no crashes happend
|
|
||||||
run: |
|
|
||||||
chmod +x .github/scripts/test-no-crash-reports.sh
|
|
||||||
.github/scripts/test-no-crash-reports.sh
|
|
||||||
@@ -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,45 +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
|
|
||||||
@@ -27,3 +27,5 @@ whitelist.json
|
|||||||
*.iws
|
*.iws
|
||||||
src/main/resources/mixins.*.json
|
src/main/resources/mixins.*.json
|
||||||
*.bat
|
*.bat
|
||||||
|
layout.json
|
||||||
|
.DS_Store
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Any Github changes require admin approval
|
||||||
|
/.github/** @GTNewHorizons/admin
|
||||||
|
|
||||||
+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
-526
@@ -1,529 +1,5 @@
|
|||||||
//version: 928ecf7feb33a1149538b0e2cd17e3bc5f281428
|
//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/SinTh0r4s/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 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.4'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'idea'
|
id 'com.gtnewhorizons.gtnhconvention'
|
||||||
id 'scala'
|
|
||||||
id("org.ajoberstar.grgit") version("3.1.1")
|
|
||||||
id("com.github.johnrengelman.shadow") version("4.0.4")
|
|
||||||
id("com.palantir.git-version") version("0.12.3")
|
|
||||||
}
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
|
|
||||||
String javaSourceDir = "src/main/java/"
|
|
||||||
String scalaSourceDir = "src/main/scala/"
|
|
||||||
|
|
||||||
String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/")
|
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
|
||||||
throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
|
||||||
}
|
|
||||||
|
|
||||||
if(apiPackage) {
|
|
||||||
targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/")
|
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
|
||||||
throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(accessTransformersFile) {
|
|
||||||
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
|
|
||||||
if(getFile(targetFile).exists() == false) {
|
|
||||||
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("\\.", "/")
|
|
||||||
if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala)
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
|
||||||
throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) {
|
|
||||||
throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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
|
|
||||||
'git config core.fileMode false'.execute()
|
|
||||||
// Pulls version from git tag
|
|
||||||
try {
|
|
||||||
version = minecraftVersion + "-" + gitVersion()
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag!");
|
|
||||||
}
|
|
||||||
|
|
||||||
group = modGroup
|
|
||||||
if(project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
|
||||||
archivesBaseName = customArchiveBaseName
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
archivesBaseName = modId
|
|
||||||
}
|
|
||||||
|
|
||||||
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, versionDetails().lastTag
|
|
||||||
}
|
|
||||||
if(gradleTokenGroupName) {
|
|
||||||
replace gradleTokenGroupName, modGroup
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(file("addon.gradle").exists()) {
|
|
||||||
apply from: "addon.gradle"
|
|
||||||
}
|
|
||||||
|
|
||||||
apply from: 'repositories.gradle'
|
|
||||||
|
|
||||||
configurations {
|
|
||||||
implementation.extendsFrom(shadowImplementation)
|
|
||||||
}
|
|
||||||
|
|
||||||
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("org.spongepowered:mixin:0.7.11-SNAPSHOT") {
|
|
||||||
// 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.3.3:dev")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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()) {
|
|
||||||
getFile("/src/main/resources/mixins." + modId + ".json").text = """{
|
|
||||||
"required": true,
|
|
||||||
"minVersion": "0.7.11",
|
|
||||||
"package": "${modGroup}.${mixinsPackage}",
|
|
||||||
"plugin": "${modGroup}.${mixinPlugin}",
|
|
||||||
"refmap": "${mixingConfigRefMap}",
|
|
||||||
"target": "@env(DEFAULT)",
|
|
||||||
"compatibilityLevel": "JAVA_8"
|
|
||||||
}
|
|
||||||
|
|
||||||
"""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task relocateShadowJar(type: ConfigureShadowRelocation) {
|
|
||||||
target = tasks.shadowJar
|
|
||||||
prefix = modGroup + ".shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
shadowJar {
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
|
||||||
configurations = [project.configurations.shadowImplementation]
|
|
||||||
dependsOn(relocateShadowJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
jar {
|
|
||||||
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 {
|
|
||||||
def arguments = []
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
arguments += [
|
|
||||||
"--mods=../build/libs/$modId-${version}.jar",
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
if(developmentEnvironmentUserName) {
|
|
||||||
arguments += [
|
|
||||||
"--username",
|
|
||||||
developmentEnvironmentUserName
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args(arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
runServer {
|
|
||||||
def arguments = []
|
|
||||||
|
|
||||||
if (usesMixins.toBoolean()) {
|
|
||||||
arguments += [
|
|
||||||
"--mods=../build/libs/$modId-${version}.jar",
|
|
||||||
"--tweakClass org.spongepowered.asm.launch.MixinTweaker"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
args(arguments)
|
|
||||||
}
|
|
||||||
|
|
||||||
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 version and mcversion
|
|
||||||
expand "minecraftVersion": project.minecraft.version,
|
|
||||||
"modVersion": versionDetails().lastTag,
|
|
||||||
"modId": modId,
|
|
||||||
"modName": modName
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesMixins.toBoolean()) {
|
|
||||||
from refMap
|
|
||||||
}
|
|
||||||
|
|
||||||
// copy everything else, thats not the mcmod.info
|
|
||||||
from(sourceSets.main.resources.srcDirs) {
|
|
||||||
exclude 'mcmod.info'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getManifestAttributes() {
|
|
||||||
def manifestAttributes = [:]
|
|
||||||
if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (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() == false
|
|
||||||
]
|
|
||||||
}
|
|
||||||
return manifestAttributes
|
|
||||||
}
|
|
||||||
|
|
||||||
task sourcesJar(type: Jar) {
|
|
||||||
from (sourceSets.main.allJava)
|
|
||||||
from (file("$projectDir/LICENSE"))
|
|
||||||
getArchiveClassifier().set('sources')
|
|
||||||
}
|
|
||||||
|
|
||||||
task shadowDevJar(type: ShadowJar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
getArchiveClassifier().set("dev")
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
minimize() // This will only allow shading for actually used classes
|
|
||||||
configurations = [project.configurations.shadowImplementation]
|
|
||||||
}
|
|
||||||
|
|
||||||
task relocateShadowDevJar(type: ConfigureShadowRelocation) {
|
|
||||||
target = tasks.shadowDevJar
|
|
||||||
prefix = modGroup + ".shadow"
|
|
||||||
}
|
|
||||||
|
|
||||||
task circularResolverJar(type: Jar) {
|
|
||||||
dependsOn(relocateShadowDevJar)
|
|
||||||
dependsOn(shadowDevJar)
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
|
|
||||||
task devJar(type: Jar) {
|
|
||||||
from sourceSets.main.output
|
|
||||||
getArchiveClassifier().set("dev")
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes(getManifestAttributes())
|
|
||||||
}
|
|
||||||
|
|
||||||
if(usesShadowedDependencies.toBoolean()) {
|
|
||||||
dependsOn(circularResolverJar)
|
|
||||||
enabled = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
task apiJar(type: Jar) {
|
|
||||||
from (sourceSets.main.allJava) {
|
|
||||||
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 {
|
|
||||||
archives sourcesJar
|
|
||||||
archives devJar
|
|
||||||
if(apiPackage) {
|
|
||||||
archives apiJar
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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 {
|
|
||||||
println("Build script update available! Run 'gradle updateBuildScript'")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static URL availableBuildScriptUrl() {
|
|
||||||
new URL("https://raw.githubusercontent.com/SinTh0r4s/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 } }
|
|
||||||
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'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper methods
|
|
||||||
|
|
||||||
def checkPropertyExists(String propertyName) {
|
|
||||||
if (project.hasProperty(propertyName) == false) {
|
|
||||||
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/SinTh0r4s/ExampleMod1.7.10/blob/main/gradle.properties")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
def getFile(String relativePath) {
|
|
||||||
return new File(projectDir, relativePath)
|
|
||||||
}
|
}
|
||||||
+11
-6
@@ -1,18 +1,23 @@
|
|||||||
// Add your dependencies here
|
// Add your dependencies here
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile("com.github.GTNewHorizons:NotEnoughItems:master-SNAPSHOT:dev")
|
implementation("com.github.GTNewHorizons:CodeChickenCore:1.4.12:dev")
|
||||||
|
implementation("com.github.GTNewHorizons:NotEnoughItems:2.8.84-GTNH:dev")
|
||||||
|
implementation("com.github.GTNewHorizons:ForgeMultipart:2.0.0:dev")
|
||||||
|
|
||||||
compile("org.projectlombok:lombok:1.16.4")
|
compileOnly("org.projectlombok:lombok:1.18.24")
|
||||||
|
annotationProcessor("org.projectlombok:lombok:1.18.24")
|
||||||
|
|
||||||
compileOnly("com.github.GTNewHorizons:waila:master-SNAPSHOT:dev") {
|
devOnlyNonPublishable("com.github.GTNewHorizons:waila:1.19.22:dev") {
|
||||||
transitive = false
|
|
||||||
}
|
|
||||||
compileOnly("com.github.GTNewHorizons:ForgeMultipart:master-SNAPSHOT: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,10 +1,4 @@
|
|||||||
// Add any additional repositories for your dependencies here
|
// Add any additional repositories for your dependencies here
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
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'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2,6 +2,6 @@ package com.cricketcraft.chisel.api;
|
|||||||
|
|
||||||
public class ChiselAPIProps {
|
public class ChiselAPIProps {
|
||||||
|
|
||||||
public static final String VERSION = "0.1.1";
|
public static final String VERSION = "0.1.1";
|
||||||
public static String MOD_ID = null; // Set by Chisel
|
public static String MOD_ID = null; // Set by Chisel
|
||||||
}
|
}
|
||||||
@@ -3,64 +3,63 @@ 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;
|
||||||
|
|
||||||
public class ChiselTabs {
|
public class ChiselTabs {
|
||||||
|
|
||||||
public static class CustomCreativeTab extends CreativeTabs {
|
public static class CustomCreativeTab extends CreativeTabs {
|
||||||
|
|
||||||
private boolean search;
|
private boolean search;
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public CustomCreativeTab(String label, boolean searchbar) {
|
public CustomCreativeTab(String label, boolean searchbar) {
|
||||||
super(label);
|
super(label);
|
||||||
this.search = searchbar;
|
this.search = searchbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getTabIconItem() {
|
public Item getTabIconItem() {
|
||||||
return stack.getItem();
|
return stack.getItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTabIconItemStack(ItemStack stack) {
|
public void setTabIconItemStack(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getIconItemStack() {
|
public ItemStack getIconItemStack() {
|
||||||
return stack;
|
return stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public String getBackgroundImageName() {
|
public String getBackgroundImageName() {
|
||||||
|
|
||||||
return search ? "item_search.png" : super.getBackgroundImageName();
|
return search ? "item_search.png" : super.getBackgroundImageName();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSearchbarWidth() {
|
public int getSearchbarWidth() {
|
||||||
|
|
||||||
return 89;
|
return 89;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasSearchBar() {
|
public boolean hasSearchBar() {
|
||||||
|
|
||||||
return search;
|
return search;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
|
|
||||||
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
|
|
||||||
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
|
|
||||||
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks", true);
|
|
||||||
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks", true);
|
|
||||||
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
|
|
||||||
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
|
|
||||||
|
|
||||||
|
public static final CustomCreativeTab tabChisel = new CustomCreativeTab("tabChisel", false);
|
||||||
|
public static final CustomCreativeTab tabStoneChiselBlocks = new CustomCreativeTab("tabStoneChiselBlocks", true);
|
||||||
|
public static final CustomCreativeTab tabWoodChiselBlocks = new CustomCreativeTab("tabWoodChiselBlocks", true);
|
||||||
|
public static final CustomCreativeTab tabMetalChiselBlocks = new CustomCreativeTab("tabMetalChiselBlocks", true);
|
||||||
|
public static final CustomCreativeTab tabOtherChiselBlocks = new CustomCreativeTab("tabOtherChiselBlocks", true);
|
||||||
|
public static final CustomCreativeTab tabModdedChiselBlocks = new CustomCreativeTab("tabModdedChiselBlocks", true);
|
||||||
|
public static final CustomCreativeTab tabStairChiselBlocks = new CustomCreativeTab("tabStairChiselBlocks", true);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,21 +2,22 @@ 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 {
|
||||||
|
|
||||||
public static void registerFMP(Block block) {
|
public static void registerFMP(Block block) {
|
||||||
registerFMP(block, 0, 15);
|
registerFMP(block, 0, 15);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerFMP(Block block, int minMeta, int maxMeta) {
|
public static void registerFMP(Block block, int minMeta, int maxMeta) {
|
||||||
for (int c = minMeta; c <= maxMeta; c++) {
|
for (int c = minMeta; c <= maxMeta; c++) {
|
||||||
registerFMP(block, c);
|
registerFMP(block, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void registerFMP(Block block, int meta) {
|
public static void registerFMP(Block block, int meta) {
|
||||||
FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(block, 1, meta));
|
FMLInterModComms.sendMessage("ForgeMicroblock", "microMaterial", new ItemStack(block, 1, meta));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,25 +9,21 @@ import com.cricketcraft.chisel.api.carving.IChiselMode;
|
|||||||
*/
|
*/
|
||||||
public interface IAdvancedChisel {
|
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
|
* @return The next {@link IChiselMode} in the loop
|
||||||
* The {@link IChiselMode} that is currently active
|
*/
|
||||||
* @return The next {@link IChiselMode} in the loop
|
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
|
||||||
*/
|
|
||||||
public IChiselMode getNextMode(ItemStack stack, IChiselMode current);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return An {@link IChiselMode} that has the name {@code name}
|
||||||
* The name of the {@link IChiselMode mode}
|
*/
|
||||||
* @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,44 +1,42 @@
|
|||||||
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
|
*
|
||||||
* The metadata of the block
|
* @param metadata The metadata of the block
|
||||||
* @param world
|
* @param world {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to
|
||||||
* {@link IBlockAccess} object, usually a world. Use of {@link IBlockAccess} Is necessary due to this method's use in rendering.
|
* this method's use in rendering.
|
||||||
* @param x
|
* @param x X coord of the block
|
||||||
* X coord of the block
|
* @param y Y coord of the block
|
||||||
* @param y
|
* @param z Z coord of the block
|
||||||
* Y coord of the block
|
* @param metadata The metadata of the block
|
||||||
* @param z
|
* @return The {@link ISubmapManager} that represents this block in the world.
|
||||||
* Z coord of the block
|
*/
|
||||||
* @param metadata
|
@Override
|
||||||
* The metadata of the block
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata);
|
||||||
* @return The {@link ISubmapManager} that represents this block in the world.
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the {@link ISubmapManager} for this block when it is in item form.
|
* Gets the {@link ISubmapManager} for this block when it is in item form.
|
||||||
*
|
*
|
||||||
* @return A {@link ISubmapManager}
|
* @return A {@link ISubmapManager}
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta);
|
public IVariationInfo getManager(int meta);
|
||||||
}
|
}
|
||||||
@@ -12,74 +12,60 @@ import com.cricketcraft.chisel.api.carving.ICarvingVariation;
|
|||||||
*/
|
*/
|
||||||
public interface IChiselItem {
|
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
|
* @return True if the GUI should open. False otherwise.
|
||||||
* The {@link ItemStack} representing your chisel
|
*/
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return True if the chisel should be damaged. False otherwise.
|
||||||
* @param target
|
*/
|
||||||
* The {@link ICarvingVariation} representing the target item
|
boolean onChisel(World world, ItemStack chisel, ICarvingVariation target);
|
||||||
* @return True if the chisel should be damaged. False otherwise.
|
|
||||||
*/
|
|
||||||
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
|
||||||
* <p>
|
* variants displayed in the GUI.
|
||||||
* 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.
|
* <p>
|
||||||
*
|
* It is not necessary to take into account whether this item <i>has</i> any variants, this method will only be
|
||||||
* @param world
|
* called after that check.
|
||||||
* {@link World} object
|
*
|
||||||
* @param chisel
|
* @param world {@link World} object
|
||||||
* The {@link ItemStack} representing the chisel
|
* @param chisel The {@link ItemStack} representing the chisel
|
||||||
* @param target
|
* @param target The {@link ICarvingVariation} representing the target item
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return True if the chiseling should take place. False otherwise.
|
||||||
* @param z
|
*/
|
||||||
* Z coord of the block being chiseled
|
boolean canChiselBlock(World world, EntityPlayer player, int x, int y, int z, Block block, int metadata);
|
||||||
* @param block
|
|
||||||
* The {@link Block} being chiseled
|
|
||||||
* @param metadata
|
|
||||||
* The blocks' metadata
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
@@ -7,20 +7,16 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
*/
|
*/
|
||||||
public interface IConnectable {
|
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
|
* @return True if a block can connect to this one from the given direction. False otherwise.
|
||||||
* The Z position of the block that is connecting to this one. NOT the position of your block.
|
*/
|
||||||
* @param side
|
boolean canConnectCTM(IBlockAccess world, int x, int y, int z, int side);
|
||||||
* The side being drawn.
|
|
||||||
* @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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -9,41 +9,84 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
public interface IFacade {
|
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
|
* <p>
|
||||||
* @param z
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
* Z coord of your block
|
* @return The block inside of your facade block.
|
||||||
* @param side
|
*/
|
||||||
* The side being rendered, NOT the side being connected from.
|
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
|
||||||
* <p>
|
|
||||||
* This value can be -1 if no side is specified. Please handle this appropriately.
|
|
||||||
* @return The block inside of your facade block.
|
|
||||||
*/
|
|
||||||
Block getFacade(IBlockAccess world, int x, int y, int z, int side);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* <p>
|
||||||
* @param z
|
* This value can be -1 if no side is specified. Please handle this appropriately.
|
||||||
* Z coord of your block
|
* @return The metadata of your facade block.
|
||||||
* @param side
|
*/
|
||||||
* The side being rendered, NOT the side being connected from.
|
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
||||||
* <p>
|
|
||||||
* This value can be -1 if no side is specified. Please handle this appropriately.
|
/**
|
||||||
* @return The metadata of your facade block.
|
* 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.
|
||||||
int getFacadeMetadata(IBlockAccess world, int x, int y, int z, int side);
|
* <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,64 +1,69 @@
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
public enum IMC {
|
public enum IMC {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a variation to a group.
|
* Adds a variation to a group.
|
||||||
*
|
*
|
||||||
* Use this to add a variation to a group. String syntax:
|
* Use this to add a variation to a group. String syntax:
|
||||||
* <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"),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes a variation from a group.
|
* Removes a variation from a group.
|
||||||
*
|
*
|
||||||
* Use this to remove a variation from a group. String syntax:
|
* Use this to remove a variation from a group. String syntax:
|
||||||
* <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
|
||||||
* <p>
|
* a group. String syntax:
|
||||||
* groupname|oredictname
|
* <p>
|
||||||
* <p>
|
* groupname|oredictname
|
||||||
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as "plankWood" to your group called "mygroup".
|
* <p>
|
||||||
*/
|
* An example would be {@code "mygroup|plankWood"} which will add all blocks registered in the oredict as
|
||||||
REGISTER_GROUP_ORE("group:ore");
|
* "plankWood" to your group called "mygroup".
|
||||||
|
*/
|
||||||
|
REGISTER_GROUP_ORE("group:ore");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The IMC message key for this message type.
|
* The IMC message key for this message type.
|
||||||
*/
|
*/
|
||||||
public final String key;
|
public final String key;
|
||||||
|
|
||||||
IMC(String key) {
|
IMC(String key) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The modid of Chisel so you can easily send IMC to this mod.
|
* The modid of Chisel so you can easily send IMC to this mod.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public static final String CHISEL_MODID = "chisel";
|
public static final String CHISEL_MODID = "chisel";
|
||||||
|
|
||||||
public static final String getModid() {
|
public static final String getModid() {
|
||||||
return ChiselAPIProps.MOD_ID;
|
return ChiselAPIProps.MOD_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,10 +6,12 @@ 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();
|
||||||
blocksChiseled.registerStat();
|
blocksChiseled.registerStat();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -14,210 +14,229 @@ 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 {
|
||||||
|
|
||||||
public static Class<? extends ItemBlock> itemCarvableClass = null;
|
public static Class<? extends ItemBlock> itemCarvableClass = null;
|
||||||
|
|
||||||
private Block theBlock;
|
private Block theBlock;
|
||||||
|
|
||||||
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
|
public ArrayList<IVariationInfo> infoList = new ArrayList<IVariationInfo>();
|
||||||
IVariationInfo[] infoMap = new IVariationInfo[16];
|
IVariationInfo[] infoMap = new IVariationInfo[16];
|
||||||
public boolean forbidChiseling = false;
|
public boolean forbidChiseling = false;
|
||||||
|
|
||||||
public CarvableHelper(Block block) {
|
public CarvableHelper(Block block) {
|
||||||
this.theBlock = block;
|
this.theBlock = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, ISubmapManager manager) {
|
public void addVariation(String description, int metadata, ISubmapManager manager) {
|
||||||
addVariation(description, metadata, null, manager);
|
addVariation(description, metadata, null, manager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb) {
|
public void addVariation(String description, int metadata, Block bb) {
|
||||||
addVariation(description, metadata, null, bb, 0, ChiselAPIProps.MOD_ID);
|
addVariation(description, metadata, null, bb, 0, ChiselAPIProps.MOD_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb, int blockMeta) {
|
public void addVariation(String description, int metadata, Block bb, int blockMeta) {
|
||||||
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
|
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material) {
|
public void addVariation(String description, int metadata, Block bb, int blockMeta, Material material) {
|
||||||
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
|
addVariation(description, metadata, null, bb, blockMeta, ChiselAPIProps.MOD_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture) {
|
public void addVariation(String description, int metadata, String texture) {
|
||||||
addVariation(description, metadata, texture, (ISubmapManager) null);
|
addVariation(description, metadata, texture, (ISubmapManager) null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture, ISubmapManager manager) {
|
public void addVariation(String description, int metadata, String texture, ISubmapManager manager) {
|
||||||
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, manager, metadata);
|
addVariation(description, metadata, texture, null, 0, ChiselAPIProps.MOD_ID, manager, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb, String modid) {
|
public void addVariation(String description, int metadata, Block bb, String modid) {
|
||||||
addVariation(description, metadata, null, bb, 0, modid);
|
addVariation(description, metadata, null, bb, 0, modid);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, Block bb, int blockMeta, String modid) {
|
public void addVariation(String description, int metadata, Block bb, int blockMeta, String modid) {
|
||||||
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,
|
||||||
addVariation(description, metadata, null, bb, blockMeta, modid);
|
String modid) {
|
||||||
}
|
addVariation(description, metadata, null, bb, blockMeta, modid);
|
||||||
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture, String modid) {
|
public void addVariation(String description, int metadata, String texture, String modid) {
|
||||||
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,
|
||||||
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
|
String modid) {
|
||||||
}
|
addVariation(description, metadata, texture, block, blockMeta, modid, null, metadata);
|
||||||
|
}
|
||||||
|
|
||||||
public void addVariation(String description, int metadata, String texture, int order) {
|
public void addVariation(String description, int metadata, String texture, int order) {
|
||||||
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,
|
||||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
int blockMeta, ISubmapManager customManager, int order) {
|
||||||
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
||||||
if (type == TextureType.CUSTOM && customManager == null && block == null) {
|
TextureType type = TextureType.getTypeFor(this, modid, texture);
|
||||||
throw new IllegalArgumentException(String.format("Could not find texture %s, and no custom texture manager was provided.", texture));
|
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));
|
||||||
|
}
|
||||||
|
|
||||||
ISubmapManager manager;
|
ISubmapManager manager;
|
||||||
if (customManager != null) {
|
if (customManager != null) {
|
||||||
manager = customManager;
|
manager = customManager;
|
||||||
} else if (block != null) {
|
} else if (block != null) {
|
||||||
manager = type.createManagerFor(var, block, blockMeta);
|
manager = type.createManagerFor(var, block, blockMeta);
|
||||||
} else {
|
} else {
|
||||||
manager = type.createManagerFor(var, texture);
|
manager = type.createManagerFor(var, texture);
|
||||||
}
|
}
|
||||||
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,
|
||||||
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
int blockMeta, ISubmapManager customManager, int order) {
|
||||||
return new VariationInfoBase(var, description, null);
|
ICarvingVariation var = CarvingUtils.getDefaultVariationFor(getBlock(), metadata, order);
|
||||||
}
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerAll(Block block, String name) {
|
public void registerAll(Block block, String name) {
|
||||||
registerAll(block, name, itemCarvableClass);
|
registerAll(block, name, itemCarvableClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBlock(Block block, String name) {
|
public void registerBlock(Block block, String name) {
|
||||||
registerBlock(block, name, itemCarvableClass);
|
registerBlock(block, name, itemCarvableClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
void registerBlock(Block block, String name, Class<? extends ItemBlock> cl) {
|
void registerBlock(Block block, String name, Class<? extends ItemBlock> cl) {
|
||||||
block.setBlockName("chisel." + name);
|
block.setBlockName("chisel." + name);
|
||||||
GameRegistry.registerBlock(block, cl, name);
|
GameRegistry.registerBlock(block, cl, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerAll(Block block, String name, Class<? extends ItemBlock> cl) {
|
public void registerAll(Block block, String name, Class<? extends ItemBlock> cl) {
|
||||||
registerBlock(block, name, cl);
|
registerBlock(block, name, cl);
|
||||||
registerVariations(name);
|
registerVariations(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerVariations(String name) {
|
public void registerVariations(String name) {
|
||||||
for (IVariationInfo info : infoList) {
|
for (IVariationInfo info : infoList) {
|
||||||
registerVariation(name, info);
|
registerVariation(name, info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
if (Loader.isModLoaded("ForgeMultipart") && block instanceof BlockCarvableGlowie) {
|
||||||
FMPIMC.registerFMP(block, info.getVariation().getBlockMeta());
|
FMPCompat.registerGlowieVariation(info, block);
|
||||||
}
|
} else {
|
||||||
|
if (block.renderAsNormalBlock() || block.isOpaqueCube() || block.isNormalCube()) {
|
||||||
|
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)
|
||||||
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
|
public void registerBlockIcons(String modName, Block block, IIconRegister register) {
|
||||||
for (IVariationInfo info : infoList) {
|
for (IVariationInfo info : infoList) {
|
||||||
info.registerIcons(modName, block, register);
|
info.registerIcons(modName, block, register);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void registerOre(String ore) {
|
public void registerOre(String ore) {
|
||||||
OreDictionary.registerOre(ore, getBlock());
|
OreDictionary.registerOre(ore, getBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@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() {
|
||||||
return theBlock;
|
return theBlock;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,166 +11,163 @@ 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
|
*
|
||||||
* The first {@link ICarvingVariation variation}.
|
* @param v1 The first {@link ICarvingVariation variation}.
|
||||||
* @param v2
|
* @param v2 The second {@link ICarvingVariation variation}.
|
||||||
* The second {@link ICarvingVariation variation}.
|
* @return A positive integer if the first's order is greater, a negative integer if the second's is greater, and 0
|
||||||
* @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.
|
* 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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) {
|
return new ItemStack(variation.getBlock(), 1, variation.getItemMeta());
|
||||||
return new ItemStack(variation.getBlock(), 1, variation.getItemMeta());
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static ICarvingRegistry chisel;
|
public static ICarvingRegistry chisel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The instance of the chisel carving registry from the chisel mod.
|
* @return The instance of the chisel carving registry from the chisel mod.
|
||||||
* <p>
|
* <p>
|
||||||
* If chisel is not installed this will return null.
|
* If chisel is not installed this will return null.
|
||||||
*/
|
*/
|
||||||
public static ICarvingRegistry getChiselRegistry() {
|
public static ICarvingRegistry getChiselRegistry() {
|
||||||
return chisel;
|
return chisel;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* The block of the variation
|
* @param block The block of the variation
|
||||||
* @param metadata
|
* @param metadata The metadata of both the block and item
|
||||||
* The metadata of both the block and item
|
* @param order The sorting order.
|
||||||
* @param order
|
* @return A standard {@link ICarvingVariation} instance.
|
||||||
* The sorting order.
|
*/
|
||||||
* @return A standard {@link ICarvingVariation} instance.
|
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
|
||||||
*/
|
return new SimpleCarvingVariation(block, metadata, order);
|
||||||
public static ICarvingVariation getDefaultVariationFor(Block block, int metadata, int order) {
|
}
|
||||||
return new SimpleCarvingVariation(block, metadata, order);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* The name of the group.
|
* @param name 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) {
|
||||||
return new SimpleCarvingGroup(name);
|
return new SimpleCarvingGroup(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SimpleCarvingVariation implements ICarvingVariation {
|
public static class SimpleCarvingVariation implements ICarvingVariation {
|
||||||
|
|
||||||
private int order;
|
private int order;
|
||||||
private Block block;
|
private Block block;
|
||||||
private int meta;
|
private int meta;
|
||||||
private int damage;
|
private int damage;
|
||||||
|
|
||||||
public SimpleCarvingVariation(Block block, int metadata, int order) {
|
public SimpleCarvingVariation(Block block, int metadata, int order) {
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.block = block;
|
this.block = block;
|
||||||
this.meta = metadata;
|
this.meta = metadata;
|
||||||
this.damage = metadata;
|
this.damage = metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block getBlock() {
|
public Block getBlock() {
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getBlockMeta() {
|
public int getBlockMeta() {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemMeta() {
|
public int getItemMeta() {
|
||||||
return damage;
|
return damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getOrder() {
|
public int getOrder() {
|
||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SimpleCarvingGroup implements ICarvingGroup {
|
public static class SimpleCarvingGroup implements ICarvingGroup {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
private String sound;
|
private String sound;
|
||||||
private String oreName;
|
private String oreName;
|
||||||
|
|
||||||
private List<ICarvingVariation> variations = Lists.newArrayList();
|
private List<ICarvingVariation> variations = Lists.newArrayList();
|
||||||
|
|
||||||
public SimpleCarvingGroup(String name) {
|
public SimpleCarvingGroup(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ICarvingVariation> getVariations() {
|
public List<ICarvingVariation> getVariations() {
|
||||||
return Lists.newArrayList(variations);
|
return Lists.newArrayList(variations);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addVariation(ICarvingVariation variation) {
|
public void addVariation(ICarvingVariation variation) {
|
||||||
variations.add(variation);
|
variations.add(variation);
|
||||||
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
Collections.sort(variations, new Comparator<ICarvingVariation>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
public int compare(ICarvingVariation o1, ICarvingVariation o2) {
|
||||||
return CarvingUtils.compare(o1, o2);
|
return CarvingUtils.compare(o1, o2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean removeVariation(ICarvingVariation variation) {
|
public boolean removeVariation(ICarvingVariation variation) {
|
||||||
ICarvingVariation toRemove = null;
|
ICarvingVariation toRemove = null;
|
||||||
for (ICarvingVariation v : variations) {
|
for (ICarvingVariation v : variations) {
|
||||||
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
|
if (v.getBlock() == variation.getBlock() && v.getBlockMeta() == variation.getBlockMeta()) {
|
||||||
toRemove = v;
|
toRemove = v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return toRemove == null ? false : variations.remove(toRemove);
|
return toRemove == null ? false : variations.remove(toRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getSound() {
|
public String getSound() {
|
||||||
return sound;
|
return sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setSound(String sound) {
|
public void setSound(String sound) {
|
||||||
this.sound = sound;
|
this.sound = sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getOreName() {
|
public String getOreName() {
|
||||||
return oreName;
|
return oreName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setOreName(String oreName) {
|
public void setOreName(String oreName) {
|
||||||
this.oreName = oreName;
|
this.oreName = oreName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,70 +5,69 @@ 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.
|
||||||
*/
|
*/
|
||||||
public interface ICarvingGroup {
|
public interface ICarvingGroup {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name of this group. Used for internal identification.
|
* The name of this group. Used for internal identification.
|
||||||
*
|
*
|
||||||
* @return A string name for the group
|
* @return A string name for the group
|
||||||
*/
|
*/
|
||||||
String getName();
|
String getName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can return null. If null, fallback sound will be used (the standard chisel sound).
|
* Can return null. If null, fallback sound will be used (the standard chisel sound).
|
||||||
*
|
*
|
||||||
* @return The string resource path of the sound to use for chiseling items in this group
|
* @return The string resource path of the sound to use for chiseling items in this group
|
||||||
*/
|
*/
|
||||||
String getSound();
|
String getSound();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
String getOreName();
|
*/
|
||||||
|
String getOreName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets all carving variations associated with this group.
|
* Gets all carving variations associated with this group.
|
||||||
*
|
*
|
||||||
* @return A {@link List} of {@link ICarvingVariation}s
|
* @return A {@link List} of {@link ICarvingVariation}s
|
||||||
*/
|
*/
|
||||||
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
|
*
|
||||||
* An {@link ICarvingVariation} to add to this group
|
* @param variation 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
|
*
|
||||||
* An {@link ICarvingVariation} to add to this group
|
* @param variation An {@link ICarvingVariation} to add to this group
|
||||||
*/
|
*/
|
||||||
boolean removeVariation(ICarvingVariation variation);
|
boolean removeVariation(ICarvingVariation variation);
|
||||||
}
|
}
|
||||||
@@ -14,191 +14,168 @@ import net.minecraft.world.World;
|
|||||||
*/
|
*/
|
||||||
public interface ICarvingRegistry {
|
public interface ICarvingRegistry {
|
||||||
|
|
||||||
/* Getters */
|
/* Getters */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
|
||||||
* The metadata of the variation
|
*/
|
||||||
* @return The {@link ICarvingGroup} that the block/meta pair belongs to
|
ICarvingGroup getGroup(Block block, int meta);
|
||||||
*/
|
|
||||||
ICarvingGroup getGroup(Block block, int meta);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return The {@link ICarvingVariation} containing this block/meta pair
|
||||||
* The metadata of the variation
|
*/
|
||||||
* @return The {@link ICarvingVariation} containing this block/meta pair
|
ICarvingVariation getVariation(Block block, int meta);
|
||||||
*/
|
|
||||||
ICarvingVariation getVariation(Block block, int meta);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return All of the {@link ICarvingVariation}s in the group that contains this block/meta pair
|
||||||
* The metadata of the variation
|
*/
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
* @return A string oredict name for the group
|
||||||
* The metadata of the variation
|
*/
|
||||||
* @return A string oredict name for the group
|
String getOreName(Block block, int meta);
|
||||||
*/
|
|
||||||
String getOreName(Block block, int meta);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* The item of the variation
|
* @param item The item of the variation
|
||||||
* @param metadata
|
* @param metadata The metadata of the variation
|
||||||
* The metadata of the variation
|
* @return The string resource for the sound that can be used in
|
||||||
* @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.
|
* {@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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return A list of all registered group names, sorted alphabetically.
|
* @return A list of all registered group names, sorted alphabetically.
|
||||||
*/
|
*/
|
||||||
List<String> getSortedGroupNames();
|
List<String> getSortedGroupNames();
|
||||||
|
|
||||||
/* Setters */
|
/* Setters */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
void addVariation(String groupName, Block block, int metadata, int 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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* The name of the group to remove.
|
* @param groupName 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
|
*
|
||||||
* The {@link Block} of the {@link ICarvingVariation variation}
|
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||||
* @param metadata
|
* @param metadata The metadata of the {@link ICarvingVariation variation}
|
||||||
* 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
|
*
|
||||||
* The {@link Block} of the {@link ICarvingVariation variation}
|
* @param block The {@link Block} of the {@link ICarvingVariation variation}
|
||||||
* @param metadata
|
* @param metadata The metadata of the {@link ICarvingVariation variation}
|
||||||
* The metadata of the {@link ICarvingVariation variation}
|
* @param group The name of the group that the variation should be removed from
|
||||||
* @param group
|
* @return The ICarvingVariation that was removed. Null if nothing was removed.
|
||||||
* The name of the group that the variation should be removed from
|
*/
|
||||||
* @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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* The name of the group
|
* @param groupName The name of the group
|
||||||
* @param oreName
|
* @param oreName The oredict name
|
||||||
* The oredict name
|
*/
|
||||||
*/
|
void registerOre(String groupName, String oreName);
|
||||||
void registerOre(String groupName, String oreName);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the sound resource for a group.
|
* Sets the sound resource for a group.
|
||||||
* <p>
|
* <p>
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
@@ -8,31 +8,31 @@ import net.minecraft.item.Item;
|
|||||||
*/
|
*/
|
||||||
public interface ICarvingVariation {
|
public interface ICarvingVariation {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The base block of this variation.
|
* The base block of this variation.
|
||||||
*
|
*
|
||||||
* @return A {@link Block} that is the base of this variation
|
* @return A {@link Block} that is the base of this variation
|
||||||
*/
|
*/
|
||||||
Block getBlock();
|
Block getBlock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The metadata of this variation
|
* The metadata of this variation
|
||||||
*
|
*
|
||||||
* @return An int representing the metadata of this variation's {@link Block} in the world.
|
* @return An int representing the metadata of this variation's {@link Block} in the world.
|
||||||
*/
|
*/
|
||||||
int getBlockMeta();
|
int getBlockMeta();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The item metadata of this variation
|
* The item metadata of this variation
|
||||||
*
|
*
|
||||||
* @return An int representing the metadata of this variations's {@link Item}.
|
* @return An int representing the metadata of this variations's {@link Item}.
|
||||||
*/
|
*/
|
||||||
int getItemMeta();
|
int getItemMeta();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The "order" of this variation. Represents its position in the list of variations held by a group.
|
* The "order" of this variation. Represents its position in the list of variations held by a group.
|
||||||
*
|
*
|
||||||
* @return An integer to represent the position of this variation in the list of all variations in the group
|
* @return An integer to represent the position of this variation in the list of all variations in the group
|
||||||
*/
|
*/
|
||||||
int getOrder();
|
int getOrder();
|
||||||
}
|
}
|
||||||
@@ -6,15 +6,17 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
public interface IChiselMode {
|
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.
|
||||||
String name();
|
*/
|
||||||
|
String name();
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
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();
|
||||||
|
|
||||||
String getDescription();
|
String getDescription();
|
||||||
|
|
||||||
TextureType getType();
|
TextureType getType();
|
||||||
}
|
}
|
||||||
@@ -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,68 +10,70 @@ 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
|
public VariationInfoBase(ICarvingVariation variation, String unlocDesc, ISubmapManager manager, TextureType type) {
|
||||||
this.variation = variation;
|
this.variation = variation;
|
||||||
this.unlocDesc = unlocDesc;
|
this.unlocDesc = unlocDesc;
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingVariation getVariation() {
|
public ICarvingVariation getVariation() {
|
||||||
return variation;
|
return variation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return StatCollector.translateToLocal(unlocDesc);
|
return StatCollector.translateToLocal(unlocDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TextureType getType() {
|
public TextureType getType() {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ISubmapManager delegation
|
// ISubmapManager delegation
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int meta) {
|
public IIcon getIcon(int side, int meta) {
|
||||||
return manager.getIcon(side, meta);
|
return manager.getIcon(side, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
||||||
return manager.getIcon(world, x, y, z, side);
|
return manager.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(String modName, Block block, IIconRegister register) {
|
public void registerIcons(String modName, Block block, IIconRegister register) {
|
||||||
manager.registerIcons(modName, block, register);
|
manager.registerIcons(modName, block, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
||||||
return manager.createRenderContext(rendererOld, block, world);
|
return manager.createRenderContext(rendererOld, block, world);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
public void preRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
manager.preRenderSide(renderer, world, x, y, z, side);
|
manager.preRenderSide(renderer, world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
public void postRenderSide(RenderBlocks renderer, IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
manager.postRenderSide(renderer, world, x, y, z, side);
|
manager.postRenderSide(renderer, world, x, y, z, side);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
|
||||||
@@ -2,6 +2,6 @@ package com.cricketcraft.chisel.api.rendering;
|
|||||||
|
|
||||||
public class ClientUtils {
|
public class ClientUtils {
|
||||||
|
|
||||||
public static int renderCTMId;
|
public static int renderCTMId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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,25 +20,25 @@ 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
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public enum TextureType {
|
public enum TextureType {
|
||||||
|
|
||||||
// @formatter:off
|
// @formatter:off
|
||||||
TOPBOTSIDE("top", "bottom", "side"){
|
TOPBOTSIDE("top", "bottom", "side"){
|
||||||
@Override
|
@Override
|
||||||
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
protected Object registerIcons(ICarvingVariation variation, String modName, String texturePath, IIconRegister register) {
|
||||||
@@ -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,28 +332,19 @@ 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() {
|
public ISubmapManager createManagerFor(ICarvingVariation variation, String texturePath) {
|
||||||
if (theRenderBlocksCTM == null) {
|
|
||||||
theRenderBlocksCTM = new RenderBlocksCTM();
|
|
||||||
theRenderBlocksColumn = new RenderBlocksColumn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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,107 +2,118 @@ 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 {
|
||||||
|
|
||||||
static final private HashMap<String, String> namingConversion = new HashMap<String, String>();
|
static final private HashMap<String, String> namingConversion = new HashMap<String, String>();
|
||||||
|
|
||||||
public static class NameConversions {
|
public static class NameConversions {
|
||||||
|
|
||||||
public final static int MAX = 5;
|
public final static int MAX = 5;
|
||||||
|
|
||||||
protected static String conversion(String oldname, int step) {
|
protected static String conversion(String oldname, int step) {
|
||||||
oldname = General.cleanTags(oldname);
|
oldname = General.cleanTags(oldname);
|
||||||
String newname = null;
|
String newname = null;
|
||||||
switch (step) {
|
switch (step) {
|
||||||
case 0: // lookup list
|
case 0: // lookup list
|
||||||
return namingConversion.get(oldname);
|
return namingConversion.get(oldname);
|
||||||
case 1: // remove Chisel:
|
case 1: // remove Chisel:
|
||||||
if (oldname.startsWith("Chisel:")) {
|
if (oldname.startsWith("Chisel:")) {
|
||||||
newname = oldname.replaceAll("(?i)" + "Chisel:", "");
|
newname = oldname.replaceAll("(?i)" + "Chisel:", "");
|
||||||
}
|
}
|
||||||
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");
|
||||||
} else if (newname.startsWith("snakestone_")) {
|
} else if (newname.startsWith("snakestone_")) {
|
||||||
newname = newname.replaceFirst("snakestone_([a-z_]+)", "$1_snakestone");
|
newname = newname.replaceFirst("snakestone_([a-z_]+)", "$1_snakestone");
|
||||||
}
|
}
|
||||||
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")
|
||||||
if (newname.contains("wood_")) {
|
.toLowerCase()
|
||||||
newname = newname.replaceFirst("wood_([a-z_]+)", "$1_planks");
|
.replace('-', '_');
|
||||||
}
|
if (newname.contains("wood_")) {
|
||||||
return newname;
|
newname = newname.replaceFirst("wood_([a-z_]+)", "$1_planks");
|
||||||
case (MAX - 1): // ALWAYS last: rename "blockYxx" -> "yxx" (e.g.
|
}
|
||||||
// "dirt" -> "dirt").
|
return newname;
|
||||||
// This can be dangerous in cases like "carpet" (a block) ->
|
case (MAX - 1): // ALWAYS last: rename "blockYxx" -> "yxx" (e.g.
|
||||||
// "carpet" (NO block)
|
// "dirt" -> "dirt").
|
||||||
return oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2").toLowerCase().replaceFirst("block_", "");
|
// This can be dangerous in cases like "carpet" (a block) ->
|
||||||
default:
|
// "carpet" (NO block)
|
||||||
throw new IndexOutOfBoundsException("conversion got invalid parameter step=" + step);
|
return oldname.replaceAll("([a-z]+)([A-Z])", "$1_$2")
|
||||||
}
|
.toLowerCase()
|
||||||
}
|
.replaceFirst("block_", "");
|
||||||
}
|
default:
|
||||||
|
throw new IndexOutOfBoundsException("conversion got invalid parameter step=" + step);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static public void init() {
|
static public void init() {
|
||||||
namingConversion.put("blockCobble", "cobblestone");
|
namingConversion.put("blockCobble", "cobblestone");
|
||||||
namingConversion.put("iron", "iron_block");
|
namingConversion.put("iron", "iron_block");
|
||||||
namingConversion.put("gold", "gold_block");
|
namingConversion.put("gold", "gold_block");
|
||||||
namingConversion.put("diamond", "diamond_block");
|
namingConversion.put("diamond", "diamond_block");
|
||||||
namingConversion.put("lightstone", "glowstone");
|
namingConversion.put("lightstone", "glowstone");
|
||||||
namingConversion.put("lapis", "lapis_block");
|
namingConversion.put("lapis", "lapis_block");
|
||||||
namingConversion.put("emerald", "emerald_block");
|
namingConversion.put("emerald", "emerald_block");
|
||||||
namingConversion.put("hellrock", "netherrack");
|
namingConversion.put("hellrock", "netherrack");
|
||||||
namingConversion.put("stoneMoss", "mossy_cobblestone");
|
namingConversion.put("stoneMoss", "mossy_cobblestone");
|
||||||
namingConversion.put("stoneBrick", "stonebrick");
|
namingConversion.put("stoneBrick", "stonebrick");
|
||||||
namingConversion.put("fenceIron", "iron_bars");
|
namingConversion.put("fenceIron", "iron_bars");
|
||||||
namingConversion.put("fantasy", "fantasyblock");
|
namingConversion.put("fantasy", "fantasyblock");
|
||||||
namingConversion.put("carpetFloor", "carpet");
|
namingConversion.put("carpetFloor", "carpet");
|
||||||
namingConversion.put("temple", "templeblock");
|
namingConversion.put("temple", "templeblock");
|
||||||
namingConversion.put("templeMossy", "mossy_templeblock");
|
namingConversion.put("templeMossy", "mossy_templeblock");
|
||||||
namingConversion.put("factory", "factoryblock");
|
namingConversion.put("factory", "factoryblock");
|
||||||
namingConversion.put("laboratory", "laboratoryblock");
|
namingConversion.put("laboratory", "laboratoryblock");
|
||||||
// "LightGray" is unfortunately converted to "light_gray"
|
// "LightGray" is unfortunately converted to "light_gray"
|
||||||
namingConversion.put("stainedGlassLightGray", "stained_glass_lightgray");
|
namingConversion.put("stainedGlassLightGray", "stained_glass_lightgray");
|
||||||
namingConversion.put("stainedGlassPaneLightGray", "stained_glass_pane_lightgray");
|
namingConversion.put("stainedGlassPaneLightGray", "stained_glass_pane_lightgray");
|
||||||
namingConversion.put("blockTemple", "templeblock");
|
namingConversion.put("blockTemple", "templeblock");
|
||||||
namingConversion.put("stoneBrick", "stonebricksmooth");
|
namingConversion.put("stoneBrick", "stonebricksmooth");
|
||||||
namingConversion.put("blockTempleMossy", "mossy_templeblock");
|
namingConversion.put("blockTempleMossy", "mossy_templeblock");
|
||||||
namingConversion.put("blockFactory", "factoryblock");
|
namingConversion.put("blockFactory", "factoryblock");
|
||||||
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()
|
||||||
Item item = null;
|
.trace("[Chisel 2] findItem() START " + oldname);
|
||||||
for (int i = 0; i < NameConversions.MAX && item == null; i++) {
|
Item item = null;
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findItem() Checking for " + NameConversions.conversion(oldname, i));
|
for (int i = 0; i < NameConversions.MAX && item == null; i++) {
|
||||||
item = GameRegistry.findItem(Chisel.MOD_ID, 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));
|
||||||
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Block findBlock(String oldname) {
|
public static Block findBlock(String oldname) {
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findBlock() START: " + oldname);
|
FMLLog.getLogger()
|
||||||
Block block = null;
|
.trace("[Chisel 2] findBlock() START: " + oldname);
|
||||||
for (int i = 0; i < NameConversions.MAX && block == null; i++) {
|
Block block = null;
|
||||||
FMLLog.getLogger().trace("[Chisel 2] findBlock() Checking for " + NameConversions.conversion(oldname, i));
|
for (int i = 0; i < NameConversions.MAX && block == null; i++) {
|
||||||
block = GameRegistry.findBlock(Chisel.MOD_ID, 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));
|
||||||
|
}
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,146 +35,187 @@ 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(
|
||||||
public static final String MOD_NAME = "Chisel";
|
"dig.stone",
|
||||||
public static final String VERSION = "GRADLETOKEN_VERSION";
|
MOD_ID + ":step.templeblock",
|
||||||
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType("holystone", 1.0f, 1.0f);
|
1.0f,
|
||||||
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
1.0f);
|
||||||
public static boolean multipartLoaded = false;
|
public static final String MOD_NAME = "Chisel";
|
||||||
public static int renderEldritchId;
|
public static final String VERSION = Tags.VERSION;
|
||||||
public static int renderAutoChiselId;
|
public static final BlockCarvable.SoundType soundHolystoneFootstep = new BlockCarvable.SoundType(
|
||||||
public static int renderGlowId;
|
"holystone",
|
||||||
public static int renderLayeredId;
|
1.0f,
|
||||||
public static int roadLineId;
|
1.0f);
|
||||||
|
public static final BlockCarvable.SoundType soundMetalFootstep = new BlockCarvable.SoundType("metal", 1.0f, 1.0f);
|
||||||
|
public static boolean multipartLoaded = false;
|
||||||
|
public static boolean gtnhLoaded = false;
|
||||||
|
public static boolean iguanaTweaksLoaded = false;
|
||||||
|
public static int renderEldritchId;
|
||||||
|
public static int renderAutoChiselId;
|
||||||
|
public static int renderGlowId;
|
||||||
|
public static int renderLayeredId;
|
||||||
|
public static int roadLineId;
|
||||||
|
|
||||||
public static final Logger logger = LogManager.getLogger(MOD_NAME);
|
public static final Logger logger = LogManager.getLogger(MOD_NAME);
|
||||||
|
|
||||||
@Instance(MOD_ID)
|
@Instance(MOD_ID)
|
||||||
public static Chisel instance;
|
public static Chisel instance;
|
||||||
|
|
||||||
public Chisel() {
|
public Chisel() {
|
||||||
ChiselAPIProps.MOD_ID = MOD_ID;
|
ChiselAPIProps.MOD_ID = MOD_ID;
|
||||||
CarvableHelper.itemCarvableClass = ItemCarvable.class;
|
CarvableHelper.itemCarvableClass = ItemCarvable.class;
|
||||||
Carving.construct();
|
Carving.construct();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SidedProxy(clientSide = "team.chisel.proxy.ClientProxy", serverSide = "team.chisel.proxy.CommonProxy")
|
@SidedProxy(clientSide = "team.chisel.proxy.ClientProxy", serverSide = "team.chisel.proxy.CommonProxy")
|
||||||
public static CommonProxy proxy;
|
public static CommonProxy proxy;
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void missingMapping(FMLMissingMappingsEvent event) {
|
public void missingMapping(FMLMissingMappingsEvent event) {
|
||||||
BlockNameConversion.init();
|
BlockNameConversion.init();
|
||||||
|
|
||||||
for (MissingMapping m : event.get()) {
|
for (MissingMapping m : event.get()) {
|
||||||
// This bug was introduced along with Chisel 1.5.2, and was fixed in
|
// This bug was introduced along with Chisel 1.5.2, and was fixed in
|
||||||
// 1.5.3.
|
// 1.5.3.
|
||||||
// Ice Stairs were called null.0-7 instead of other names, and
|
// Ice Stairs were called null.0-7 instead of other names, and
|
||||||
// Marble/Limestone stairs did not exist.
|
// Marble/Limestone stairs did not exist.
|
||||||
// This fixes the bug.
|
// This fixes the bug.
|
||||||
if (m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
|
if (m.name.startsWith("null.") && m.name.length() == 6 && m.type == Type.BLOCK) {
|
||||||
m.warn();// (Action.WARN);
|
m.warn();// (Action.WARN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs,
|
// Fix mapping of snakestoneSand, snakestoneStone, limestoneStairs,
|
||||||
// marbleStairs when loading an old (1.5.4) save
|
// marbleStairs when loading an old (1.5.4) save
|
||||||
else if (m.type == Type.BLOCK) {
|
else if (m.type == Type.BLOCK) {
|
||||||
final Block block = BlockNameConversion.findBlock(m.name);
|
final Block block = BlockNameConversion.findBlock(m.name);
|
||||||
|
|
||||||
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()
|
||||||
} else if (m.type == Type.ITEM) {
|
.warn("Block " + m.name + " could not get remapped.");
|
||||||
final Item item = BlockNameConversion.findItem(m.name);
|
} else if (m.type == Type.ITEM) {
|
||||||
|
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();
|
||||||
Configurations.config = new Configuration(configFile);
|
Configurations.config = new Configuration(configFile);
|
||||||
Configurations.config.load();
|
Configurations.config.load();
|
||||||
Configurations.refreshConfig();
|
Configurations.refreshConfig();
|
||||||
|
|
||||||
TabsInit.preInit();
|
if (Loader.isModLoaded("dreamcraft")) {
|
||||||
Features.preInit();
|
gtnhLoaded = true;
|
||||||
Statistics.init();
|
}
|
||||||
PacketHandler.init();
|
if (Loader.isModLoaded("IguanaTweaksTConstruct")) {
|
||||||
ChiselController.INSTANCE.preInit();
|
iguanaTweaksLoaded = true;
|
||||||
if (Loader.isModLoaded("ForgeMultipart")) {
|
}
|
||||||
new FMPCompat().init();
|
TabsInit.preInit();
|
||||||
}
|
Features.preInit();
|
||||||
proxy.preInit();
|
Statistics.init();
|
||||||
}
|
PacketHandler.init();
|
||||||
|
ChiselController.INSTANCE.preInit();
|
||||||
|
if (Loader.isModLoaded("ForgeMultipart")) {
|
||||||
|
new FMPCompat().init();
|
||||||
|
}
|
||||||
|
proxy.preInit();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void init(FMLInitializationEvent event) {
|
public void init(FMLInitializationEvent event) {
|
||||||
Features.init();
|
Features.init();
|
||||||
|
|
||||||
NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler());
|
NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler());
|
||||||
|
|
||||||
addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
|
addWorldgen(Features.MARBLE, ChiselBlocks.marble, Configurations.marbleAmount);
|
||||||
addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
|
addWorldgen(Features.LIMESTONE, ChiselBlocks.limestone, Configurations.limestoneAmount);
|
||||||
addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5);
|
addWorldgen(Features.ANDESITE, ChiselBlocks.andesite, Configurations.andesiteAmount, 40, 100, 0.5);
|
||||||
addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5);
|
addWorldgen(Features.GRANITE, ChiselBlocks.granite, Configurations.graniteAmount, 40, 100, 0.5);
|
||||||
addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5);
|
addWorldgen(Features.DIORITE, ChiselBlocks.diorite, Configurations.dioriteAmount, 40, 100, 0.5);
|
||||||
GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000);
|
GameRegistry.registerWorldGenerator(GeneratorChisel.INSTANCE, 1000);
|
||||||
|
|
||||||
EntityRegistry.registerModEntity(EntityChiselSnowman.class, "snowman", 0, this, 80, 1, true);
|
EntityRegistry.registerModEntity(EntityChiselSnowman.class, "snowman", 0, this, 80, 1, true);
|
||||||
|
|
||||||
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addWorldgen(Features feature, Block block, double... data) {
|
private void addWorldgen(Features feature, Block block, double... data) {
|
||||||
if (feature.enabled()) {
|
if (feature.enabled()) {
|
||||||
if (data.length == 1) {
|
if (data.length == 1) {
|
||||||
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0]);
|
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0]);
|
||||||
} else if (data.length > 1 && data.length < 4) {
|
} else if (data.length > 1 && data.length < 4) {
|
||||||
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2]);
|
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2]);
|
||||||
} else if (data.length == 4) {
|
} else if (data.length == 4) {
|
||||||
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2], data[3]);
|
GeneratorChisel.INSTANCE.addFeature(block, 32, (int) data[0], (int) data[1], (int) data[2], data[3]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void postInit(FMLPostInitializationEvent event) {
|
public void postInit(FMLPostInitializationEvent event) {
|
||||||
TabsInit.postInit();
|
TabsInit.postInit();
|
||||||
Compatibility.init(event);
|
Compatibility.init(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onIMC(IMCEvent event) {
|
public void onIMC(IMCEvent event) {
|
||||||
for (IMCMessage msg : event.getMessages()) {
|
for (IMCMessage msg : event.getMessages()) {
|
||||||
IMCHandler.INSTANCE.handleMessage(msg);
|
IMCHandler.INSTANCE.handleMessage(msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
public void onConfigChanged(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||||
if (event.modID.equals("chisel")) {
|
if (event.modID.equals("chisel")) {
|
||||||
Configurations.refreshConfig();
|
Configurations.refreshConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,14 +4,14 @@ import cpw.mods.fml.common.ICrashCallable;
|
|||||||
|
|
||||||
public class ChiselCrashCallable implements ICrashCallable {
|
public class ChiselCrashCallable implements ICrashCallable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String call() throws Exception {
|
public String call() throws Exception {
|
||||||
return "Errors like \"[FML]: Unable to lookup ...\" are NOT the cause of this crash. "
|
return "Errors like \"[FML]: Unable to lookup ...\" are NOT the cause of this crash. "
|
||||||
+ "You can safely ignore these errors. And update forge while you're at it.";
|
+ "You can safely ignore these errors. And update forge while you're at it.";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getLabel() {
|
public String getLabel() {
|
||||||
return Chisel.MOD_NAME;
|
return Chisel.MOD_NAME;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+6266
-3081
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,67 +8,70 @@ 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() {
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
setHardness(1F);
|
setHardness(1F);
|
||||||
setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.8125f, 0.875f);
|
setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.8125f, 0.875f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return Chisel.renderAutoChiselId;
|
return Chisel.renderAutoChiselId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
float y1, float z1) {
|
||||||
if (world.isRemote)
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
return true;
|
if (world.isRemote) 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
|
public void breakBlock(World world, int x, int y, int z, Block block, int par6) {
|
||||||
dropItems(world, x, y, z);
|
dropItems(world, x, y, z);
|
||||||
super.breakBlock(world, x, y, z, block, par6);
|
super.breakBlock(world, x, y, z, block, par6);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dropItems(World world, int x, int y, int z) {
|
private void dropItems(World world, int x, int y, int z) {
|
||||||
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
TileEntity tileEntity = world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (!(tileEntity instanceof TileEntityAutoChisel)) {
|
if (!(tileEntity instanceof TileEntityAutoChisel)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
|
TileEntityAutoChisel inventory = (TileEntityAutoChisel) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
for (int c = 0; c < inventory.getSizeInventory(); c++) {
|
for (int c = 0; c < inventory.getSizeInventory(); c++) {
|
||||||
ItemStack stack = inventory.getStackInSlot(c);
|
ItemStack stack = inventory.getStackInSlot(c);
|
||||||
if (stack != null) {
|
if (stack != null) {
|
||||||
dropBlockAsItem(world, x, y, z, stack);
|
dropBlockAsItem(world, x, y, z, stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World var1, int var2) {
|
public TileEntity createNewTileEntity(World var1, int var2) {
|
||||||
return new TileEntityAutoChisel();
|
return new TileEntityAutoChisel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,16 +8,16 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
*/
|
*/
|
||||||
public class BlockBeaconBase extends BlockCarvable {
|
public class BlockBeaconBase extends BlockCarvable {
|
||||||
|
|
||||||
public BlockBeaconBase() {
|
public BlockBeaconBase() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockBeaconBase(Material mat) {
|
public BlockBeaconBase(Material mat) {
|
||||||
super(mat);
|
super(mat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
public boolean isBeaconBase(IBlockAccess worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,181 +2,176 @@ 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 {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
private boolean isAlpha;
|
private boolean isAlpha;
|
||||||
|
|
||||||
public BlockCarvable() {
|
public BlockCarvable() {
|
||||||
this(Material.rock);
|
this(Material.rock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvable(Material m) {
|
public BlockCarvable(Material m) {
|
||||||
super(m);
|
super(m);
|
||||||
if (m == Material.rock || m == Material.iron) {
|
if (m == Material.rock || m == Material.iron) {
|
||||||
setHarvestLevel("pickaxe", 0);
|
setHarvestLevel("pickaxe", 0);
|
||||||
}
|
}
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
setResistance(10.0F);
|
setResistance(10.0F);
|
||||||
setHardness(2.0F);
|
setHardness(2.0F);
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvable setStained(boolean a) {
|
public BlockCarvable setStained(boolean a) {
|
||||||
this.isAlpha = a;
|
this.isAlpha = a;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return isAlpha ? 1 : 0;
|
return isAlpha ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.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) {
|
||||||
return carverHelper.getIcon(world, x, y, z, side);
|
return carverHelper.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
|
carverHelper.registerBlockIcons(Chisel.MOD_ID, this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SoundType extends Block.SoundType {
|
public static class SoundType extends Block.SoundType {
|
||||||
|
|
||||||
public final String soundNameStep;
|
public final String soundNameStep;
|
||||||
public final String soundNameBreak;
|
public final String soundNameBreak;
|
||||||
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
|
*
|
||||||
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
|
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||||
* @param volume
|
* "mod:step.soundName" respectively)
|
||||||
* default 1.0f
|
* @param volume default 1.0f
|
||||||
* @param frequency
|
* @param frequency default 1.0f
|
||||||
* 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);
|
this.soundNameStep = null;
|
||||||
this.soundNameStep = null;
|
this.soundNameBreak = null;
|
||||||
this.soundNameBreak = null;
|
this.soundNamePlace = null;
|
||||||
this.soundNamePlace = null;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* block break sound
|
* @param soundNameBreak block break sound
|
||||||
* @param soundNameStep
|
* @param soundNameStep block step sound
|
||||||
* block step sound
|
* @param volume default 1.0f
|
||||||
* @param volume
|
* @param frequency default 1.0f
|
||||||
* default 1.0f
|
*/
|
||||||
* @param frequency
|
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
||||||
* default 1.0f
|
super(soundNameStep, volume, frequency);
|
||||||
*/
|
this.soundNameStep = soundNameStep;
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
this.soundNameBreak = soundNameBreak;
|
||||||
super(soundNameStep, volume, frequency);
|
this.soundNamePlace = null;
|
||||||
this.soundNameStep = soundNameStep;
|
}
|
||||||
this.soundNameBreak = soundNameBreak;
|
|
||||||
this.soundNamePlace = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*
|
||||||
* block break sound
|
* @param soundNameBreak block break sound
|
||||||
* @param soundNameStep
|
* @param soundNameStep block step sound
|
||||||
* block step sound
|
* @param soundNamePlace block place sound
|
||||||
* @param soundNamePlace
|
* @param volume default 1.0f
|
||||||
* block place sound
|
* @param frequency default 1.0f
|
||||||
* @param volume
|
*/
|
||||||
* default 1.0f
|
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume,
|
||||||
* @param frequency
|
float frequency) {
|
||||||
* default 1.0f
|
super(soundNameStep, volume, frequency);
|
||||||
*/
|
this.soundNameStep = soundNameStep;
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
|
this.soundNameBreak = soundNameBreak;
|
||||||
super(soundNameStep, volume, frequency);
|
this.soundNamePlace = soundNamePlace;
|
||||||
this.soundNameStep = soundNameStep;
|
}
|
||||||
this.soundNameBreak = soundNameBreak;
|
|
||||||
this.soundNamePlace = soundNamePlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@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,19 +1,19 @@
|
|||||||
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() {
|
||||||
super(Material.rock);
|
super(Material.rock);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12,87 +12,89 @@ 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;
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
|
|
||||||
public BlockCarvableBeacon() {
|
public BlockCarvableBeacon() {
|
||||||
super();
|
super();
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
setLightLevel(5.0F);
|
setLightLevel(5.0F);
|
||||||
setBlockTextureName("beacon");
|
setBlockTextureName("beacon");
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createNewTileEntity(World world, int meta) {
|
public TileEntity createNewTileEntity(World world, int meta) {
|
||||||
return new TileEntityCarvableBeacon();
|
return new TileEntityCarvableBeacon();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
if (world.isRemote) {
|
float hitY, float hitZ) {
|
||||||
return true;
|
if (world.isRemote) {
|
||||||
} else {
|
return true;
|
||||||
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
|
} else {
|
||||||
|
TileEntityCarvableBeacon tileentitybeacon = (TileEntityCarvableBeacon) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (tileentitybeacon != null) {
|
if (tileentitybeacon != null) {
|
||||||
player.func_146104_a(tileentitybeacon);
|
player.func_146104_a(tileentitybeacon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
|
public void getSubBlocks(Item item, CreativeTabs p_149666_2_, List list) {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||||
return new ItemStack(ChiselBlocks.beacon, 1, world.getBlockMetadata(x, y, z));
|
return new ItemStack(ChiselBlocks.beacon, 1, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return renderId;
|
return renderId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||||
|
|
||||||
if (stack.hasDisplayName()) {
|
if (stack.hasDisplayName()) {
|
||||||
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
|
((TileEntityCarvableBeacon) world.getTileEntity(x, y, z)).func_145999_a(stack.getDisplayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,53 +9,52 @@ 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;
|
||||||
|
|
||||||
public class BlockCarvableBookshelf extends BlockCarvable {
|
public class BlockCarvableBookshelf extends BlockCarvable {
|
||||||
|
|
||||||
public BlockCarvableBookshelf() {
|
public BlockCarvableBookshelf() {
|
||||||
super(Material.wood);
|
super(Material.wood);
|
||||||
setHarvestLevel("axe", 0);
|
setHarvestLevel("axe", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random) {
|
public int quantityDropped(Random random) {
|
||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int ammount, Random random, int meta) {
|
public Item getItemDropped(int ammount, Random random, int meta) {
|
||||||
return Items.book;
|
return Items.book;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int damage) {
|
public int damageDropped(int damage) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDamageValue(World world, int x, int y, int z) {
|
public int getDamageValue(World world, int x, int y, int z) {
|
||||||
return world.getBlockMetadata(x, y, z);
|
return world.getBlockMetadata(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getEnchantPowerBonus(World world, int x, int y, int z) {
|
public float getEnchantPowerBonus(World world, int x, int y, int z) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,52 +10,57 @@ 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;
|
||||||
|
|
||||||
public BlockCarvableCarpet(Material m) {
|
public BlockCarvableCarpet(Material m) {
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.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) {
|
||||||
return carverHelper.getIcon(world, x, y, z, side);
|
return carverHelper.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,21 +6,21 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
|
|
||||||
public class BlockCarvableColor extends BlockCarvable {
|
public class BlockCarvableColor extends BlockCarvable {
|
||||||
|
|
||||||
public BlockCarvableColor() {
|
public BlockCarvableColor() {
|
||||||
this(Material.rock);
|
this(Material.rock);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableColor(Material m) {
|
public BlockCarvableColor(Material m) {
|
||||||
super(m);
|
super(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int color) {
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int color) {
|
||||||
int newColor = 15 - color;
|
int newColor = 15 - color;
|
||||||
if (world.getBlockMetadata(x, y, z) != newColor) {
|
if (world.getBlockMetadata(x, y, z) != newColor) {
|
||||||
world.setBlockMetadataWithNotify(x, y, z, newColor, 3);
|
world.setBlockMetadataWithNotify(x, y, z, newColor, 3);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,87 +22,94 @@ 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 {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
private boolean isAlpha = false;
|
private boolean isAlpha = false;
|
||||||
private CTM ctm = CTM.getInstance();
|
private CTM ctm = CTM.getInstance();
|
||||||
|
|
||||||
public BlockCarvableGlass() {
|
public BlockCarvableGlass() {
|
||||||
super(Material.glass, false);
|
super(Material.glass, false);
|
||||||
|
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableGlass setStained(boolean a) {
|
public BlockCarvableGlass setStained(boolean a) {
|
||||||
this.isAlpha = a;
|
this.isAlpha = a;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isNormalCube() {
|
public boolean isNormalCube() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
||||||
int meX = x + face.offsetX;
|
.getOpposite();
|
||||||
int meY = y + face.offsetY;
|
int meX = x + face.offsetX;
|
||||||
int meZ = z + face.offsetZ;
|
int meY = y + face.offsetY;
|
||||||
Block block = world.getBlock(meX, meY, meZ);
|
int meZ = z + face.offsetZ;
|
||||||
int meta = world.getBlockMetadata(meX, meY, meZ);
|
Block block = world.getBlock(meX, meY, meZ);
|
||||||
Block otherBlock = ctm.getBlockOrFacade(world, x, y, z, face.ordinal());
|
int meta = world.getBlockMetadata(meX, meY, meZ);
|
||||||
int otherMeta = ctm.getBlockOrFacadeMetadata(world, x, y, z, face.ordinal());
|
Block otherBlock = ctm.getBlockOrFacade(world, x, y, z, face.ordinal());
|
||||||
return block != otherBlock || meta != otherMeta;
|
int otherMeta = ctm.getBlockOrFacadeMetadata(world, x, y, z, face.ordinal());
|
||||||
}
|
return block != otherBlock || meta != otherMeta;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
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,58 +1,59 @@
|
|||||||
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 {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon glowTexture;
|
private IIcon glowTexture;
|
||||||
|
|
||||||
private SubmapManagerBase submapManagerBase;
|
private SubmapManagerBase submapManagerBase;
|
||||||
private String glowTexturePath;
|
private String glowTexturePath;
|
||||||
|
|
||||||
public BlockCarvableGlow(String glowTexture) {
|
public BlockCarvableGlow(String glowTexture) {
|
||||||
super();
|
super();
|
||||||
setLightLevel(0.5f);
|
setLightLevel(0.5f);
|
||||||
this.glowTexturePath = glowTexture;
|
this.glowTexturePath = glowTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableGlow(Material mat, String glowTexture) {
|
public BlockCarvableGlow(Material mat, String glowTexture) {
|
||||||
super(mat);
|
super(mat);
|
||||||
this.glowTexturePath = glowTexture;
|
this.glowTexturePath = glowTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableGlow(Material material, String glowTexture, SubmapManagerBase submapManagerBase) {
|
public BlockCarvableGlow(Material material, String glowTexture, SubmapManagerBase submapManagerBase) {
|
||||||
super(material);
|
super(material);
|
||||||
this.glowTexturePath = glowTexture;
|
this.glowTexturePath = glowTexture;
|
||||||
this.submapManagerBase = submapManagerBase;
|
this.submapManagerBase = submapManagerBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
glowTexture = register.registerIcon(Chisel.MOD_ID + ":" + glowTexturePath);
|
glowTexture = register.registerIcon(Chisel.MOD_ID + ":" + glowTexturePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasSubmapManager() {
|
public boolean hasSubmapManager() {
|
||||||
return submapManagerBase == null;
|
return submapManagerBase == null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubmapManagerBase getSubmapManager() {
|
public SubmapManagerBase getSubmapManager() {
|
||||||
return hasSubmapManager() ? submapManagerBase : null;
|
return hasSubmapManager() ? submapManagerBase : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getGlowTexture() {
|
public IIcon getGlowTexture() {
|
||||||
return glowTexture;
|
return glowTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return Chisel.renderGlowId;
|
return Chisel.renderGlowId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,29 +14,34 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class BlockCarvableGlowstone extends BlockCarvable {
|
public class BlockCarvableGlowstone extends BlockCarvable {
|
||||||
|
|
||||||
public BlockCarvableGlowstone() {
|
public BlockCarvableGlowstone() {
|
||||||
super(Material.glass);
|
super(Material.glass);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random) {
|
public int quantityDropped(Random random) {
|
||||||
return Blocks.glowstone.quantityDropped(random);
|
return Blocks.glowstone.quantityDropped(random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int i, Random random, int a) {
|
public Item getItemDropped(int i, Random random, int a) {
|
||||||
return Items.glowstone_dust;
|
return Items.glowstone_dust;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
public int getDamageValue(World world, int x, int y, int z) {
|
||||||
Block glowstone = world.getBlock(x, y, z);
|
return world.getBlockMetadata(x, y, z);
|
||||||
int meta = world.getBlockMetadata(x, y, z);
|
}
|
||||||
return new ItemStack(Item.getItemFromBlock(glowstone), 1, meta);
|
|
||||||
}
|
@Override
|
||||||
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||||
|
Block glowstone = world.getBlock(x, y, z);
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
return new ItemStack(Item.getItemFromBlock(glowstone), 1, meta);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -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,58 +13,63 @@ 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;
|
||||||
|
|
||||||
public BlockCarvableIce() {
|
public BlockCarvableIce() {
|
||||||
super();
|
super();
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||||
|
|
||||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||||
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); } }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,44 +2,45 @@ 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) {
|
||||||
super(block, meta, helper);
|
super(block, meta, helper);
|
||||||
|
|
||||||
slipperiness = 0.98F;
|
slipperiness = 0.98F;
|
||||||
setTickRandomly(true);
|
setTickRandomly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||||
ChiselBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
ChiselBlocks.ice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random) {
|
public int quantityDropped(Random par1Random) {
|
||||||
return ChiselBlocks.ice.quantityDropped(par1Random);
|
return ChiselBlocks.ice.quantityDropped(par1Random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||||
ChiselBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
|
ChiselBlocks.ice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMobilityFlag() {
|
public int getMobilityFlag() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,71 +11,70 @@ import net.minecraft.world.World;
|
|||||||
|
|
||||||
public class BlockCarvableLamp extends BlockCarvable {
|
public class BlockCarvableLamp extends BlockCarvable {
|
||||||
|
|
||||||
BlockCarvableLamp blockUnpowered;
|
BlockCarvableLamp blockUnpowered;
|
||||||
BlockCarvableLamp blockPowered;
|
BlockCarvableLamp blockPowered;
|
||||||
boolean powered;
|
boolean powered;
|
||||||
|
|
||||||
public BlockCarvableLamp() {
|
public BlockCarvableLamp() {
|
||||||
super(Material.redstoneLight);
|
super(Material.redstoneLight);
|
||||||
|
|
||||||
powered = false;
|
powered = false;
|
||||||
blockUnpowered = this;
|
blockUnpowered = this;
|
||||||
blockPowered = new BlockCarvableLamp(this);
|
blockPowered = new BlockCarvableLamp(this);
|
||||||
|
|
||||||
setHardness(0.3F);
|
setHardness(0.3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableLamp(BlockCarvableLamp unpoweredVersion) {
|
public BlockCarvableLamp(BlockCarvableLamp unpoweredVersion) {
|
||||||
super(Material.redstoneLight);
|
super(Material.redstoneLight);
|
||||||
|
|
||||||
carverHelper = unpoweredVersion.carverHelper;
|
carverHelper = unpoweredVersion.carverHelper;
|
||||||
|
|
||||||
powered = true;
|
powered = true;
|
||||||
blockUnpowered = unpoweredVersion;
|
blockUnpowered = unpoweredVersion;
|
||||||
blockPowered = this;
|
blockPowered = this;
|
||||||
|
|
||||||
setLightLevel(1.0F);
|
setLightLevel(1.0F);
|
||||||
setHardness(0.3F);
|
setHardness(0.3F);
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
||||||
if (powered && !isGettingPower) {
|
if (powered && !isGettingPower) {
|
||||||
world.setBlock(x, y, z, blockUnpowered, meta, 2);
|
world.setBlock(x, y, z, blockUnpowered, meta, 2);
|
||||||
} else if (!powered && isGettingPower) {
|
} else if (!powered && isGettingPower) {
|
||||||
world.setBlock(x, y, z, blockPowered, meta, 2);
|
world.setBlock(x, y, z, blockPowered, meta, 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockAdded(World world, int x, int y, int z) {
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
checkPower(world, x, y, z);
|
checkPower(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
public void onNeighborBlockChange(World world, int x, int y, int z, Block block) {
|
||||||
checkPower(world, x, y, z);
|
checkPower(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @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
|
||||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||||
return Item.getItemFromBlock(blockUnpowered);
|
return Item.getItemFromBlock(blockUnpowered);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||||
return new ItemStack(blockUnpowered, 1, world.getBlockMetadata(x, y, z));
|
return new ItemStack(blockUnpowered, 1, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,35 +1,36 @@
|
|||||||
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 {
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
private IIcon baseTexture;
|
private IIcon baseTexture;
|
||||||
private String baseTexLocation;
|
private String baseTexLocation;
|
||||||
|
|
||||||
public BlockCarvableLayered(Material mat, String baseTexLocation) {
|
public BlockCarvableLayered(Material mat, String baseTexLocation) {
|
||||||
super(mat);
|
super(mat);
|
||||||
this.baseTexLocation = baseTexLocation;
|
this.baseTexLocation = baseTexLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation);
|
baseTexture = register.registerIcon(Chisel.MOD_ID + ":" + baseTexLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IIcon getBaseTex() {
|
public IIcon getBaseTex() {
|
||||||
return baseTexture;
|
return baseTexture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return Chisel.renderLayeredId;
|
return Chisel.renderLayeredId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,64 +15,69 @@ 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;
|
||||||
|
|
||||||
public BlockCarvablePackedIce() {
|
public BlockCarvablePackedIce() {
|
||||||
super(Material.ice);
|
super(Material.ice);
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
this.slipperiness = Blocks.packed_ice.slipperiness;
|
this.slipperiness = Blocks.packed_ice.slipperiness;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(int meta, int fortune, Random random) {
|
public int quantityDropped(int meta, int fortune, Random random) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||||
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
super.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||||
|
|
||||||
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
par2EntityPlayer.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
|
||||||
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); } }
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,44 +2,45 @@ 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) {
|
||||||
super(block, meta, helper);
|
super(block, meta, helper);
|
||||||
|
|
||||||
slipperiness = 0.98F;
|
slipperiness = 0.98F;
|
||||||
setTickRandomly(true);
|
setTickRandomly(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6) {
|
||||||
ChiselBlocks.packedice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
ChiselBlocks.packedice.harvestBlock(par1World, par2EntityPlayer, par3, par4, par5, par6);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random par1Random) {
|
public int quantityDropped(Random par1Random) {
|
||||||
return ChiselBlocks.packedice.quantityDropped(par1Random);
|
return ChiselBlocks.packedice.quantityDropped(par1Random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||||
ChiselBlocks.packedice.updateTick(par1World, par2, par3, par4, par5Random);
|
ChiselBlocks.packedice.updateTick(par1World, par2, par3, par4, par5Random);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMobilityFlag() {
|
public int getMobilityFlag() {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,66 +9,73 @@ 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 {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
public boolean isAlpha;
|
public boolean isAlpha;
|
||||||
|
|
||||||
public BlockCarvablePane(Material material, boolean drops) {
|
public BlockCarvablePane(Material material, boolean drops) {
|
||||||
super("", "", material, drops);
|
super("", "", material, drops);
|
||||||
|
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
|
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvablePane setStained(boolean a) {
|
public BlockCarvablePane setStained(boolean a) {
|
||||||
this.isAlpha = a;
|
this.isAlpha = a;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return isAlpha ? 1 : 0;
|
return isAlpha ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RendererCTMPane.id;
|
return RendererCTMPane.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -5,25 +5,26 @@ import net.minecraft.world.IBlockAccess;
|
|||||||
|
|
||||||
public class BlockCarvablePowered extends BlockCarvable {
|
public class BlockCarvablePowered extends BlockCarvable {
|
||||||
|
|
||||||
public BlockCarvablePowered(Material m) {
|
public BlockCarvablePowered(Material m) {
|
||||||
super(m);
|
super(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
* Can this block provide power. Only wire currently seems to have this change based on its state.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvidePower() {
|
public boolean canProvidePower() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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
|
*/
|
||||||
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
@Override
|
||||||
return 15;
|
public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5) {
|
||||||
}
|
return 15;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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,113 +7,114 @@ 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)
|
||||||
|
private IIcon top, face;
|
||||||
|
|
||||||
@SideOnly(Side.CLIENT)
|
private String faceLocation;
|
||||||
private IIcon top, face;
|
|
||||||
|
|
||||||
private String faceLocation;
|
public BlockCarvablePumpkin(boolean isOn) {
|
||||||
|
super(isOn);
|
||||||
|
this.setStepSound(Block.soundTypeWood);
|
||||||
|
if (isOn) setLightLevel(10.0F);
|
||||||
|
}
|
||||||
|
|
||||||
public BlockCarvablePumpkin(boolean isOn) {
|
@Override
|
||||||
super(isOn);
|
public void onBlockAdded(World world, int x, int y, int z) {
|
||||||
this.setStepSound(Block.soundTypeWood);
|
if (world.getBlock(x, y - 1, z) == Blocks.snow && world.getBlock(x, y - 2, z) == Blocks.snow) {
|
||||||
if (isOn)
|
if (!world.isRemote) {
|
||||||
setLightLevel(10.0F);
|
// Let's grab the pumpkin before we start
|
||||||
carverHelper = new CarvableHelper(this);
|
ItemStack pumpkin = new ItemStack(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||||
public void onBlockAdded(World world, int x, int y, int z) {
|
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||||
if (world.getBlock(x, y - 1, z) == Blocks.snow && world.getBlock(x, y - 2, z) == Blocks.snow) {
|
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||||
if (!world.isRemote) {
|
EntityChiselSnowman snowman = new EntityChiselSnowman(world);
|
||||||
// Let's grab the pumpkin before we start
|
snowman.setCurrentItemOrArmor(2, pumpkin);
|
||||||
ItemStack pumpkin = new ItemStack(world.getBlock(x, y, z), world.getBlockMetadata(x, y, z));
|
snowman.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||||
|
world.spawnEntityInWorld(snowman);
|
||||||
|
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||||
|
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||||
|
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||||
|
}
|
||||||
|
|
||||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
// Spawn some lovely particles
|
||||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
for (int c = 0; c < 120; ++c) {
|
||||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
world.spawnParticle(
|
||||||
EntityChiselSnowman snowman = new EntityChiselSnowman(world);
|
"snowshovel",
|
||||||
snowman.setCurrentItemOrArmor(2, pumpkin);
|
x + world.rand.nextDouble(),
|
||||||
snowman.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
y - 2 + world.rand.nextDouble() * 2.5D,
|
||||||
world.spawnEntityInWorld(snowman);
|
z + world.rand.nextDouble(),
|
||||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
0.0D,
|
||||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
0.0D,
|
||||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
0.0D);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == 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;
|
||||||
|
|
||||||
// Spawn some lovely particles
|
if (flag || flag1) {
|
||||||
for (int c = 0; c < 120; ++c) {
|
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
||||||
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.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
||||||
}
|
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
||||||
} else if (world.getBlock(x, y - 1, z) == Blocks.iron_block || world.getBlock(x, y - 2, z) == 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) {
|
||||||
world.setBlock(x, y, z, Blocks.air, 0, 2);
|
world.setBlock(x - 1, y - 1, z, Blocks.air, 0, 2);
|
||||||
world.setBlock(x, y - 1, z, Blocks.air, 0, 2);
|
world.setBlock(x + 1, y - 1, z, Blocks.air, 0, 2);
|
||||||
world.setBlock(x, y - 2, z, Blocks.air, 0, 2);
|
} else {
|
||||||
|
world.setBlock(x, y - 1, z - 1, Blocks.air, 0, 2);
|
||||||
|
world.setBlock(x, y - 1, z + 1, Blocks.air, 0, 2);
|
||||||
|
}
|
||||||
|
|
||||||
if (flag) {
|
EntityIronGolem ironGolem = new EntityIronGolem(world);
|
||||||
world.setBlock(x - 1, y - 1, z, Blocks.air, 0, 2);
|
ironGolem.setPlayerCreated(true);
|
||||||
world.setBlock(x + 1, y - 1, z, Blocks.air, 0, 2);
|
ironGolem.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
||||||
} else {
|
world.spawnEntityInWorld(ironGolem);
|
||||||
world.setBlock(x, y - 1, z - 1, Blocks.air, 0, 2);
|
|
||||||
world.setBlock(x, y - 1, z + 1, Blocks.air, 0, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
EntityIronGolem ironGolem = new EntityIronGolem(world);
|
world.notifyBlockChange(x, y, z, Blocks.air);
|
||||||
ironGolem.setPlayerCreated(true);
|
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
||||||
ironGolem.setLocationAndAngles(x + 0.5D, y - 1.95D, z + 0.5D, 0.0F, 0.0F);
|
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
||||||
world.spawnEntityInWorld(ironGolem);
|
|
||||||
|
|
||||||
world.notifyBlockChange(x, y, z, Blocks.air);
|
if (flag) {
|
||||||
world.notifyBlockChange(x, y - 1, z, Blocks.air);
|
world.notifyBlockChange(x - 1, y - 1, z, Blocks.air);
|
||||||
world.notifyBlockChange(x, y - 2, z, Blocks.air);
|
world.notifyBlockChange(x + 1, y - 1, z, Blocks.air);
|
||||||
|
} else {
|
||||||
|
world.notifyBlockChange(x, y - 1, z - 1, Blocks.air);
|
||||||
|
world.notifyBlockChange(x, y - 1, z + 1, Blocks.air);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (flag) {
|
@Override
|
||||||
world.notifyBlockChange(x - 1, y - 1, z, Blocks.air);
|
@SideOnly(Side.CLIENT)
|
||||||
world.notifyBlockChange(x + 1, y - 1, z, Blocks.air);
|
public IIcon getIcon(int side, int meta) {
|
||||||
} else {
|
return side == 1 ? top
|
||||||
world.notifyBlockChange(x, y - 1, z - 1, Blocks.air);
|
: (side == 0 ? top
|
||||||
world.notifyBlockChange(x, y - 1, z + 1, Blocks.air);
|
: (meta == 2 && side == 2 ? face
|
||||||
}
|
: (meta == 3 && side == 5 ? face
|
||||||
}
|
: (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void registerBlockIcons(IIconRegister icon) {
|
||||||
public IIcon getIcon(int side, int meta) {
|
top = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_top");
|
||||||
return side == 1 ? top : (side == 0 ? top : (meta == 2 && side == 2 ? face : (meta == 3 && side == 5 ? face
|
face = icon.registerIcon(Chisel.MOD_ID + ":" + faceLocation);
|
||||||
: (meta == 0 && side == 3 ? face : (meta == 1 && side == 4 ? face : this.blockIcon)))));
|
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_side");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setInformation(String textureLocation) {
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
this.faceLocation = textureLocation;
|
||||||
top = icon.registerIcon(Chisel.MOD_ID + ":pumpkin/pumpkin_top");
|
}
|
||||||
face = icon.registerIcon(Chisel.MOD_ID + ":" + faceLocation);
|
|
||||||
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) {
|
|
||||||
this.faceLocation = textureLocation;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -2,172 +2,167 @@ 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 {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
private boolean isAlpha;
|
private boolean isAlpha;
|
||||||
|
|
||||||
public BlockCarvableSand() {
|
public BlockCarvableSand() {
|
||||||
super();
|
super();
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
setCreativeTab(ChiselTabs.tabOtherChiselBlocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableSand setStained(boolean a) {
|
public BlockCarvableSand setStained(boolean a) {
|
||||||
this.isAlpha = a;
|
this.isAlpha = a;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return isAlpha ? 1 : 0;
|
return isAlpha ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.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) {
|
||||||
return carverHelper.getIcon(world, x, y, z, side);
|
return carverHelper.getIcon(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return ClientUtils.renderCTMId;
|
return ClientUtils.renderCTMId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class SoundType extends Block.SoundType {
|
@Override
|
||||||
|
public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) {
|
||||||
|
return Configurations.canMobsSpawnOnTheChiselBlocks;
|
||||||
|
}
|
||||||
|
|
||||||
public final String soundNameStep;
|
public static class SoundType extends Block.SoundType {
|
||||||
public final String soundNameBreak;
|
|
||||||
public final String soundNamePlace;
|
|
||||||
|
|
||||||
/**
|
public final String soundNameStep;
|
||||||
* 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
|
public final String soundNameBreak;
|
||||||
*
|
public final String soundNamePlace;
|
||||||
* @param soundName
|
|
||||||
* block of the sound. Will automatically be expanded to "mod:dig.soundName" and "mod:step.soundName" respectively)
|
|
||||||
* @param volume
|
|
||||||
* default 1.0f
|
|
||||||
* @param frequency
|
|
||||||
* default 1.0f
|
|
||||||
*/
|
|
||||||
public SoundType(String soundName, float volume, float frequency) {
|
|
||||||
super(soundName, volume, frequency);
|
|
||||||
this.soundNameStep = null;
|
|
||||||
this.soundNameBreak = null;
|
|
||||||
this.soundNamePlace = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a SoundType with manual names for step and break sounds. Sound names 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 soundNameBreak
|
*
|
||||||
* block break sound
|
* @param soundName block of the sound. Will automatically be expanded to "mod:dig.soundName" and
|
||||||
* @param soundNameStep
|
* "mod:step.soundName" respectively)
|
||||||
* block step sound
|
* @param volume default 1.0f
|
||||||
* @param volume
|
* @param frequency default 1.0f
|
||||||
* default 1.0f
|
*/
|
||||||
* @param frequency
|
public SoundType(String soundName, float volume, float frequency) {
|
||||||
* default 1.0f
|
super(soundName, volume, frequency);
|
||||||
*/
|
this.soundNameStep = null;
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
this.soundNameBreak = null;
|
||||||
super(soundNameStep, volume, frequency);
|
this.soundNamePlace = null;
|
||||||
this.soundNameStep = soundNameStep;
|
}
|
||||||
this.soundNameBreak = soundNameBreak;
|
|
||||||
this.soundNamePlace = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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 and break sounds. Sound names must be specified in the
|
||||||
*
|
* sounds.json
|
||||||
* @param soundNameBreak
|
*
|
||||||
* block break sound
|
* @param soundNameBreak block break sound
|
||||||
* @param soundNameStep
|
* @param soundNameStep block step sound
|
||||||
* block step sound
|
* @param volume default 1.0f
|
||||||
* @param soundNamePlace
|
* @param frequency default 1.0f
|
||||||
* block place sound
|
*/
|
||||||
* @param volume
|
public SoundType(String soundNameBreak, String soundNameStep, float volume, float frequency) {
|
||||||
* default 1.0f
|
super(soundNameStep, volume, frequency);
|
||||||
* @param frequency
|
this.soundNameStep = soundNameStep;
|
||||||
* default 1.0f
|
this.soundNameBreak = soundNameBreak;
|
||||||
*/
|
this.soundNamePlace = null;
|
||||||
public SoundType(String soundNameBreak, String soundNameStep, String soundNamePlace, float volume, float frequency) {
|
}
|
||||||
super(soundNameStep, volume, frequency);
|
|
||||||
this.soundNameStep = soundNameStep;
|
|
||||||
this.soundNameBreak = soundNameBreak;
|
|
||||||
this.soundNamePlace = soundNamePlace;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public String getBreakSound() {
|
* Creates a SoundType with manual names for step, break and place sounds. Sound names must be specified in the
|
||||||
if (soundNameBreak == null)
|
* sounds.json
|
||||||
return Chisel.MOD_ID + ":dig." + this.soundName;
|
*
|
||||||
else
|
* @param soundNameBreak block break sound
|
||||||
return this.soundNameBreak;
|
* @param soundNameStep block step sound
|
||||||
}
|
* @param soundNamePlace 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) {
|
||||||
|
super(soundNameStep, volume, frequency);
|
||||||
|
this.soundNameStep = soundNameStep;
|
||||||
|
this.soundNameBreak = soundNameBreak;
|
||||||
|
this.soundNamePlace = soundNamePlace;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getStepResourcePath() {
|
public String getBreakSound() {
|
||||||
if (soundNameStep == null)
|
if (soundNameBreak == null) return Chisel.MOD_ID + ":dig." + this.soundName;
|
||||||
return Chisel.MOD_ID + ":step." + this.soundName;
|
else return this.soundNameBreak;
|
||||||
else
|
}
|
||||||
return this.soundNameStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String func_150496_b() {
|
public String getStepResourcePath() {
|
||||||
if (soundNamePlace == null)
|
if (soundNameStep == null) return Chisel.MOD_ID + ":step." + this.soundName;
|
||||||
return getBreakSound();
|
else return this.soundNameStep;
|
||||||
else
|
}
|
||||||
return this.soundNamePlace;
|
|
||||||
}
|
@Override
|
||||||
}
|
public String func_150496_b() {
|
||||||
|
if (soundNamePlace == null) return getBreakSound();
|
||||||
|
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,126 +16,121 @@ 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 {
|
||||||
|
|
||||||
public Block master;
|
public Block master;
|
||||||
public BlockCarvableSlab bottom;
|
public BlockCarvableSlab bottom;
|
||||||
public BlockCarvableSlab top;
|
public BlockCarvableSlab top;
|
||||||
public boolean isBottom;
|
public boolean isBottom;
|
||||||
|
|
||||||
public BlockCarvableSlab(BlockCarvable marble) {
|
public BlockCarvableSlab(BlockCarvable marble) {
|
||||||
opaque = true;
|
opaque = true;
|
||||||
|
|
||||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||||
|
|
||||||
master = marble;
|
master = marble;
|
||||||
bottom = this;
|
bottom = this;
|
||||||
top = new BlockCarvableSlab(this);
|
top = new BlockCarvableSlab(this);
|
||||||
|
|
||||||
isBottom = true;
|
isBottom = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockCarvableSlab(BlockCarvableSlab bottomBlock) {
|
public BlockCarvableSlab(BlockCarvableSlab bottomBlock) {
|
||||||
super();
|
super();
|
||||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
master = bottomBlock.master;
|
master = bottomBlock.master;
|
||||||
bottom = bottomBlock;
|
bottom = bottomBlock;
|
||||||
top = this;
|
top = this;
|
||||||
|
|
||||||
carverHelper = bottomBlock.carverHelper;
|
carverHelper = bottomBlock.carverHelper;
|
||||||
isBottom = false;
|
isBottom = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Block setBlockName(String p_149663_1_) {
|
public Block setBlockName(String p_149663_1_) {
|
||||||
if (this != top) {
|
if (this != top) {
|
||||||
top.setBlockName(p_149663_1_);
|
top.setBlockName(p_149663_1_);
|
||||||
}
|
}
|
||||||
return super.setBlockName(p_149663_1_);
|
return super.setBlockName(p_149663_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||||
if (isBottom) {
|
if (isBottom) {
|
||||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||||
} else {
|
} else {
|
||||||
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsForItemRender() {
|
public void setBlockBoundsForItemRender() {
|
||||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
List par6List, Entity par7Entity) {
|
||||||
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
setBlockBoundsBasedOnState(par1World, par2, par3, par4);
|
||||||
}
|
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
public Item getItemDropped(int par1, Random par2Random, int par3) {
|
||||||
return Item.getItemFromBlock(bottom);
|
return Item.getItemFromBlock(bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) {
|
public ItemStack getPickBlock(MovingObjectPosition mop, World world, int x, int y, int z) {
|
||||||
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
return new ItemStack(bottom, 1, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
// return master.getIcon(side, metadata);
|
// return master.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
* @return True if the block is solid on the specified side.
|
||||||
* @param z
|
*/
|
||||||
* Z position
|
@Override
|
||||||
* @param side
|
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
||||||
* The side to check
|
return !isBottom && (side == UP);
|
||||||
* @return True if the block is solid on the specified side.
|
}
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean isSideSolid(IBlockAccess world, int x, int y, int z, ForgeDirection side) {
|
|
||||||
return !isBottom && (side == UP);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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,75 +14,81 @@ 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;
|
||||||
int blockMeta;
|
int blockMeta;
|
||||||
|
|
||||||
public BlockCarvableStairs(Block block, int meta, CarvableHelper helper) {
|
public BlockCarvableStairs(Block block, int meta, CarvableHelper helper) {
|
||||||
super(block, meta);
|
super(block, meta);
|
||||||
|
|
||||||
this.useNeighborBrightness = true;
|
this.useNeighborBrightness = true;
|
||||||
carverHelper = helper;
|
carverHelper = helper;
|
||||||
blockMeta = meta;
|
blockMeta = meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, blockMeta + metadata / 8);
|
return carverHelper.getIcon(side, blockMeta + metadata / 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||||
list.add(new ItemStack(block, 1, 0));
|
list.add(new ItemStack(block, 1, 0));
|
||||||
list.add(new ItemStack(block, 1, 8));
|
list.add(new ItemStack(block, 1, 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RendererStairs.id;
|
return RendererStairs.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
int meta = MathHelper.floor_double((par5EntityLiving.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
ItemStack par6ItemStack) {
|
||||||
|
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
|
||||||
meta = meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
|
meta = meta == 0 ? 2 : meta == 2 ? 3 : meta == 3 ? 0 : 1;
|
||||||
|
|
||||||
meta += par1World.getBlockMetadata(par2, par3, par4) % 8; // add upside-down-ness
|
meta += par1World.getBlockMetadata(par2, par3, par4) % 8; // add upside-down-ness
|
||||||
|
|
||||||
if (par6ItemStack.getItemDamage() >= 8) {
|
if (par6ItemStack.getItemDamage() >= 8) {
|
||||||
meta += 8;
|
meta += 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta, 2);
|
par1World.setBlockMetadataWithNotify(par2, par3, par4, meta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int damage) {
|
public int onBlockPlaced(World world, int x, int y, int z, int side, float hx, float hy, float hz, int damage) {
|
||||||
return side != 0 && (side == 1 || hy <= 0.5D) ? damage : damage + 4;
|
return side != 0 && (side == 1 || hy <= 0.5D) ? damage : damage + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
return carverHelper.getVariation(blockMeta + (metadata / 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(blockMeta + (meta / 8));
|
return carverHelper.getVariation(blockMeta + (meta / 8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,83 +2,69 @@ 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");
|
this.idx = idx;
|
||||||
this.idx = idx;
|
this.texLocation = tex;
|
||||||
this.texLocation = tex;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public void registerBlockIcons(IIconRegister icon) {
|
||||||
return carverHelper.getVariation(metadata);
|
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public BlockCarvableTorch disableParticles() {
|
||||||
public IVariationInfo getManager(int meta) {
|
this.emitsParticles = false;
|
||||||
return carverHelper.getVariation(meta);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister icon) {
|
@SideOnly(Side.CLIENT)
|
||||||
this.blockIcon = icon.registerIcon(Chisel.MOD_ID + ":torch/" + texLocation);
|
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) {
|
||||||
|
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
||||||
|
double d0 = p_149734_2_ + 0.5F;
|
||||||
|
double d1 = p_149734_3_ + 0.7F;
|
||||||
|
double d2 = p_149734_4_ + 0.5F;
|
||||||
|
double d3 = 0.2199999988079071D;
|
||||||
|
double d4 = 0.27000001072883606D;
|
||||||
|
|
||||||
public BlockCarvableTorch disableParticles() {
|
if (l == 1) {
|
||||||
this.emitsParticles = false;
|
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||||
return this;
|
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||||
}
|
} else if (l == 2) {
|
||||||
|
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||||
@Override
|
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
||||||
@SideOnly(Side.CLIENT)
|
} else if (l == 3) {
|
||||||
public void randomDisplayTick(World p_149734_1_, int p_149734_2_, int p_149734_3_, int p_149734_4_, Random p_149734_5_) {
|
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||||
if (emitsParticles) {
|
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
||||||
int l = p_149734_1_.getBlockMetadata(p_149734_2_, p_149734_3_, p_149734_4_);
|
} else if (l == 4) {
|
||||||
double d0 = p_149734_2_ + 0.5F;
|
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||||
double d1 = p_149734_3_ + 0.7F;
|
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
||||||
double d2 = p_149734_4_ + 0.5F;
|
} else {
|
||||||
double d3 = 0.2199999988079071D;
|
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
double d4 = 0.27000001072883606D;
|
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
if (l == 1) {
|
}
|
||||||
p_149734_1_.spawnParticle("smoke", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
}
|
||||||
p_149734_1_.spawnParticle("flame", d0 - d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
||||||
} else if (l == 2) {
|
|
||||||
p_149734_1_.spawnParticle("smoke", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
||||||
p_149734_1_.spawnParticle("flame", d0 + d4, d1 + d3, d2, 0.0D, 0.0D, 0.0D);
|
|
||||||
} else if (l == 3) {
|
|
||||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
|
||||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 - d4, 0.0D, 0.0D, 0.0D);
|
|
||||||
} else if (l == 4) {
|
|
||||||
p_149734_1_.spawnParticle("smoke", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
|
||||||
p_149734_1_.spawnParticle("flame", d0, d1 + d3, d2 + d4, 0.0D, 0.0D, 0.0D);
|
|
||||||
} else {
|
|
||||||
p_149734_1_.spawnParticle("smoke", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
|
||||||
p_149734_1_.spawnParticle("flame", d0, d1, d2, 0.0D, 0.0D, 0.0D);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -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,34 +9,36 @@ 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;
|
||||||
|
|
||||||
public BlockCarvableWall(Block block) {
|
public BlockCarvableWall(Block block) {
|
||||||
super(block);
|
super(block);
|
||||||
|
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,65 +9,67 @@ 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 {
|
||||||
|
|
||||||
public BlockCloud() {
|
public BlockCloud() {
|
||||||
super(Material.ice);
|
super(Material.ice);
|
||||||
useNeighborBrightness = true;
|
useNeighborBrightness = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) {
|
public void onEntityCollidedWithBlock(World world, int i, int j, int k, Entity entity) {
|
||||||
entity.fallDistance = 0.0F;
|
entity.fallDistance = 0.0F;
|
||||||
|
|
||||||
if (entity.motionY < 0.0D) {
|
if (entity.motionY < 0.0D) {
|
||||||
entity.motionY *= 0.0050000000000000001D;
|
entity.motionY *= 0.0050000000000000001D;
|
||||||
} else if (entity.motionY > 0) {
|
} else if (entity.motionY > 0) {
|
||||||
entity.motionY += 0.0285;
|
entity.motionY += 0.0285;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return Configurations.ghostCloud ? 1 : 0;
|
return Configurations.ghostCloud ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
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) {
|
||||||
Block block = world.getBlock(x, y, z);
|
Block block = world.getBlock(x, y, z);
|
||||||
if (block == this) {
|
if (block == this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.shouldSideBeRendered(world, x, y, z, side);
|
return super.shouldSideBeRendered(world, x, y, z, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int i, int j, int k) {
|
||||||
return AxisAlignedBB.getBoundingBox(i + 0.2, j, k + 0.2, i + 0.8, j + 0.2, k + 0.8);
|
return AxisAlignedBB.getBoundingBox(i + 0.2, j, k + 0.2, i + 0.8, j + 0.2, k + 0.8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Item getItemDropped(int par1, Random rand, int par3) {
|
public Item getItemDropped(int par1, Random rand, int par3) {
|
||||||
return Item.getItemFromBlock(this);
|
return Item.getItemFromBlock(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random rand) {
|
public int quantityDropped(Random rand) {
|
||||||
return rand.nextInt(2);
|
return rand.nextInt(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,40 +6,51 @@ 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;
|
||||||
|
|
||||||
@SubscribeEvent
|
public class EventHandler {
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
public void speedupPlayer(PlayerTickEvent event) {
|
@SubscribeEvent
|
||||||
if (event.phase == Phase.START && event.side.isClient() && event.player.onGround && event.player instanceof EntityPlayerSP) {
|
@SideOnly(Side.CLIENT)
|
||||||
if (manualInputCheck == null) {
|
public void speedupPlayer(PlayerTickEvent event) {
|
||||||
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
if (event.phase == Phase.START && event.side.isClient()
|
||||||
}
|
&& event.player.onGround
|
||||||
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
&& event.player instanceof EntityPlayerSP) {
|
||||||
Block below = player.worldObj.getBlock(MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY) - 2, MathHelper.floor_double(player.posZ));
|
if (manualInputCheck == null) {
|
||||||
if (below == this) {
|
manualInputCheck = new MovementInputFromOptions(Minecraft.getMinecraft().gameSettings);
|
||||||
manualInputCheck.updatePlayerMoveState();
|
}
|
||||||
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
EntityPlayerSP player = (EntityPlayerSP) event.player;
|
||||||
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
Block below = player.worldObj.getBlock(
|
||||||
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
MathHelper.floor_double(player.posX),
|
||||||
}
|
MathHelper.floor_double(player.posY) - 2,
|
||||||
}
|
MathHelper.floor_double(player.posZ));
|
||||||
}
|
if (below == BlockConcrete.this) {
|
||||||
}
|
manualInputCheck.updatePlayerMoveState();
|
||||||
|
if (manualInputCheck.moveForward != 0 || manualInputCheck.moveStrafe != 0) {
|
||||||
|
player.motionX *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
player.motionZ *= Configurations.concreteVelocityMult + 0.05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,13 +4,13 @@ import team.chisel.Chisel;
|
|||||||
|
|
||||||
public class BlockEldritch extends BlockCarvable {
|
public class BlockEldritch extends BlockCarvable {
|
||||||
|
|
||||||
public BlockEldritch() {
|
public BlockEldritch() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return Chisel.renderEldritchId;
|
return Chisel.renderEldritchId;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,33 +2,33 @@ 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;
|
||||||
|
|
||||||
public BlockGrimstone(Material m) {
|
public BlockGrimstone(Material m) {
|
||||||
super(m);
|
super(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
|
|
||||||
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
|
iconStar = register.registerIcon(Chisel.MOD_ID + ":grimstone/particles/star");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,34 +2,34 @@ 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;
|
||||||
|
|
||||||
public BlockHolystone(Material m) {
|
public BlockHolystone(Material m) {
|
||||||
super(m);
|
super(m);
|
||||||
|
|
||||||
this.setLightLevel(0.25F);
|
this.setLightLevel(0.25F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
|
|
||||||
iconStar = register.registerIcon("Chisel:holystone/particles/star");
|
iconStar = register.registerIcon("Chisel:holystone/particles/star");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,26 +2,26 @@ 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) {
|
||||||
super(mat, baseIcon);
|
super(mat, baseIcon);
|
||||||
setLightLevel(1F);
|
setLightLevel(1F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5,12 +5,12 @@ import net.minecraft.init.Blocks;
|
|||||||
|
|
||||||
public class BlockLeaf extends BlockCarvable {
|
public class BlockLeaf extends BlockCarvable {
|
||||||
|
|
||||||
public BlockLeaf(Material material) {
|
public BlockLeaf(Material material) {
|
||||||
super(material);
|
super(material);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return Blocks.leaves.isOpaqueCube();
|
return Blocks.leaves.isOpaqueCube();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,64 +2,72 @@ 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;
|
||||||
|
|
||||||
public BlockMultiLayer(Material mat, String baseIcon) {
|
public BlockMultiLayer(Material mat, String baseIcon) {
|
||||||
super(mat, baseIcon);
|
super(mat, baseIcon);
|
||||||
|
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockMultiLayer(Material mat, Block block) {
|
public BlockMultiLayer(Material mat, Block block) {
|
||||||
super(mat, block);
|
super(mat, block);
|
||||||
|
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return carverHelper.getIcon(side, metadata);
|
return carverHelper.getIcon(side, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int i) {
|
public int damageDropped(int i) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
|
|
||||||
carverHelper.registerBlockIcons("Chisel", this, register);
|
carverHelper.registerBlockIcons("Chisel", this, register);
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
public void getSubBlocks(Item block, CreativeTabs tabs, List list) {
|
||||||
carverHelper.registerSubBlocks(this, tabs, list);
|
carverHelper.registerSubBlocks(this, tabs, list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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,55 +1,53 @@
|
|||||||
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 {
|
||||||
|
|
||||||
public Block base;
|
public Block base;
|
||||||
public IIcon icon;
|
public IIcon icon;
|
||||||
String iconFile;
|
String iconFile;
|
||||||
|
|
||||||
public BlockMultiLayerBase(Material mat, Block base) {
|
public BlockMultiLayerBase(Material mat, Block base) {
|
||||||
super(mat);
|
super(mat);
|
||||||
|
|
||||||
this.base = base;
|
this.base = base;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BlockMultiLayerBase(Material mat, String iconFile) {
|
public BlockMultiLayerBase(Material mat, String iconFile) {
|
||||||
super(mat);
|
super(mat);
|
||||||
|
|
||||||
this.iconFile = iconFile;
|
this.iconFile = iconFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return RendererMultiLayer.id;
|
return RendererMultiLayer.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderBlockPass() {
|
public int getRenderBlockPass() {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,206 +18,225 @@ 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 {
|
||||||
|
|
||||||
public CarvableHelper carverHelper;
|
public CarvableHelper carverHelper;
|
||||||
|
|
||||||
private float minX, minY, minZ, maxX, maxY, maxZ;
|
private float minX, minY, minZ, maxX, maxY, maxZ;
|
||||||
|
|
||||||
public BlockPresent() {
|
public BlockPresent() {
|
||||||
super(Material.wood);
|
super(Material.wood);
|
||||||
carverHelper = new CarvableHelper(this);
|
carverHelper = new CarvableHelper(this);
|
||||||
minX = 0.0625F;
|
minX = 0.0625F;
|
||||||
minZ = 0.0625F;
|
minZ = 0.0625F;
|
||||||
maxX = 0.9375F;
|
maxX = 0.9375F;
|
||||||
maxY = 0.875F;
|
maxY = 0.875F;
|
||||||
maxZ = 0.9375F;
|
maxZ = 0.9375F;
|
||||||
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
setBlockBounds(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModelTexture(int type) {
|
public String getModelTexture(int type) {
|
||||||
return "textures/blocks/present/presentChest" + type;
|
return "textures/blocks/present/presentChest" + type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
@Override
|
@Override
|
||||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
list.add(new ItemStack(item, 1, i));
|
list.add(new ItemStack(item, 1, i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack stack) {
|
||||||
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
super.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||||
int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
int heading = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||||
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
|
world.setBlockMetadataWithNotify(x, y, z, stack.getItemDamage(), 3);
|
||||||
te.setRotation(heading);
|
te.setRotation(heading);
|
||||||
te.findConnections();
|
te.findConnections();
|
||||||
if (te.isConnected()) {
|
if (te.isConnected()) {
|
||||||
TileEntityPresent other = te.getConnection();
|
TileEntityPresent other = te.getConnection();
|
||||||
other.setRotation(heading);
|
other.setRotation(heading);
|
||||||
}
|
}
|
||||||
world.markBlockForUpdate(x, y, z);
|
world.markBlockForUpdate(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
|
public void breakBlock(World world, int x, int y, int z, Block present, int meta) {
|
||||||
|
|
||||||
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
|
TileEntityPresent tileEntityPresent = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||||
|
|
||||||
if (tileEntityPresent != null) {
|
if (tileEntityPresent != null) {
|
||||||
for (int c = 0; c < tileEntityPresent.getTrueSizeInventory(); c++) {
|
for (int c = 0; c < tileEntityPresent.getTrueSizeInventory(); c++) {
|
||||||
ItemStack itemStack = tileEntityPresent.getTrueStackInSlot(c);
|
ItemStack itemStack = tileEntityPresent.getTrueStackInSlot(c);
|
||||||
|
|
||||||
if (itemStack != null) {
|
if (itemStack != null) {
|
||||||
dropBlockAsItem(world, x, y, z, itemStack);
|
dropBlockAsItem(world, x, y, z, itemStack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
world.func_147453_f(x, y, z, this);
|
world.func_147453_f(x, y, z, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.breakBlock(world, x, y, z, this, meta);
|
super.breakBlock(world, x, y, z, this, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
float hitZ, float p_149727_9_) {
|
||||||
if (!world.isRemote) {
|
if (!world.isSideSolid(x, y + 1, z, ForgeDirection.DOWN)) {
|
||||||
player.openGui(Chisel.instance, 2, world, x, y, z);
|
if (!world.isRemote) {
|
||||||
}
|
player.openGui(Chisel.instance, 2, world, x, y, z);
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
return false;
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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) {
|
||||||
if (me == null) {
|
if (me == null) {
|
||||||
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
return AxisAlignedBB.getBoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}
|
}
|
||||||
int x = me.xCoord, y = me.yCoord, z = me.zCoord;
|
int x = me.xCoord, y = me.yCoord, z = me.zCoord;
|
||||||
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)) {
|
||||||
} else {
|
return AxisAlignedBB.getBoundingBox(
|
||||||
return AxisAlignedBB.getBoundingBox(x + dir.offsetX + minX, y + minY, z + dir.offsetZ + minZ, x + maxX, y + maxY, z + maxZ);
|
x + minX,
|
||||||
}
|
y + minY,
|
||||||
}
|
z + minZ,
|
||||||
return AxisAlignedBB.getBoundingBox(x + minX, y + minY, z + minZ, x + maxX, y + maxY, z + maxZ);
|
x + maxX + dir.offsetX,
|
||||||
}
|
y + maxY,
|
||||||
|
z + maxZ + dir.offsetZ);
|
||||||
|
} else {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||||
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
TileEntityPresent te = (TileEntityPresent) world.getTileEntity(x, y, z);
|
||||||
if (!te.isConnected()) {
|
if (!te.isConnected()) {
|
||||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||||
} else {
|
} else {
|
||||||
ForgeDirection dir = te.getConnectionDir();
|
ForgeDirection dir = te.getConnectionDir();
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case EAST:
|
case EAST:
|
||||||
setBlockBounds(0.0625F, 0, 0.0625F, 1, 0.875F, 0.9365F);
|
setBlockBounds(0.0625F, 0, 0.0625F, 1, 0.875F, 0.9365F);
|
||||||
break;
|
break;
|
||||||
case NORTH:
|
case NORTH:
|
||||||
setBlockBounds(0.0625F, 0, 0, 0.9375F, 0.875F, 0.9365F);
|
setBlockBounds(0.0625F, 0, 0, 0.9375F, 0.875F, 0.9365F);
|
||||||
break;
|
break;
|
||||||
case SOUTH:
|
case SOUTH:
|
||||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 1);
|
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 1);
|
||||||
break;
|
break;
|
||||||
case WEST:
|
case WEST:
|
||||||
setBlockBounds(0, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
setBlockBounds(0, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
setBlockBounds(0.0625F, 0, 0.0625F, 0.9375F, 0.875F, 0.9365F);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasTileEntity(int metadata) {
|
public boolean hasTileEntity(int metadata) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public TileEntity createTileEntity(World world, int metadata) {
|
public TileEntity createTileEntity(World world, int metadata) {
|
||||||
return new TileEntityPresent();
|
return new TileEntityPresent();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasComparatorInputOverride() {
|
public boolean hasComparatorInputOverride() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
|
public int getComparatorInputOverride(World world, int x, int y, int z, int strength) {
|
||||||
TileEntity te = world.getTileEntity(x, y, z);
|
TileEntity te = world.getTileEntity(x, y, z);
|
||||||
if (te instanceof TileEntityPresent) {
|
if (te instanceof TileEntityPresent) {
|
||||||
return Container.calcRedstoneFromInventory((TileEntityPresent) te);
|
return Container.calcRedstoneFromInventory((TileEntityPresent) te);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int damageDropped(int meta) {
|
public int damageDropped(int meta) {
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
|
||||||
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
return new ItemStack(this, 1, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
this.blockIcon = register.registerIcon("planks_oak");
|
this.blockIcon = register.registerIcon("planks_oak");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
public IVariationInfo getManager(IBlockAccess world, int x, int y, int z, int metadata) {
|
||||||
return carverHelper.getVariation(metadata);
|
return carverHelper.getVariation(metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IVariationInfo getManager(int meta) {
|
public IVariationInfo getManager(int meta) {
|
||||||
return carverHelper.getVariation(meta);
|
return carverHelper.getVariation(meta);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,83 +8,87 @@ 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);
|
||||||
|
|
||||||
if (Configurations.useRoadLineTool) {
|
if (Configurations.useRoadLineTool) {
|
||||||
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
||||||
}
|
}
|
||||||
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
||||||
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isOpaqueCube() {
|
public boolean isOpaqueCube() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getRenderType() {
|
public int getRenderType() {
|
||||||
return Chisel.roadLineId;
|
return Chisel.roadLineId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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);
|
||||||
}
|
}
|
||||||
|
|
||||||
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
||||||
}
|
}
|
||||||
|
|
||||||
@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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public IIcon getIcon(int side, int metadata) {
|
public IIcon getIcon(int side, int metadata) {
|
||||||
return aloneIcon[metadata % aloneIcon.length];
|
return aloneIcon[metadata % aloneIcon.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
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) {
|
||||||
return getIcon(side, world.getBlockMetadata(x, y, z));
|
return getIcon(side, world.getBlockMetadata(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -2,34 +2,35 @@ 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];
|
||||||
|
|
||||||
public BlockSnakestoneObsidian(String iconPrefix) {
|
public BlockSnakestoneObsidian(String iconPrefix) {
|
||||||
super(iconPrefix);
|
super(iconPrefix);
|
||||||
|
|
||||||
flipTopTextures = true;
|
flipTopTextures = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
||||||
GeneralChiselClient.spawnSnakestoneObsidianFX(world, this, x, y, z);
|
GeneralChiselClient.spawnSnakestoneObsidianFX(world, this, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerBlockIcons(IIconRegister register) {
|
public void registerBlockIcons(IIconRegister register) {
|
||||||
super.registerBlockIcons(register);
|
super.registerBlockIcons(register);
|
||||||
|
|
||||||
for (int i = 0; i < particles.length; i++) {
|
for (int i = 0; i < particles.length; i++) {
|
||||||
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
|
particles[i] = register.registerIcon(iconPrefix + "particles/" + i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,12 +4,12 @@ import net.minecraft.block.material.Material;
|
|||||||
|
|
||||||
public class BlockWaterstone extends BlockMultiLayer {
|
public class BlockWaterstone extends BlockMultiLayer {
|
||||||
|
|
||||||
public BlockWaterstone(Material mat, String baseIcon) {
|
public BlockWaterstone(Material mat, String baseIcon) {
|
||||||
super(mat, baseIcon);
|
super(mat, baseIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean renderAsNormalBlock() {
|
public boolean renderAsNormalBlock() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,41 +2,49 @@ 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 {
|
||||||
|
|
||||||
public final CarvableHelper carverHelper;
|
public final CarvableHelper carverHelper;
|
||||||
private Block blockBase;
|
private Block blockBase;
|
||||||
|
|
||||||
public CarvableStairsMaker(Block base) {
|
public CarvableStairsMaker(Block base) {
|
||||||
blockBase = base;
|
blockBase = base;
|
||||||
carverHelper = new CarvableHelper(base);
|
carverHelper = new CarvableHelper(base);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void create(String name, Block[] blocks) {
|
public void create(String name, Block[] blocks) {
|
||||||
create(null, name, blocks);
|
create(null, name, blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
GameRegistry.registerBlock(blocks[i], ItemCarvable.class, n);
|
.setCreativeTab(ChiselTabs.tabStairChiselBlocks);
|
||||||
|
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,10 +1,10 @@
|
|||||||
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);
|
||||||
}
|
}
|
||||||
@@ -4,26 +4,23 @@ import net.minecraft.item.ItemStack;
|
|||||||
|
|
||||||
public interface IDoubleChest {
|
public interface IDoubleChest {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The size of this specific chest's inventory. Does not account for the connection.
|
* @return The size of this specific chest's inventory. Does not account for the connection.
|
||||||
*/
|
*/
|
||||||
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);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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,444 +27,446 @@ 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,
|
|
||||||
AUTOMATION,
|
SPEED,
|
||||||
STACK,
|
AUTOMATION,
|
||||||
REVERSION;
|
STACK,
|
||||||
|
REVERSION;
|
||||||
public String getUnlocalizedName() {
|
|
||||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
public static final Upgrade[] VALUES = values();
|
||||||
return "item.upgrade_" + this.name().toLowerCase();
|
|
||||||
}
|
public String getUnlocalizedName() {
|
||||||
return "chisel.autochisel.upgrade.disabled";
|
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||||
}
|
return "item.upgrade_" + this.name()
|
||||||
|
.toLowerCase();
|
||||||
public String getLocalizedName() {
|
}
|
||||||
String ret = StatCollector.translateToLocal("autochisel.slot." + this.name().toLowerCase() + ".tooltip");
|
return "chisel.autochisel.upgrade.disabled";
|
||||||
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
}
|
||||||
ret = EnumChatFormatting.RED.toString().concat(ret);
|
|
||||||
}
|
public String getLocalizedName() {
|
||||||
return ret;
|
String ret = StatCollector.translateToLocal(
|
||||||
}
|
"autochisel.slot." + this.name()
|
||||||
}
|
.toLowerCase() + ".tooltip");
|
||||||
|
if (!Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||||
public static final int BASE = 0, TARGET = 1, OUTPUT = 2, CHISEL = 3, MIN_UPGRADE = 4;
|
ret = EnumChatFormatting.RED.toString()
|
||||||
private static final int FAST_SPEED = 1, SLOW_SPEED = 4;
|
.concat(ret);
|
||||||
|
}
|
||||||
private int progress = 0;
|
return ret;
|
||||||
|
}
|
||||||
private static EntityItem ghostItem;
|
}
|
||||||
boolean equal = false;
|
|
||||||
private ItemStack[] inventory = new ItemStack[8];
|
public static final int BASE = 0, TARGET = 1, OUTPUT = 2, CHISEL = 3, MIN_UPGRADE = 4;
|
||||||
private String name = "autoChisel";
|
private static final int FAST_SPEED = 1, SLOW_SPEED = 4;
|
||||||
|
|
||||||
// client animation fields
|
private int progress = 0;
|
||||||
|
|
||||||
// used for floating target
|
boolean equal = false;
|
||||||
public float xRot, yRot, zRot;
|
private ItemStack[] inventory = new ItemStack[8];
|
||||||
|
private String name = "autoChisel";
|
||||||
// used for chisel item rotation
|
|
||||||
public static final int maxRot = 60;
|
// client animation fields
|
||||||
public static final int rotAmnt = 15;
|
|
||||||
public float chiselRot;
|
// used for floating target
|
||||||
public boolean chiseling = false, breakChisel = false;;
|
public float xRot, yRot, zRot;
|
||||||
public int toChisel = 1;
|
|
||||||
|
// used for chisel item rotation
|
||||||
private ItemStack lastBase;
|
public static final int maxRot = 60;
|
||||||
|
public static final int rotAmnt = 15;
|
||||||
@Override
|
public float chiselRot;
|
||||||
public boolean canUpdate() {
|
public boolean chiseling = false, breakChisel = false;;
|
||||||
return true;
|
public int toChisel = 1;
|
||||||
}
|
|
||||||
|
private ItemStack lastBase;
|
||||||
@Override
|
|
||||||
public ItemStack decrStackSize(int slot, int size) {
|
@Override
|
||||||
if (inventory[slot] != null) {
|
public boolean canUpdate() {
|
||||||
ItemStack is;
|
return true;
|
||||||
if (inventory[slot].stackSize <= size) {
|
}
|
||||||
is = inventory[slot];
|
|
||||||
inventory[slot] = null;
|
@Override
|
||||||
return is;
|
public ItemStack decrStackSize(int slot, int size) {
|
||||||
} else {
|
if (inventory[slot] != null) {
|
||||||
is = inventory[slot].splitStack(size);
|
ItemStack is;
|
||||||
if (inventory[slot].stackSize == 0)
|
if (inventory[slot].stackSize <= size) {
|
||||||
inventory[slot] = null;
|
is = inventory[slot];
|
||||||
return is;
|
inventory[slot] = null;
|
||||||
}
|
return is;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
is = inventory[slot].splitStack(size);
|
||||||
}
|
if (inventory[slot].stackSize == 0) inventory[slot] = null;
|
||||||
}
|
return is;
|
||||||
|
}
|
||||||
@Override
|
} else {
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
return null;
|
||||||
super.readFromNBT(nbt);
|
}
|
||||||
NBTTagList tags = nbt.getTagList("Items", 10);
|
}
|
||||||
inventory = new ItemStack[getSizeInventory()];
|
|
||||||
|
@Override
|
||||||
for (int i = 0; i < tags.tagCount(); i++) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
NBTTagCompound data = tags.getCompoundTagAt(i);
|
super.readFromNBT(nbt);
|
||||||
int j = data.getByte("Slot") & 255;
|
NBTTagList tags = nbt.getTagList("Items", 10);
|
||||||
|
inventory = new ItemStack[getSizeInventory()];
|
||||||
if (j >= 0 && j < inventory.length) {
|
|
||||||
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
for (int i = 0; i < tags.tagCount(); i++) {
|
||||||
}
|
NBTTagCompound data = tags.getCompoundTagAt(i);
|
||||||
}
|
int j = data.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (nbt.hasKey("CustomName", 8)) {
|
if (j >= 0 && j < inventory.length) {
|
||||||
this.name = nbt.getString("CustomName");
|
inventory[j] = ItemStack.loadItemStackFromNBT(data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
if (nbt.hasKey("CustomName", 8)) {
|
||||||
public void updateEntity() {
|
this.name = nbt.getString("CustomName");
|
||||||
|
}
|
||||||
ItemStack base = inventory[BASE], target = getTarget(), output = inventory[OUTPUT];
|
}
|
||||||
|
|
||||||
if (!worldObj.isRemote && hasChisel() && base != null && target != null) {
|
@Override
|
||||||
if (canBeMadeFrom(base, target)) {
|
public void updateEntity() {
|
||||||
if (progress >= (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
|
||||||
|
ItemStack base = inventory[BASE], target = getTarget(), output = inventory[OUTPUT];
|
||||||
// reset progress
|
|
||||||
progress = 0;
|
if (!worldObj.isRemote && hasChisel() && base != null && target != null) {
|
||||||
|
if (canBeMadeFrom(base, target)) {
|
||||||
// the max possible for this craft
|
if (progress >= (hasUpgrade(Upgrade.SPEED) ? FAST_SPEED : SLOW_SPEED)) {
|
||||||
int canBeMade = target.getMaxStackSize();
|
|
||||||
|
// reset progress
|
||||||
// if there are items in the output, they count towards the max we can make
|
progress = 0;
|
||||||
if (output != null) {
|
|
||||||
canBeMade -= output.stackSize;
|
// the max possible for this craft
|
||||||
}
|
int canBeMade = target.getMaxStackSize();
|
||||||
|
|
||||||
// can't make more than we have
|
// if there are items in the output, they count towards the max we can make
|
||||||
canBeMade = Math.min(base.stackSize, canBeMade);
|
if (output != null) {
|
||||||
|
canBeMade -= output.stackSize;
|
||||||
// if we can't make any, forget it
|
}
|
||||||
if (canBeMade <= 0) {
|
|
||||||
return;
|
// can't make more than we have
|
||||||
}
|
canBeMade = Math.min(base.stackSize, canBeMade);
|
||||||
|
|
||||||
// result will always be a copy of the target
|
// if we can't make any, forget it
|
||||||
ItemStack chiseled = target.copy();
|
if (canBeMade <= 0) {
|
||||||
|
return;
|
||||||
// if we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
}
|
||||||
chiseled.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
|
||||||
|
// result will always be a copy of the target
|
||||||
if (canChisel(chiseled)) {
|
ItemStack chiseled = target.copy();
|
||||||
// if our output is empty, just use the current result
|
|
||||||
if (output == null) {
|
// if we have the stack upgrade, boost the stack size to the max possible, otherwise just one
|
||||||
setInventorySlotContents(OUTPUT, chiseled);
|
chiseled.stackSize = hasUpgrade(Upgrade.STACK) ? canBeMade : 1;
|
||||||
} else {
|
|
||||||
// otherwise just add our result to the existing stack
|
if (canChisel(chiseled)) {
|
||||||
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
// if our output is empty, just use the current result
|
||||||
slotChanged(OUTPUT);
|
if (output == null) {
|
||||||
}
|
setInventorySlotContents(OUTPUT, chiseled);
|
||||||
|
} else {
|
||||||
chiselItem(chiseled.stackSize, target);
|
// otherwise just add our result to the existing stack
|
||||||
|
inventory[OUTPUT].stackSize += chiseled.stackSize;
|
||||||
// remove what we made from the stack
|
slotChanged(OUTPUT);
|
||||||
base.stackSize -= chiseled.stackSize;
|
}
|
||||||
if (base.stackSize <= 0) {
|
|
||||||
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
chiselItem(chiseled.stackSize, target);
|
||||||
}
|
|
||||||
}
|
// remove what we made from the stack
|
||||||
} else if (worldObj.getTotalWorldTime() % 10 == 0) {
|
base.stackSize -= chiseled.stackSize;
|
||||||
progress++;
|
if (base.stackSize <= 0) {
|
||||||
}
|
setInventorySlotContents(BASE, null); // clear out 0 size itemstacks
|
||||||
}
|
}
|
||||||
} else if (worldObj.isRemote) {
|
}
|
||||||
if (chiseling) {
|
} else if (worldObj.getTotalWorldTime() % 10 == 0) {
|
||||||
chiselRot += rotAmnt;
|
progress++;
|
||||||
if (chiselRot >= maxRot) {
|
}
|
||||||
chiselItem(0, getTarget());
|
}
|
||||||
}
|
} else if (worldObj.isRemote) {
|
||||||
} else {
|
if (chiseling) {
|
||||||
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
chiselRot += rotAmnt;
|
||||||
}
|
if (chiselRot >= maxRot) {
|
||||||
}
|
chiselItem(0, getTarget());
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
private ItemStack getTarget() {
|
chiselRot = Math.max(chiselRot - rotAmnt, 0);
|
||||||
if (inventory[BASE] != null && hasUpgrade(Upgrade.REVERSION)) {
|
}
|
||||||
// if we have a reversion upgrade, use that for the target
|
}
|
||||||
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
}
|
||||||
return possible.isEmpty() ? null : possible.get(0);
|
|
||||||
} else {
|
private ItemStack getTarget() {
|
||||||
return inventory[TARGET];
|
if (inventory[BASE] != null && hasUpgrade(Upgrade.REVERSION)) {
|
||||||
}
|
// if we have a reversion upgrade, use that for the target
|
||||||
}
|
List<ItemStack> possible = Carving.chisel.getItemsForChiseling(inventory[BASE]);
|
||||||
|
return possible.isEmpty() ? null : possible.get(0);
|
||||||
// lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
|
} else {
|
||||||
private boolean canBeMadeFrom(ItemStack from, ItemStack to) {
|
return inventory[TARGET];
|
||||||
List<ItemStack> results = Carving.chisel.getItemsForChiseling(from);
|
}
|
||||||
for (ItemStack s : results) {
|
}
|
||||||
if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
|
|
||||||
return true;
|
// lets make sure the user isn't trying to make something from a block that doesn't have this as a valid target
|
||||||
}
|
private boolean canBeMadeFrom(ItemStack from, ItemStack to) {
|
||||||
}
|
List<ItemStack> results = Carving.chisel.getItemsForChiseling(from);
|
||||||
return false;
|
for (ItemStack s : results) {
|
||||||
}
|
if (s.getItem() == to.getItem() && s.getItemDamage() == to.getItemDamage()) {
|
||||||
|
return true;
|
||||||
private boolean canChisel(ItemStack toMerge) {
|
}
|
||||||
// if the output slot is empty we can merge without checking
|
}
|
||||||
if (inventory[OUTPUT] == null) {
|
return false;
|
||||||
return true;
|
}
|
||||||
}
|
|
||||||
|
private boolean canChisel(ItemStack toMerge) {
|
||||||
// need to check NBT as well as item
|
// if the output slot is empty we can merge without checking
|
||||||
if (!toMerge.isItemEqual(inventory[OUTPUT]) || !ItemStack.areItemStackTagsEqual(toMerge, inventory[OUTPUT])) {
|
if (inventory[OUTPUT] == null) {
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// we only care about metadata if the item has subtypes
|
// need to check NBT as well as item
|
||||||
if (toMerge.getHasSubtypes() && toMerge.getItemDamage() != inventory[OUTPUT].getItemDamage()) {
|
if (!toMerge.isItemEqual(inventory[OUTPUT]) || !ItemStack.areItemStackTagsEqual(toMerge, inventory[OUTPUT])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ((IChiselItem) inventory[CHISEL].getItem()).canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
// we only care about metadata if the item has subtypes
|
||||||
}
|
if (toMerge.getHasSubtypes() && toMerge.getItemDamage() != inventory[OUTPUT].getItemDamage()) {
|
||||||
|
return false;
|
||||||
private boolean hasChisel() {
|
}
|
||||||
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem && inventory[CHISEL].stackSize >= 1;
|
|
||||||
}
|
return ((IChiselItem) inventory[CHISEL].getItem())
|
||||||
|
.canChisel(worldObj, inventory[CHISEL], General.getVariation(getTarget()));
|
||||||
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
}
|
||||||
private void chiselItem(int chiseled, ItemStack target) {
|
|
||||||
if (!worldObj.isRemote) {
|
private boolean hasChisel() {
|
||||||
boolean breakChisel = false;
|
return inventory[CHISEL] != null && inventory[CHISEL].getItem() instanceof IChiselItem
|
||||||
if (((IChiselItem) inventory[CHISEL].getItem()).onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
&& inventory[CHISEL].stackSize >= 1;
|
||||||
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
}
|
||||||
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
|
||||||
setInventorySlotContents(CHISEL, null);
|
/** Calls IChiselItem#onChisel() and sends the chisel packet for sound/animation */
|
||||||
breakChisel = true;
|
private void chiselItem(int chiseled, ItemStack target) {
|
||||||
}
|
if (!worldObj.isRemote) {
|
||||||
}
|
boolean breakChisel = false;
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessageAutoChisel(this, chiseled, true, breakChisel), worldObj.provider.dimensionId);
|
if (((IChiselItem) inventory[CHISEL].getItem())
|
||||||
} else {
|
.onChisel(worldObj, inventory[CHISEL], General.getVariation(target))) {
|
||||||
if (breakChisel) {
|
inventory[CHISEL].setItemDamage(inventory[CHISEL].getItemDamage() + 1);
|
||||||
worldObj.playSound(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.break", 0.8F, 0.8F + worldObj.rand.nextFloat() * 0.4F, false);
|
if (inventory[CHISEL].getItemDamage() >= inventory[CHISEL].getMaxDamage()) {
|
||||||
}
|
setInventorySlotContents(CHISEL, null);
|
||||||
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
breakChisel = true;
|
||||||
chiseling = false;
|
}
|
||||||
if (lastBase != null) {
|
}
|
||||||
lastBase.stackSize -= toChisel;
|
PacketHandler.INSTANCE.sendToDimension(
|
||||||
if (lastBase.stackSize <= 0) {
|
new MessageAutoChisel(this, chiseled, true, breakChisel),
|
||||||
lastBase = null;
|
worldObj.provider.dimensionId);
|
||||||
}
|
} else {
|
||||||
}
|
if (breakChisel) {
|
||||||
}
|
worldObj.playSound(
|
||||||
}
|
xCoord + 0.5,
|
||||||
|
yCoord + 0.5,
|
||||||
@Override
|
zCoord + 0.5,
|
||||||
public void writeToNBT(NBTTagCompound nbt) {
|
"random.break",
|
||||||
super.writeToNBT(nbt);
|
0.8F,
|
||||||
NBTTagList tags = new NBTTagList();
|
0.8F + worldObj.rand.nextFloat() * 0.4F,
|
||||||
|
false);
|
||||||
for (int i = 0; i < inventory.length; i++) {
|
}
|
||||||
if (inventory[i] != null) {
|
GeneralChiselClient.spawnAutoChiselFX(this, lastBase != null ? lastBase : inventory[BASE]);
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
chiseling = false;
|
||||||
data.setByte("Slot", (byte) i);
|
if (lastBase != null) {
|
||||||
inventory[i].writeToNBT(data);
|
lastBase.stackSize -= toChisel;
|
||||||
tags.appendTag(data);
|
if (lastBase.stackSize <= 0) {
|
||||||
}
|
lastBase = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
nbt.setTag("Items", tags);
|
}
|
||||||
|
}
|
||||||
if (this.hasCustomInventoryName()) {
|
|
||||||
nbt.setString("CustomName", this.name);
|
@Override
|
||||||
}
|
public void writeToNBT(NBTTagCompound nbt) {
|
||||||
}
|
super.writeToNBT(nbt);
|
||||||
|
NBTTagList tags = new NBTTagList();
|
||||||
@Override
|
|
||||||
public int getSizeInventory() {
|
for (int i = 0; i < inventory.length; i++) {
|
||||||
return inventory.length;
|
if (inventory[i] != null) {
|
||||||
}
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setByte("Slot", (byte) i);
|
||||||
@Override
|
inventory[i].writeToNBT(data);
|
||||||
public ItemStack getStackInSlot(int slot) {
|
tags.appendTag(data);
|
||||||
return inventory[slot];
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
nbt.setTag("Items", tags);
|
||||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
|
||||||
if (inventory[slot] != null) {
|
if (this.hasCustomInventoryName()) {
|
||||||
ItemStack is = inventory[slot];
|
nbt.setString("CustomName", this.name);
|
||||||
inventory[slot] = null;
|
}
|
||||||
return is;
|
}
|
||||||
} else
|
|
||||||
return null;
|
@Override
|
||||||
}
|
public int getSizeInventory() {
|
||||||
|
return inventory.length;
|
||||||
@Override
|
}
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
|
||||||
inventory[slot] = stack;
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slot) {
|
||||||
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
return inventory[slot];
|
||||||
stack.stackSize = getInventoryStackLimit();
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
if (worldObj.isRemote && slot == BASE && stack != null) {
|
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||||
lastBase = stack.copy();
|
if (inventory[slot] != null) {
|
||||||
}
|
ItemStack is = inventory[slot];
|
||||||
|
inventory[slot] = null;
|
||||||
if (!worldObj.isRemote) {
|
return is;
|
||||||
slotChanged(slot);
|
} else return null;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
private void slotChanged(int slot) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
inventory[slot] = stack;
|
||||||
markDirty();
|
|
||||||
}
|
if (stack != null && stack.stackSize > getInventoryStackLimit()) {
|
||||||
|
stack.stackSize = getInventoryStackLimit();
|
||||||
@Override
|
}
|
||||||
public String getInventoryName() {
|
|
||||||
return name;
|
if (worldObj.isRemote && slot == BASE && stack != null) {
|
||||||
}
|
lastBase = stack.copy();
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public final boolean isUseableByPlayer(EntityPlayer player) {
|
if (!worldObj.isRemote) {
|
||||||
return true;
|
slotChanged(slot);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public int getInventoryStackLimit() {
|
private void slotChanged(int slot) {
|
||||||
return 64;
|
PacketHandler.INSTANCE
|
||||||
}
|
.sendToDimension(new MessageSlotUpdate(this, slot, inventory[slot]), worldObj.provider.dimensionId);
|
||||||
|
markDirty();
|
||||||
@Override
|
}
|
||||||
public boolean hasCustomInventoryName() {
|
|
||||||
return false;
|
@Override
|
||||||
}
|
public String getInventoryName() {
|
||||||
|
return name;
|
||||||
@Override
|
}
|
||||||
public int[] getAccessibleSlotsFromSide(int side) {
|
|
||||||
return new int[] { BASE, TARGET, OUTPUT, CHISEL };
|
@Override
|
||||||
}
|
public final boolean isUseableByPlayer(EntityPlayer player) {
|
||||||
|
return true;
|
||||||
@Override
|
}
|
||||||
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
|
|
||||||
if (itemStack == null) {
|
@Override
|
||||||
return false;
|
public int getInventoryStackLimit() {
|
||||||
}
|
return 64;
|
||||||
|
}
|
||||||
switch (slot) {
|
|
||||||
case BASE:
|
@Override
|
||||||
case TARGET:
|
public boolean hasCustomInventoryName() {
|
||||||
return !Carving.chisel.getItemsForChiseling(itemStack).isEmpty();
|
return false;
|
||||||
case OUTPUT:
|
}
|
||||||
return false;
|
|
||||||
case CHISEL:
|
@Override
|
||||||
return itemStack.getItem() instanceof IChiselItem;
|
public int[] getAccessibleSlotsFromSide(int side) {
|
||||||
default:
|
return new int[] { BASE, TARGET, OUTPUT, CHISEL };
|
||||||
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade && Upgrade.values()[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
}
|
||||||
}
|
|
||||||
}
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slot, ItemStack itemStack) {
|
||||||
@Override
|
if (itemStack == null) {
|
||||||
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
return false;
|
||||||
return hasUpgrade(Upgrade.AUTOMATION) && (slot == BASE || slot == TARGET || slot == CHISEL);
|
}
|
||||||
}
|
|
||||||
|
switch (slot) {
|
||||||
@Override
|
case BASE:
|
||||||
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
case TARGET:
|
||||||
return hasUpgrade(Upgrade.AUTOMATION) && slot == OUTPUT;
|
return !Carving.chisel.getItemsForChiseling(itemStack)
|
||||||
}
|
.isEmpty();
|
||||||
|
case OUTPUT:
|
||||||
@Override
|
return false;
|
||||||
public void openInventory() {
|
case CHISEL:
|
||||||
;
|
return itemStack.getItem() instanceof IChiselItem;
|
||||||
}
|
default:
|
||||||
|
return Features.AUTO_CHISEL_UPGRADES.enabled() && itemStack.getItem() == ChiselItems.upgrade
|
||||||
@Override
|
&& Upgrade.VALUES[slot - MIN_UPGRADE].ordinal() == itemStack.getItemDamage();
|
||||||
public void closeInventory() {
|
}
|
||||||
;
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public boolean canInsertItem(int slot, ItemStack itemStack, int side) {
|
||||||
public EntityItem getItemForRendering(int slot) {
|
return hasUpgrade(Upgrade.AUTOMATION) && (slot == BASE || slot == TARGET || slot == CHISEL);
|
||||||
if (ghostItem == null) {
|
}
|
||||||
ghostItem = new EntityItem(worldObj);
|
|
||||||
ghostItem.hoverStart = 0.0F;
|
@Override
|
||||||
}
|
public boolean canExtractItem(int slot, ItemStack itemStack, int side) {
|
||||||
|
return hasUpgrade(Upgrade.AUTOMATION) && slot == OUTPUT;
|
||||||
if (slot == BASE && lastBase != null) {
|
}
|
||||||
ghostItem.setEntityItemStack(lastBase.copy());
|
|
||||||
return ghostItem;
|
@Override
|
||||||
} else if (slot == TARGET) {
|
public void openInventory() {
|
||||||
ItemStack target = getTarget();
|
;
|
||||||
if (target != null) {
|
}
|
||||||
ghostItem.setEntityItemStack(target);
|
|
||||||
return ghostItem;
|
@Override
|
||||||
}
|
public void closeInventory() {
|
||||||
return null;
|
;
|
||||||
} else if (inventory[slot] == null) {
|
}
|
||||||
return null;
|
|
||||||
} else {
|
@SideOnly(Side.CLIENT)
|
||||||
ghostItem.setEntityItemStack(inventory[slot].copy());
|
public ItemStack getItemForRendering(int slot) {
|
||||||
return ghostItem;
|
if (slot == BASE && lastBase != null) {
|
||||||
}
|
return lastBase.copy();
|
||||||
}
|
} else if (slot == TARGET) {
|
||||||
|
return getTarget();
|
||||||
@Override
|
} else if (inventory[slot] == null) {
|
||||||
public Packet getDescriptionPacket() {
|
return null;
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
} else {
|
||||||
writeToNBT(tag);
|
return inventory[slot].copy();
|
||||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
public Packet getDescriptionPacket() {
|
||||||
readFromNBT(packet.func_148857_g());
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
}
|
writeToNBT(tag);
|
||||||
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||||
public boolean hasUpgrade(Upgrade upgrade) {
|
}
|
||||||
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
|
||||||
ItemStack stack = inventory[MIN_UPGRADE + upgrade.ordinal()];
|
@Override
|
||||||
if (stack != null) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||||
return stack.getItem() == ChiselItems.upgrade && stack.getItemDamage() == upgrade.ordinal();
|
readFromNBT(packet.func_148857_g());
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
public boolean hasUpgrade(Upgrade upgrade) {
|
||||||
|
if (Features.AUTO_CHISEL_UPGRADES.enabled()) {
|
||||||
return upgrade == Upgrade.REVERSION ? false : true;
|
ItemStack stack = inventory[MIN_UPGRADE + upgrade.ordinal()];
|
||||||
}
|
if (stack != null) {
|
||||||
|
return stack.getItem() == ChiselItems.upgrade && stack.getItemDamage() == upgrade.ordinal();
|
||||||
public String getSlotTooltipUnloc(int slotNumber) {
|
}
|
||||||
String base = "autochisel.slot.%s.tooltip";
|
return false;
|
||||||
String name = null;
|
}
|
||||||
if (slotNumber < MIN_UPGRADE) {
|
|
||||||
if (slotNumber == TARGET) {
|
return upgrade == Upgrade.REVERSION ? false : true;
|
||||||
name = "target";
|
}
|
||||||
} else if (slotNumber == CHISEL) {
|
|
||||||
name = "chisel";
|
public String getSlotTooltipUnloc(int slotNumber) {
|
||||||
}
|
String base = "autochisel.slot.%s.tooltip";
|
||||||
String unloc = name == null ? null : String.format(base, name);
|
String name = null;
|
||||||
return StatCollector.translateToLocal(unloc);
|
if (slotNumber < MIN_UPGRADE) {
|
||||||
} else {
|
if (slotNumber == TARGET) {
|
||||||
return Upgrade.values()[slotNumber - MIN_UPGRADE].getLocalizedName();
|
name = "target";
|
||||||
}
|
} else if (slotNumber == CHISEL) {
|
||||||
}
|
name = "chisel";
|
||||||
|
}
|
||||||
public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound, boolean breakChisel) {
|
String unloc = name == null ? null : String.format(base, name);
|
||||||
this.lastBase = lastChiseled == null ? null : lastChiseled.copy();
|
return StatCollector.translateToLocal(unloc);
|
||||||
this.toChisel = chiseled;
|
} else {
|
||||||
if (playSound) {
|
return Upgrade.VALUES[slotNumber - MIN_UPGRADE].getLocalizedName();
|
||||||
this.chiseling = true;
|
}
|
||||||
}
|
}
|
||||||
this.breakChisel = breakChisel;
|
|
||||||
}
|
public void doChiselAnim(ItemStack lastChiseled, int chiseled, boolean playSound, boolean breakChisel) {
|
||||||
|
this.lastBase = lastChiseled == null ? null : lastChiseled.copy();
|
||||||
public ItemStack getLastBase() {
|
this.toChisel = chiseled;
|
||||||
return lastBase == null ? null : lastBase.copy();
|
if (playSound) {
|
||||||
}
|
this.chiseling = true;
|
||||||
|
}
|
||||||
|
this.breakChisel = breakChisel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ItemStack getLastBase() {
|
||||||
|
return lastBase == null ? null : lastBase.copy();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,14 +2,15 @@ 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;
|
||||||
|
|
||||||
public class TileEntityCarvableBeacon extends TileEntityBeacon {
|
public class TileEntityCarvableBeacon extends TileEntityBeacon {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly(Side.CLIENT)
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return INFINITE_EXTENT_AABB;
|
return INFINITE_EXTENT_AABB;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,349 +14,358 @@ 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;
|
||||||
// If cachedDir is non-null, but connection is null, this present must be
|
// If cachedDir is non-null, but connection is null, this present must be
|
||||||
// connected to an unloaded present. This is handled appropriately.
|
// connected to an unloaded present. This is handled appropriately.
|
||||||
private ForgeDirection cachedDir = null;
|
private ForgeDirection cachedDir = null;
|
||||||
private boolean isParent;
|
private boolean isParent;
|
||||||
private final ItemStack[] inventory = new ItemStack[27];
|
private final ItemStack[] inventory = new ItemStack[27];
|
||||||
private int rotation;
|
private int rotation;
|
||||||
private boolean autoSearch = true;
|
private boolean autoSearch = true;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
if (!isConnected() && autoSearch && worldObj != null /* ugh */) {
|
if (!isConnected() && autoSearch && worldObj != null /* ugh */) {
|
||||||
if (cachedDir != null) {
|
if (cachedDir != null) {
|
||||||
connectTo(cachedDir);
|
connectTo(cachedDir);
|
||||||
} else if (!worldObj.isRemote) {
|
} else if (!worldObj.isRemote) {
|
||||||
findConnections();
|
findConnections();
|
||||||
}
|
}
|
||||||
autoSearch = false;
|
autoSearch = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isConnected() {
|
public boolean isConnected() {
|
||||||
return connection != null;
|
return connection != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
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()
|
||||||
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
&& (present.cachedDir == null || present.cachedDir == dir.getOpposite())
|
||||||
connection = present;
|
&& Math.abs(present.xCoord - xCoord + present.yCoord - yCoord + present.zCoord - zCoord) == 1) {
|
||||||
connection.connection = this;
|
connection = present;
|
||||||
connection.cachedDir = dir.getOpposite();
|
connection.connection = this;
|
||||||
connection.markDirty();
|
connection.cachedDir = dir.getOpposite();
|
||||||
cachedDir = dir;
|
connection.markDirty();
|
||||||
isParent = !present.isParent;
|
cachedDir = dir;
|
||||||
markDirty();
|
isParent = !present.isParent;
|
||||||
PacketHandler.INSTANCE.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
markDirty();
|
||||||
return true;
|
PacketHandler.INSTANCE
|
||||||
}
|
.sendToDimension(new MessagePresentConnect(this, dir, true), worldObj.provider.dimensionId);
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean connectTo(ForgeDirection dir) {
|
public boolean connectTo(ForgeDirection dir) {
|
||||||
int x = xCoord + dir.offsetX, y = yCoord + dir.offsetY, z = zCoord + dir.offsetZ;
|
int x = xCoord + dir.offsetX, y = yCoord + dir.offsetY, z = zCoord + dir.offsetZ;
|
||||||
TileEntity te = getTileSafe(x, y, z);
|
TileEntity te = getTileSafe(x, y, z);
|
||||||
if (te instanceof TileEntityPresent) {
|
if (te instanceof TileEntityPresent) {
|
||||||
return connectTo((TileEntityPresent) te, dir);
|
return connectTo((TileEntityPresent) te, dir);
|
||||||
}
|
}
|
||||||
return !exists(x, y, z);
|
return !exists(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @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()) {
|
||||||
if (!preserveDir) {
|
if (!preserveDir) {
|
||||||
this.connection.cachedDir = null;
|
this.connection.cachedDir = null;
|
||||||
this.cachedDir = null;
|
this.cachedDir = null;
|
||||||
}
|
}
|
||||||
this.connection.connection = null;
|
this.connection.connection = null;
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public TileEntityPresent getConnection() {
|
public TileEntityPresent getConnection() {
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ForgeDirection getConnectionDir() {
|
public ForgeDirection getConnectionDir() {
|
||||||
return cachedDir == null ? ForgeDirection.UNKNOWN : cachedDir;
|
return cachedDir == null ? ForgeDirection.UNKNOWN : cachedDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isParent() {
|
public boolean isParent() {
|
||||||
return isParent || !isConnected();
|
return isParent || !isConnected();
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getRotation() {
|
public int getRotation() {
|
||||||
return rotation;
|
return rotation;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRotation(int rot) {
|
public void setRotation(int rot) {
|
||||||
this.rotation = rot;
|
this.rotation = rot;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void findConnections() {
|
public void findConnections() {
|
||||||
if (!isConnected()) {
|
if (!isConnected()) {
|
||||||
if (cachedDir != null) {
|
if (cachedDir != null) {
|
||||||
if (connectTo(cachedDir)) {
|
if (connectTo(cachedDir)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
|
||||||
if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
|
if (dir != ForgeDirection.UP && dir != ForgeDirection.DOWN) {
|
||||||
if (connectTo(dir)) {
|
if (connectTo(dir)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TileEntityPresent getParent() {
|
public TileEntityPresent getParent() {
|
||||||
return isParent || connection == null ? this : connection;
|
return isParent || connection == null ? this : connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AxisAlignedBB getRenderBoundingBox() {
|
public AxisAlignedBB getRenderBoundingBox() {
|
||||||
return ChiselBlocks.present.getBoundingBox(this);
|
return ChiselBlocks.present.getBoundingBox(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound tag) {
|
public void writeToNBT(NBTTagCompound tag) {
|
||||||
super.writeToNBT(tag);
|
super.writeToNBT(tag);
|
||||||
NBTTagList nbttaglist = new NBTTagList();
|
NBTTagList nbttaglist = new NBTTagList();
|
||||||
|
|
||||||
for (int i = 0; i < getTrueSizeInventory(); ++i) {
|
for (int i = 0; i < getTrueSizeInventory(); ++i) {
|
||||||
if (inventory[i] != null) {
|
if (inventory[i] != null) {
|
||||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||||
nbttagcompound1.setByte("Slot", (byte) i);
|
nbttagcompound1.setByte("Slot", (byte) i);
|
||||||
inventory[i].writeToNBT(nbttagcompound1);
|
inventory[i].writeToNBT(nbttagcompound1);
|
||||||
nbttaglist.appendTag(nbttagcompound1);
|
nbttaglist.appendTag(nbttagcompound1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tag.setTag("Items", nbttaglist);
|
tag.setTag("Items", nbttaglist);
|
||||||
tag.setBoolean("isParent", isParent);
|
tag.setBoolean("isParent", isParent);
|
||||||
tag.setInteger("rotation", rotation);
|
tag.setInteger("rotation", rotation);
|
||||||
if (cachedDir != null) {
|
if (cachedDir != null) {
|
||||||
tag.setInteger("conDir", cachedDir.ordinal());
|
tag.setInteger("conDir", cachedDir.ordinal());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound tag) {
|
public void readFromNBT(NBTTagCompound tag) {
|
||||||
super.readFromNBT(tag);
|
super.readFromNBT(tag);
|
||||||
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
NBTTagList nbttaglist = tag.getTagList("Items", 10);
|
||||||
|
|
||||||
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
for (int i = 0; i < nbttaglist.tagCount(); ++i) {
|
||||||
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
|
||||||
int j = nbttagcompound1.getByte("Slot") & 255;
|
int j = nbttagcompound1.getByte("Slot") & 255;
|
||||||
|
|
||||||
if (j >= 0 && j < getTrueSizeInventory()) {
|
if (j >= 0 && j < getTrueSizeInventory()) {
|
||||||
inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
inventory[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isParent = tag.getBoolean("isParent");
|
this.isParent = tag.getBoolean("isParent");
|
||||||
|
|
||||||
this.rotation = tag.getInteger("rotation");
|
this.rotation = tag.getInteger("rotation");
|
||||||
if (tag.hasKey("conDir")) {
|
if (tag.hasKey("conDir")) {
|
||||||
cachedDir = ForgeDirection.values()[tag.getInteger("conDir")];
|
cachedDir = ForgeDirection.values()[tag.getInteger("conDir")];
|
||||||
}
|
}
|
||||||
autoSearch = true;
|
autoSearch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Packet getDescriptionPacket() {
|
public Packet getDescriptionPacket() {
|
||||||
NBTTagCompound tag = new NBTTagCompound();
|
NBTTagCompound tag = new NBTTagCompound();
|
||||||
writeToNBT(tag);
|
writeToNBT(tag);
|
||||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||||
readFromNBT(packet.func_148857_g());
|
readFromNBT(packet.func_148857_g());
|
||||||
}
|
}
|
||||||
|
|
||||||
@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,
|
||||||
// prevent losing TE data when in-world chiseling
|
int z) {
|
||||||
return oldBlock != newBlock;
|
// prevent losing TE data when in-world chiseling
|
||||||
}
|
return oldBlock != newBlock;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void invalidate() {
|
public void invalidate() {
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
disconnect(false);
|
disconnect(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload() {
|
public void onChunkUnload() {
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
if (isConnected()) {
|
if (isConnected()) {
|
||||||
disconnect(true);
|
disconnect(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getAdjustedSlot(int slot) {
|
private int getAdjustedSlot(int slot) {
|
||||||
slot %= getSizeInventory();
|
slot %= getSizeInventory();
|
||||||
if (isConnected() && !isParent) {
|
if (isConnected() && !isParent) {
|
||||||
slot = (slot + getTrueSizeInventory()) % getSizeInventory();
|
slot = (slot + getTrueSizeInventory()) % getSizeInventory();
|
||||||
}
|
}
|
||||||
return slot;
|
return slot;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TileEntity getTileSafe(int x, int y, int z) {
|
private TileEntity getTileSafe(int x, int y, int z) {
|
||||||
if (exists(x, y, z)) {
|
if (exists(x, y, z)) {
|
||||||
return worldObj.getTileEntity(x, y, z);
|
return worldObj.getTileEntity(x, y, z);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// private Block getBlockSafe(int x, int y, int z) {
|
// private Block getBlockSafe(int x, int y, int z) {
|
||||||
// if (exists(x, y, z)) {
|
// if (exists(x, y, z)) {
|
||||||
// return worldObj.getBlock(x, y, z);
|
// return worldObj.getBlock(x, y, z);
|
||||||
// }
|
// }
|
||||||
// return null;
|
// return null;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
// private int getMetaSafe(int x, int y, int z) {
|
// private int getMetaSafe(int x, int y, int z) {
|
||||||
// if (exists(x, y, z)) {
|
// if (exists(x, y, z)) {
|
||||||
// return worldObj.getBlockMetadata(x, y, z);
|
// return worldObj.getBlockMetadata(x, y, z);
|
||||||
// }
|
// }
|
||||||
// return 0;
|
// return 0;
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
private boolean exists(int x, int y, int z) {
|
private boolean exists(int x, int y, int z) {
|
||||||
return worldObj.blockExists(x, y, z);
|
return worldObj.blockExists(x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IInventory */
|
/* IInventory */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSizeInventory() {
|
public int getSizeInventory() {
|
||||||
return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory();
|
return isConnected() ? getTrueSizeInventory() + connection.getTrueSizeInventory() : getTrueSizeInventory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlot(int slot) {
|
public ItemStack getStackInSlot(int slot) {
|
||||||
slot = getAdjustedSlot(slot);
|
slot = getAdjustedSlot(slot);
|
||||||
if (slot >= getTrueSizeInventory()) {
|
if (slot >= getTrueSizeInventory()) {
|
||||||
return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null;
|
return isConnected() ? connection.inventory[slot % getTrueSizeInventory()] : null;
|
||||||
} else {
|
} else {
|
||||||
return inventory[slot];
|
return inventory[slot];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack decrStackSize(int slot, int amount) {
|
public ItemStack decrStackSize(int slot, int amount) {
|
||||||
slot = getAdjustedSlot(slot);
|
slot = getAdjustedSlot(slot);
|
||||||
ItemStack[] inv = inventory;
|
ItemStack[] inv = inventory;
|
||||||
if (isConnected() && slot >= getTrueSizeInventory()) {
|
if (isConnected() && slot >= getTrueSizeInventory()) {
|
||||||
inv = connection.inventory;
|
inv = connection.inventory;
|
||||||
slot %= getTrueSizeInventory();
|
slot %= getTrueSizeInventory();
|
||||||
connection.markDirty();
|
connection.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inv[slot] != null) {
|
if (inv[slot] != null) {
|
||||||
ItemStack itemstack;
|
ItemStack itemstack;
|
||||||
|
|
||||||
if (inv[slot].stackSize <= amount) {
|
if (inv[slot].stackSize <= amount) {
|
||||||
itemstack = inv[slot];
|
itemstack = inv[slot];
|
||||||
inv[slot] = null;
|
inv[slot] = null;
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
return itemstack;
|
return itemstack;
|
||||||
} else {
|
} else {
|
||||||
itemstack = inv[slot].splitStack(amount);
|
itemstack = inv[slot].splitStack(amount);
|
||||||
|
|
||||||
if (inv[slot].stackSize == 0) {
|
if (inv[slot].stackSize == 0) {
|
||||||
inv[slot] = null;
|
inv[slot] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
return itemstack;
|
return itemstack;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||||
return getStackInSlot(slot);
|
return getStackInSlot(slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setInventorySlotContents(int slot, ItemStack stack) {
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
slot = getAdjustedSlot(slot);
|
slot = getAdjustedSlot(slot);
|
||||||
if (slot < getTrueSizeInventory()) {
|
if (slot < getTrueSizeInventory()) {
|
||||||
inventory[slot] = stack;
|
inventory[slot] = stack;
|
||||||
} else if (isConnected()) {
|
} else if (isConnected()) {
|
||||||
connection.inventory[slot % getTrueSizeInventory()] = stack;
|
connection.inventory[slot % getTrueSizeInventory()] = stack;
|
||||||
connection.markDirty();
|
connection.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getInventoryName() {
|
public String getInventoryName() {
|
||||||
return "chisel.present";
|
return "chisel.present";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasCustomInventoryName() {
|
public boolean hasCustomInventoryName() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getInventoryStackLimit() {
|
public int getInventoryStackLimit() {
|
||||||
return 64;
|
return 64;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
public boolean isUseableByPlayer(EntityPlayer p_70300_1_) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void openInventory() {
|
public void openInventory() {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void closeInventory() {
|
public void closeInventory() {
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
public boolean isItemValidForSlot(int p_94041_1_, ItemStack p_94041_2_) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IDoubleChest */
|
/* IDoubleChest */
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTrueSizeInventory() {
|
public int getTrueSizeInventory() {
|
||||||
return inventory.length;
|
return inventory.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ItemStack getTrueStackInSlot(int slot) {
|
public ItemStack getTrueStackInSlot(int slot) {
|
||||||
return inventory[slot % getTrueSizeInventory()];
|
return inventory[slot % getTrueSizeInventory()];
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putStackInTrueSlot(int slot, ItemStack stack) {
|
public void putStackInTrueSlot(int slot, ItemStack stack) {
|
||||||
inventory[slot % getTrueSizeInventory()] = stack;
|
inventory[slot % getTrueSizeInventory()] = stack;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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,208 +16,201 @@ 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 {
|
||||||
|
|
||||||
GroupList groups = new GroupList();
|
GroupList groups = new GroupList();
|
||||||
|
|
||||||
public static final ICarvingRegistry chisel = new Carving();
|
public static final ICarvingRegistry chisel = new Carving();
|
||||||
public static final Carving needle = new Carving();
|
public static final Carving needle = new Carving();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
CarvingUtils.chisel = chisel;
|
CarvingUtils.chisel = chisel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void construct() {
|
public static void construct() {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
private Carving() {
|
private Carving() {
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingVariation getVariation(Block block, int metadata) {
|
public ICarvingVariation getVariation(Block block, int metadata) {
|
||||||
ICarvingGroup g = getGroup(block, metadata);
|
ICarvingGroup g = getGroup(block, metadata);
|
||||||
if (g != null) {
|
if (g != null) {
|
||||||
for (ICarvingVariation v : g.getVariations()) {
|
for (ICarvingVariation v : g.getVariations()) {
|
||||||
if (v.getBlock() == block && v.getBlockMeta() == metadata) {
|
if (v.getBlock() == block && v.getBlockMeta() == metadata) {
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ItemStack> getItemsForChiseling(ItemStack chiseledItem) {
|
public List<ItemStack> getItemsForChiseling(ItemStack chiseledItem) {
|
||||||
ArrayList<ItemStack> items = new ArrayList<>();
|
ArrayList<ItemStack> items = new ArrayList<>();
|
||||||
|
|
||||||
ICarvingGroup group = null;
|
ICarvingGroup group = null;
|
||||||
|
|
||||||
int[] oreIDs = OreDictionary.getOreIDs(chiseledItem);
|
int[] oreIDs = OreDictionary.getOreIDs(chiseledItem);
|
||||||
for (int i : oreIDs) {
|
for (int i : oreIDs) {
|
||||||
group = groups.getGroupByOre(OreDictionary.getOreName(i));
|
group = groups.getGroupByOre(OreDictionary.getOreName(i));
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
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<>();
|
||||||
|
|
||||||
List<ICarvingVariation> variations = group.getVariations();
|
List<ICarvingVariation> variations = group.getVariations();
|
||||||
|
|
||||||
for (ICarvingVariation v : variations) {
|
for (ICarvingVariation v : variations) {
|
||||||
String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta();
|
String key = Block.getIdFromBlock(v.getBlock()) + "|" + v.getItemMeta();
|
||||||
if (mapping.add(key)) items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta()));
|
if (mapping.add(key)) items.add(new ItemStack(v.getBlock(), 1, v.getItemMeta()));
|
||||||
}
|
}
|
||||||
|
|
||||||
String oreName = group.getOreName();
|
String oreName = group.getOreName();
|
||||||
if (oreName != null) {
|
if (oreName != null) {
|
||||||
ArrayList<ItemStack> ores = OreDictionary.getOres(oreName);
|
ArrayList<ItemStack> ores = OreDictionary.getOres(oreName);
|
||||||
for (ItemStack stack : ores) {
|
for (ItemStack stack : ores) {
|
||||||
String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage();
|
String key = Item.getIdFromItem(stack.getItem()) + "|" + stack.getItemDamage();
|
||||||
if (mapping.add(key)) items.add(stack);
|
if (mapping.add(key)) items.add(stack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingGroup getGroup(Block block, int metadata) {
|
public ICarvingGroup getGroup(Block block, int metadata) {
|
||||||
int[] ids = OreDictionary.getOreIDs(new ItemStack(block, 1, metadata));
|
int[] ids = OreDictionary.getOreIDs(new ItemStack(block, 1, metadata));
|
||||||
if (ids.length > 0) {
|
if (ids.length > 0) {
|
||||||
for (int id : ids) {
|
for (int id : ids) {
|
||||||
ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id));
|
ICarvingGroup oreGroup = groups.getGroupByOre(OreDictionary.getOreName(id));
|
||||||
if (oreGroup != null) {
|
if (oreGroup != null) {
|
||||||
return oreGroup;
|
return oreGroup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return groups.getGroup(block, metadata);
|
return groups.getGroup(block, metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingGroup getGroup(String name) {
|
public ICarvingGroup getGroup(String name) {
|
||||||
return groups.getGroupByName(name);
|
return groups.getGroupByName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingGroup removeGroup(String groupName) {
|
public ICarvingGroup removeGroup(String groupName) {
|
||||||
ICarvingGroup g = groups.getGroupByName(groupName);
|
ICarvingGroup g = groups.getGroupByName(groupName);
|
||||||
return groups.remove(g) ? g : null;
|
return groups.remove(g) ? g : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingVariation removeVariation(Block block, int metadata) {
|
public ICarvingVariation removeVariation(Block block, int metadata) {
|
||||||
return removeVariation(block, metadata, null);
|
return removeVariation(block, metadata, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ICarvingVariation removeVariation(Block block, int metadata, String group) {
|
public ICarvingVariation removeVariation(Block block, int metadata, String group) {
|
||||||
return groups.removeVariation(block, metadata, group);
|
return groups.removeVariation(block, metadata, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addVariation(String groupName, Block block, int metadata, int order) {
|
public void addVariation(String groupName, Block block, int metadata, int order) {
|
||||||
if (block == null) {
|
if (block == null) {
|
||||||
throw new NullPointerException("Cannot add variation in group " + groupName + " for null block.");
|
throw new NullPointerException("Cannot add variation in group " + groupName + " for null block.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ICarvingVariation variation = CarvingUtils.getDefaultVariationFor(block, metadata, order);
|
ICarvingVariation variation = CarvingUtils.getDefaultVariationFor(block, metadata, order);
|
||||||
addVariation(groupName, variation);
|
addVariation(groupName, variation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addVariation(String groupName, ICarvingVariation variation) {
|
public void addVariation(String groupName, ICarvingVariation variation) {
|
||||||
if (groupName == null) {
|
if (groupName == null) {
|
||||||
throw new NullPointerException("Cannot add variation to null group name.");
|
throw new NullPointerException("Cannot add variation to null group name.");
|
||||||
} else if (variation == null) {
|
} else if (variation == null) {
|
||||||
throw new NullPointerException("Cannot add variation in group " + groupName + " for null variation.");
|
throw new NullPointerException("Cannot add variation in group " + groupName + " for null variation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
ICarvingGroup group = groups.getGroupByName(groupName);
|
ICarvingGroup group = groups.getGroupByName(groupName);
|
||||||
|
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
group = CarvingUtils.getDefaultGroupFor(groupName);
|
group = CarvingUtils.getDefaultGroupFor(groupName);
|
||||||
addGroup(group);
|
addGroup(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
groups.addVariation(groupName, variation);
|
groups.addVariation(groupName, variation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addGroup(ICarvingGroup group) {
|
public void addGroup(ICarvingGroup group) {
|
||||||
groups.add(group);
|
groups.add(group);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerOre(String name, String oreName) {
|
public void registerOre(String name, String oreName) {
|
||||||
ICarvingGroup group = groups.getGroupByName(name);
|
ICarvingGroup group = groups.getGroupByName(name);
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
group.setOreName(oreName);
|
group.setOreName(oreName);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist.");
|
throw new NullPointerException("Cannot register ore name for group " + name + ", as it does not exist.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setVariationSound(String name, String sound) {
|
public void setVariationSound(String name, String sound) {
|
||||||
ICarvingGroup group = groups.getGroupByName(name);
|
ICarvingGroup group = groups.getGroupByName(name);
|
||||||
if (group != null) {
|
if (group != null) {
|
||||||
group.setSound(sound);
|
group.setSound(sound);
|
||||||
} else {
|
} else {
|
||||||
throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist.");
|
throw new NullPointerException("Cannot set sound for group " + name + ", as it does not exist.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVariationSound(Block block, int metadata) {
|
public String getVariationSound(Block block, int metadata) {
|
||||||
return getVariationSound(Item.getItemFromBlock(block), metadata);
|
return getVariationSound(Item.getItemFromBlock(block), metadata);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVariationSound(Item item, int metadata) {
|
public String getVariationSound(Item item, int metadata) {
|
||||||
ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata);
|
ICarvingGroup group = groups.getGroup(Block.getBlockFromItem(item), metadata);
|
||||||
String sound = group == null ? null : group.getSound();
|
String sound = group == null ? null : group.getSound();
|
||||||
return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound;
|
return sound == null ? Chisel.MOD_ID + ":chisel.fallback" : sound;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<String> getSortedGroupNames() {
|
public List<String> getSortedGroupNames() {
|
||||||
List<String> names = new ArrayList<>(groups.getNames());
|
List<String> names = new ArrayList<>(groups.getNames());
|
||||||
Collections.sort(names);
|
Collections.sort(names);
|
||||||
return names;
|
return names;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loaded 100 of 3575 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user