├── .gitignore
├── COPYING
├── COPYING.LESSER
├── build.bat
├── build.gradle
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── src
└── main
├── java
└── me
│ └── ichun
│ └── mods
│ └── blocksteps
│ ├── api
│ └── BlockPeripheralHandler.java
│ └── common
│ ├── Blocksteps.java
│ ├── blockaid
│ ├── BlockStepHandler.java
│ ├── CheckBlockInfo.java
│ └── handler
│ │ └── periphs
│ │ ├── ButtonHandler.java
│ │ ├── EndPortalHandler.java
│ │ ├── GenericDenyHandler.java
│ │ ├── GenericHandler.java
│ │ ├── HorizontalGenericHandler.java
│ │ ├── LadderHandler.java
│ │ ├── LeverHandler.java
│ │ ├── LogHandler.java
│ │ ├── MushroomHandler.java
│ │ ├── ObsidianHandler.java
│ │ ├── PortalHandler.java
│ │ ├── SideSolidBlockHandler.java
│ │ ├── TorchHandler.java
│ │ ├── TripWireHookHandler.java
│ │ └── VerticalGenericHandler.java
│ ├── core
│ ├── ChunkStore.java
│ ├── Config.java
│ ├── EventHandlerClient.java
│ ├── MapSaveFile.java
│ └── Waypoint.java
│ ├── entity
│ └── EntityWaypoint.java
│ ├── gui
│ ├── GuiWaypoints.java
│ └── window
│ │ ├── WindowConfirmDelete.java
│ │ ├── WindowEditWaypoint.java
│ │ ├── WindowWaypoints.java
│ │ └── element
│ │ └── ElementWaypointList.java
│ ├── layer
│ └── LayerSheepPig.java
│ ├── model
│ ├── ModelSheepPig.java
│ └── ModelWaypoint.java
│ ├── render
│ ├── ListChunkFactoryBlocksteps.java
│ ├── ListedRenderChunkBlocksteps.java
│ ├── RegionRenderCacheBlocksteps.java
│ ├── RenderGlobalProxy.java
│ └── RenderWaypoint.java
│ └── thread
│ ├── ThreadBlockCrawler.java
│ └── ThreadCheckBlocks.java
└── resources
├── assets
└── blocksteps
│ ├── lang
│ ├── en_US.lang
│ └── zh_CN.lang
│ └── textures
│ ├── icon
│ ├── delMap.png
│ ├── delete.png
│ ├── done.png
│ └── new.png
│ └── model
│ └── sheeppig.png
├── mcmod.info
└── pack.mcmeta
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Package Files #
4 | *.war
5 | *.ear
6 |
7 | # IDEA Files #
8 | *.iml
9 | /.idea
10 |
11 | # Gradle #
12 | /.gradle
13 | /build
14 | /libs
15 | /src/api
--------------------------------------------------------------------------------
/COPYING.LESSER:
--------------------------------------------------------------------------------
1 | GNU LESSER GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 |
9 | This version of the GNU Lesser General Public License incorporates
10 | the terms and conditions of version 3 of the GNU General Public
11 | License, supplemented by the additional permissions listed below.
12 |
13 | 0. Additional Definitions.
14 |
15 | As used herein, "this License" refers to version 3 of the GNU Lesser
16 | General Public License, and the "GNU GPL" refers to version 3 of the GNU
17 | General Public License.
18 |
19 | "The Library" refers to a covered work governed by this License,
20 | other than an Application or a Combined Work as defined below.
21 |
22 | An "Application" is any work that makes use of an interface provided
23 | by the Library, but which is not otherwise based on the Library.
24 | Defining a subclass of a class defined by the Library is deemed a mode
25 | of using an interface provided by the Library.
26 |
27 | A "Combined Work" is a work produced by combining or linking an
28 | Application with the Library. The particular version of the Library
29 | with which the Combined Work was made is also called the "Linked
30 | Version".
31 |
32 | The "Minimal Corresponding Source" for a Combined Work means the
33 | Corresponding Source for the Combined Work, excluding any source code
34 | for portions of the Combined Work that, considered in isolation, are
35 | based on the Application, and not on the Linked Version.
36 |
37 | The "Corresponding Application Code" for a Combined Work means the
38 | object code and/or source code for the Application, including any data
39 | and utility programs needed for reproducing the Combined Work from the
40 | Application, but excluding the System Libraries of the Combined Work.
41 |
42 | 1. Exception to Section 3 of the GNU GPL.
43 |
44 | You may convey a covered work under sections 3 and 4 of this License
45 | without being bound by section 3 of the GNU GPL.
46 |
47 | 2. Conveying Modified Versions.
48 |
49 | If you modify a copy of the Library, and, in your modifications, a
50 | facility refers to a function or data to be supplied by an Application
51 | that uses the facility (other than as an argument passed when the
52 | facility is invoked), then you may convey a copy of the modified
53 | version:
54 |
55 | a) under this License, provided that you make a good faith effort to
56 | ensure that, in the event an Application does not supply the
57 | function or data, the facility still operates, and performs
58 | whatever part of its purpose remains meaningful, or
59 |
60 | b) under the GNU GPL, with none of the additional permissions of
61 | this License applicable to that copy.
62 |
63 | 3. Object Code Incorporating Material from Library Header Files.
64 |
65 | The object code form of an Application may incorporate material from
66 | a header file that is part of the Library. You may convey such object
67 | code under terms of your choice, provided that, if the incorporated
68 | material is not limited to numerical parameters, data structure
69 | layouts and accessors, or small macros, inline functions and templates
70 | (ten or fewer lines in length), you do both of the following:
71 |
72 | a) Give prominent notice with each copy of the object code that the
73 | Library is used in it and that the Library and its use are
74 | covered by this License.
75 |
76 | b) Accompany the object code with a copy of the GNU GPL and this license
77 | document.
78 |
79 | 4. Combined Works.
80 |
81 | You may convey a Combined Work under terms of your choice that,
82 | taken together, effectively do not restrict modification of the
83 | portions of the Library contained in the Combined Work and reverse
84 | engineering for debugging such modifications, if you also do each of
85 | the following:
86 |
87 | a) Give prominent notice with each copy of the Combined Work that
88 | the Library is used in it and that the Library and its use are
89 | covered by this License.
90 |
91 | b) Accompany the Combined Work with a copy of the GNU GPL and this license
92 | document.
93 |
94 | c) For a Combined Work that displays copyright notices during
95 | execution, include the copyright notice for the Library among
96 | these notices, as well as a reference directing the user to the
97 | copies of the GNU GPL and this license document.
98 |
99 | d) Do one of the following:
100 |
101 | 0) Convey the Minimal Corresponding Source under the terms of this
102 | License, and the Corresponding Application Code in a form
103 | suitable for, and under terms that permit, the user to
104 | recombine or relink the Application with a modified version of
105 | the Linked Version to produce a modified Combined Work, in the
106 | manner specified by section 6 of the GNU GPL for conveying
107 | Corresponding Source.
108 |
109 | 1) Use a suitable shared library mechanism for linking with the
110 | Library. A suitable mechanism is one that (a) uses at run time
111 | a copy of the Library already present on the user's computer
112 | system, and (b) will operate properly with a modified version
113 | of the Library that is interface-compatible with the Linked
114 | Version.
115 |
116 | e) Provide Installation Information, but only if you would otherwise
117 | be required to provide such information under section 6 of the
118 | GNU GPL, and only to the extent that such information is
119 | necessary to install and execute a modified version of the
120 | Combined Work produced by recombining or relinking the
121 | Application with a modified version of the Linked Version. (If
122 | you use option 4d0, the Installation Information must accompany
123 | the Minimal Corresponding Source and Corresponding Application
124 | Code. If you use option 4d1, you must provide the Installation
125 | Information in the manner specified by section 6 of the GNU GPL
126 | for conveying Corresponding Source.)
127 |
128 | 5. Combined Libraries.
129 |
130 | You may place library facilities that are a work based on the
131 | Library side by side in a single library together with other library
132 | facilities that are not Applications and are not covered by this
133 | License, and convey such a combined library under terms of your
134 | choice, if you do both of the following:
135 |
136 | a) Accompany the combined library with a copy of the same work based
137 | on the Library, uncombined with any other library facilities,
138 | conveyed under the terms of this License.
139 |
140 | b) Give prominent notice with the combined library that part of it
141 | is a work based on the Library, and explaining where to find the
142 | accompanying uncombined form of the same work.
143 |
144 | 6. Revised Versions of the GNU Lesser General Public License.
145 |
146 | The Free Software Foundation may publish revised and/or new versions
147 | of the GNU Lesser General Public License from time to time. Such new
148 | versions will be similar in spirit to the present version, but may
149 | differ in detail to address new problems or concerns.
150 |
151 | Each version is given a distinguishing version number. If the
152 | Library as you received it specifies that a certain numbered version
153 | of the GNU Lesser General Public License "or any later version"
154 | applies to it, you have the option of following the terms and
155 | conditions either of that published version or of any later version
156 | published by the Free Software Foundation. If the Library as you
157 | received it does not specify a version number of the GNU Lesser
158 | General Public License, you may choose any version of the GNU Lesser
159 | General Public License ever published by the Free Software Foundation.
160 |
161 | If the Library as you received it specifies that a proxy can decide
162 | whether future versions of the GNU Lesser General Public License shall
163 | apply, that proxy's public statement of acceptance of any version is
164 | permanent authorization for you to choose that version for the
165 | Library.
166 |
--------------------------------------------------------------------------------
/build.bat:
--------------------------------------------------------------------------------
1 | @echo off
2 | start gradlew clean build
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | jcenter()
4 | maven { url = "http://files.minecraftforge.net/maven" }
5 | }
6 | dependencies {
7 | classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
8 | }
9 | }
10 | apply plugin: 'net.minecraftforge.gradle.forge'
11 |
12 | sourceCompatibility = JavaVersion.VERSION_1_8
13 | targetCompatibility = JavaVersion.VERSION_1_8
14 |
15 | // Requires iChunUtil to run. Just put iChunUtil-deobf.jar in the /libs/ folder or it won't compile.
16 | version = "1.10.2-6.0.0"
17 | group= "blocksteps"
18 | archivesBaseName = "Blocksteps"
19 |
20 | minecraft {
21 | version = "1.10.2-12.18.2.2151"
22 | runDir = "run"
23 |
24 | // the mappings can be changed at any time, and must be in the following format.
25 | // snapshot_YYYYMMDD snapshot are built nightly.
26 | // stable_# stables are built at the discretion of the MCP team.
27 | // Use non-default mappings at your own risk. they may not allways work.
28 | // simply re-run your setup task after changing the mappings to update your workspace.
29 | mappings = "snapshot_20161112"
30 | // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
31 | }
32 |
33 | processResources
34 | {
35 | // this will ensure that this task is redone when the versions change.
36 | inputs.property "version", project.version
37 | inputs.property "mcversion", project.minecraft.version
38 |
39 | // replace stuff in mcmod.info, nothing else
40 | from(sourceSets.main.resources.srcDirs) {
41 | include 'mcmod.info'
42 |
43 | // replace version and mcversion
44 | expand 'version':project.version, 'mcversion':project.minecraft.version
45 | }
46 |
47 | // copy everything else, thats not the mcmod.info
48 | from(sourceSets.main.resources.srcDirs) {
49 | exclude 'mcmod.info'
50 | }
51 | }
52 |
53 | // deobf jars
54 | task deobfJar(type: Jar) {
55 | from sourceSets.main.output
56 | classifier = 'deobf'
57 | }
58 |
59 | // make sure all of these happen when we run build
60 | build.dependsOn sourceJar, deobfJar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Mon Sep 14 12:28:28 PDT 2015
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
7 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # For Cygwin, ensure paths are in UNIX format before anything is touched.
46 | if $cygwin ; then
47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
48 | fi
49 |
50 | # Attempt to set APP_HOME
51 | # Resolve links: $0 may be a link
52 | PRG="$0"
53 | # Need this for relative symlinks.
54 | while [ -h "$PRG" ] ; do
55 | ls=`ls -ld "$PRG"`
56 | link=`expr "$ls" : '.*-> \(.*\)$'`
57 | if expr "$link" : '/.*' > /dev/null; then
58 | PRG="$link"
59 | else
60 | PRG=`dirname "$PRG"`"/$link"
61 | fi
62 | done
63 | SAVED="`pwd`"
64 | cd "`dirname \"$PRG\"`/" >&-
65 | APP_HOME="`pwd -P`"
66 | cd "$SAVED" >&-
67 |
68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
69 |
70 | # Determine the Java command to use to start the JVM.
71 | if [ -n "$JAVA_HOME" ] ; then
72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
73 | # IBM's JDK on AIX uses strange locations for the executables
74 | JAVACMD="$JAVA_HOME/jre/sh/java"
75 | else
76 | JAVACMD="$JAVA_HOME/bin/java"
77 | fi
78 | if [ ! -x "$JAVACMD" ] ; then
79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
80 |
81 | Please set the JAVA_HOME variable in your environment to match the
82 | location of your Java installation."
83 | fi
84 | else
85 | JAVACMD="java"
86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
87 |
88 | Please set the JAVA_HOME variable in your environment to match the
89 | location of your Java installation."
90 | fi
91 |
92 | # Increase the maximum file descriptors if we can.
93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
94 | MAX_FD_LIMIT=`ulimit -H -n`
95 | if [ $? -eq 0 ] ; then
96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
97 | MAX_FD="$MAX_FD_LIMIT"
98 | fi
99 | ulimit -n $MAX_FD
100 | if [ $? -ne 0 ] ; then
101 | warn "Could not set maximum file descriptor limit: $MAX_FD"
102 | fi
103 | else
104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
105 | fi
106 | fi
107 |
108 | # For Darwin, add options to specify how the application appears in the dock
109 | if $darwin; then
110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
111 | fi
112 |
113 | # For Cygwin, switch paths to Windows format before running java
114 | if $cygwin ; then
115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
158 | function splitJvmOpts() {
159 | JVM_OPTS=("$@")
160 | }
161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
163 |
164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
165 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
12 | set DEFAULT_JVM_OPTS=
13 |
14 | set DIRNAME=%~dp0
15 | if "%DIRNAME%" == "" set DIRNAME=.
16 | set APP_BASE_NAME=%~n0
17 | set APP_HOME=%DIRNAME%
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windowz variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 | if "%@eval[2+2]" == "4" goto 4NT_args
53 |
54 | :win9xME_args
55 | @rem Slurp the command line arguments.
56 | set CMD_LINE_ARGS=
57 | set _SKIP=2
58 |
59 | :win9xME_args_slurp
60 | if "x%~1" == "x" goto execute
61 |
62 | set CMD_LINE_ARGS=%*
63 | goto execute
64 |
65 | :4NT_args
66 | @rem Get arguments from the 4NT Shell from JP Software
67 | set CMD_LINE_ARGS=%$
68 |
69 | :execute
70 | @rem Setup the command line
71 |
72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
73 |
74 | @rem Execute Gradle
75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
76 |
77 | :end
78 | @rem End local scope for the variables with windows NT shell
79 | if "%ERRORLEVEL%"=="0" goto mainEnd
80 |
81 | :fail
82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
83 | rem the _cmd.exe /c_ return code!
84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
85 | exit /b 1
86 |
87 | :mainEnd
88 | if "%OS%"=="Windows_NT" endlocal
89 |
90 | :omega
91 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/api/BlockPeripheralHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.api;
2 |
3 | import net.minecraft.block.Block;
4 | import net.minecraft.block.state.IBlockState;
5 | import net.minecraft.util.math.BlockPos;
6 | import net.minecraft.world.IBlockAccess;
7 | import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
8 |
9 | import java.util.ArrayList;
10 | import java.util.HashMap;
11 | import java.util.List;
12 |
13 | /**
14 | * BlockPeripheralHandler class
15 | * This class is used to identify blocks as "peripherals" for Blocksteps, and to get their respective blocks as well
16 | * Look at the source of blocksteps for classes that extends this class to get a general idea on how to use it.
17 | *
18 | * @author iChun
19 | */
20 | public abstract class BlockPeripheralHandler
21 | {
22 | /**
23 | * Checks the block to see if it is a valid peripheral block
24 | * @param world The world object.
25 | * @param pos The position of this block peripheral.
26 | * @param state The block state of this block peripheral.
27 | * @param availableBlocks Available "solid" blocks surrounding said peripheral. Used by levers and torches to see if the block it's attached to is in the list or not.
28 | * @return block is a valid peripheral
29 | */
30 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
31 | {
32 | return !getRelativeBlocks(world, pos, state, availableBlocks).isEmpty();
33 | }
34 |
35 | /**
36 | * Gets the list of relative peripheral blocks to be rendered by Blocksteps.
37 | * @param world The world object.
38 | * @param pos The position of this block peripheral.
39 | * @param state The block state of this block peripheral.
40 | * @param availableBlocks Available "solid" blocks surrounding said peripheral. Used by levers and torches to see if the block it's attached to is in the list or not.
41 | * @return Returns the list of peripheral blocks in relation to this handler.
42 | */
43 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
44 | {
45 | ArrayList poses = new ArrayList();
46 | poses.add(pos);
47 | return poses;
48 | }
49 |
50 | /**
51 | * If the peripheral is also a solid block. Used by handlers for logs and obsidian, etc.
52 | * @return block is also a solid block
53 | */
54 | public boolean isAlsoSolidBlock()
55 | {
56 | return false;
57 | }
58 |
59 | /**
60 | * For resource-heavy checks/calls, this makes a thread do the checks instead of the main Minecraft thread, to reduce lag
61 | * @return to use thread or not.
62 | */
63 | public boolean requireThread()
64 | {
65 | return false;
66 | }
67 |
68 | /**
69 | * Call this method to register your peripheral handler.
70 | * Why am I reflecting to do it? I'm lazy, that's why.
71 | * @param clz Class for handler
72 | * @param handler Actual handler
73 | */
74 | public static void registerBlockPeripheralHandler(Class extends Block> clz, BlockPeripheralHandler handler)
75 | {
76 | try
77 | {
78 | Class stepHandler = Class.forName("me.ichun.mods.blocksteps.common.blockaid.BlockStepHandler");
79 | ((HashMap)ObfuscationReflectionHelper.getPrivateValue(stepHandler, null, "blockPeripheralRegistry")).put(clz, handler);
80 | }
81 | catch(Exception e)
82 | {
83 | System.out.println("[Blocksteps] Error registering block peripheral handler");
84 | e.printStackTrace();
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/Blocksteps.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common;
2 |
3 | import me.ichun.mods.blocksteps.common.core.Config;
4 | import me.ichun.mods.blocksteps.common.core.EventHandlerClient;
5 | import me.ichun.mods.blocksteps.common.entity.EntityWaypoint;
6 | import me.ichun.mods.blocksteps.common.render.RenderWaypoint;
7 | import me.ichun.mods.ichunutil.common.core.Logger;
8 | import me.ichun.mods.ichunutil.common.core.config.ConfigHandler;
9 | import me.ichun.mods.ichunutil.common.iChunUtil;
10 | import me.ichun.mods.ichunutil.common.module.update.UpdateChecker;
11 | import net.minecraftforge.common.MinecraftForge;
12 | import net.minecraftforge.fml.client.registry.RenderingRegistry;
13 | import net.minecraftforge.fml.common.Mod;
14 | import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
15 |
16 | @Mod(modid = Blocksteps.MOD_NAME, name = Blocksteps.MOD_NAME, clientSideOnly = true,
17 | version = Blocksteps.VERSION,
18 | guiFactory = "me.ichun.mods.ichunutil.common.core.config.GenericModGuiFactory",
19 | dependencies = "required-after:iChunUtil@[" + iChunUtil.VERSION_MAJOR +".0.0," + (iChunUtil.VERSION_MAJOR + 1) + ".0.0)",
20 | acceptableRemoteVersions = "*"
21 | )
22 | public class Blocksteps
23 | {
24 | public static final String VERSION = iChunUtil.VERSION_MAJOR + ".0.0";
25 | public static final String MOD_NAME = "Blocksteps";
26 | public static final String MOD_ID = "blocksteps";
27 |
28 | public static final Logger LOGGER = Logger.createLogger(MOD_NAME);
29 |
30 | @Mod.Instance(MOD_ID)
31 | public static Blocksteps instance;
32 |
33 | public static Config config;
34 |
35 | public static EventHandlerClient eventHandler;
36 |
37 | @Mod.EventHandler
38 | public void preInit(FMLPreInitializationEvent event)
39 | {
40 | config = ConfigHandler.registerConfig(new Config(event.getSuggestedConfigurationFile()));
41 |
42 | eventHandler = new EventHandlerClient();
43 | MinecraftForge.EVENT_BUS.register(eventHandler);
44 |
45 | RenderingRegistry.registerEntityRenderingHandler(EntityWaypoint.class, new RenderWaypoint.RenderFactory());
46 |
47 | UpdateChecker.registerMod(new UpdateChecker.ModVersionInfo(MOD_NAME, iChunUtil.VERSION_OF_MC, VERSION, true));
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/BlockStepHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
5 | import me.ichun.mods.blocksteps.common.blockaid.handler.periphs.*;
6 | import net.minecraft.block.*;
7 | import net.minecraft.block.material.Material;
8 | import net.minecraft.block.state.IBlockState;
9 | import net.minecraft.client.Minecraft;
10 | import net.minecraft.client.multiplayer.WorldClient;
11 | import net.minecraft.entity.Entity;
12 | import net.minecraft.entity.player.EntityPlayer;
13 | import net.minecraft.init.Blocks;
14 | import net.minecraft.util.math.BlockPos;
15 | import net.minecraft.world.World;
16 |
17 | import java.util.ArrayList;
18 | import java.util.HashMap;
19 | import java.util.List;
20 |
21 | import static net.minecraft.util.EnumBlockRenderType.ENTITYBLOCK_ANIMATED;
22 |
23 | public class BlockStepHandler
24 | {
25 | public static void handleStep(Entity entity, List steps)
26 | {
27 | if(entity == Minecraft.getMinecraft().thePlayer && !entity.onGround || !(entity instanceof EntityPlayer) && !(entity.riddenByEntity instanceof EntityPlayer))
28 | {
29 | return;
30 | }
31 |
32 | BlockPos pos;
33 | if(entity.getEntityBoundingBox().minY % 1 == 0)
34 | {
35 | pos = new BlockPos(entity.posX, entity.posY - 1, entity.posZ);
36 | }
37 | else
38 | {
39 | pos = new BlockPos(entity.posX, entity.posY, entity.posZ);
40 | }
41 | pos = adjustIfBlockIsPeripheral(entity.worldObj, pos);
42 | boolean add = true;
43 | if(!steps.isEmpty())
44 | {
45 | BlockPos lastPos = steps.get(steps.size() - 1);
46 | if((entity != Minecraft.getMinecraft().thePlayer && entity != Minecraft.getMinecraft().thePlayer.getRidingEntity()) && steps.contains(pos) || lastPos.equals(pos))
47 | {
48 | add = false;
49 | }
50 | }
51 | if(add)
52 | {
53 | IBlockState state = entity.worldObj.getBlockState(pos);
54 | if(state.getBlock().isAir(state, entity.worldObj, pos) || !(state.getBlock().isNormalCube(state, entity.worldObj, pos) || isAcceptableBlockType(state, state.getBlock()) || !(entity instanceof EntityPlayer) && (entity.riddenByEntity instanceof EntityPlayer) && BlockLiquid.class.isInstance(state.getBlock())))
55 | {
56 | add = false;
57 | }
58 | }
59 | if(add)
60 | {
61 | if(Blocksteps.eventHandler.renderGlobalProxy != null && !steps.contains(pos))
62 | {
63 | Blocksteps.eventHandler.renderGlobalProxy.markBlockForUpdate(pos);
64 | Blocksteps.eventHandler.repopulateBlocksToRender = true;
65 | }
66 | while(steps.contains(pos))
67 | {
68 | steps.remove(pos);
69 | }
70 | if(!steps.isEmpty() && (entity != Minecraft.getMinecraft().thePlayer && entity != Minecraft.getMinecraft().thePlayer.getRidingEntity()))
71 | {
72 | steps.add(steps.size() - 1, pos); //add it before the latest one so that the latest is always the player's.
73 | }
74 | else
75 | {
76 | steps.add(pos);
77 | }
78 | BlockStepHandler.getBlocksToRender(true, pos);
79 | }
80 | }
81 |
82 | public static BlockPos adjustIfBlockIsPeripheral(World world, BlockPos pos)
83 | {
84 | IBlockState state = world.getBlockState(pos);
85 | if(isBlockTypePeripheral(world, pos, state.getBlock(), state, DUMMY_AVAILABLES) && !getBlockPeripheralHandler(state.getBlock()).isAlsoSolidBlock())
86 | {
87 | return pos.add(0, -1, 0);
88 | }
89 | return pos;
90 | }
91 |
92 | public static void getBlocksToRender(boolean markUpdate, BlockPos...poses)
93 | {
94 | Minecraft mc = Minecraft.getMinecraft();
95 | WorldClient world = mc.theWorld;
96 | for(BlockPos pos : poses)
97 | {
98 | List renderPos = Blocksteps.eventHandler.blocksToRenderByStep.get(pos);
99 | renderPos.clear();
100 |
101 | if(Blocksteps.config.stepRadius > 1)
102 | {
103 | int radius = Blocksteps.config.stepRadius - 1;
104 | for(int i = -radius; i <= radius; i++)
105 | {
106 | for(int j = -radius; j <= radius; j++)
107 | {
108 | for(int k = -radius; k <= radius; k++)
109 | {
110 | if(!(i == 0 && j == 0 && k == 0))
111 | {
112 | BlockPos newPos = pos.add(i, j, k);
113 | IBlockState state = world.getBlockState(newPos);
114 | if(!(state.getBlock().isAir(state, world, newPos) || !(state.getBlock().isNormalCube(state, world, newPos) || isAcceptableBlockType(state, state.getBlock()) || BlockLiquid.class.isInstance(state.getBlock()))))
115 | {
116 | renderPos.add(newPos);
117 | }
118 | }
119 | }
120 | }
121 | }
122 | }
123 |
124 | if(!renderPos.contains(pos))
125 | {
126 | renderPos.add(pos);
127 | }
128 |
129 | addPeripherals(world, pos, renderPos);
130 |
131 | if(markUpdate)
132 | {
133 | for(BlockPos bpos : renderPos)
134 | {
135 | Blocksteps.eventHandler.renderGlobalProxy.markBlockForUpdate(bpos);
136 | }
137 | }
138 | }
139 | }
140 |
141 | public static void addPeripherals(World world, BlockPos oriPos, List renderPos)
142 | {
143 | addPeripherals(world, oriPos, renderPos, true);
144 | }
145 |
146 | public static void addPeripherals(World world, BlockPos oriPos, List renderPos, boolean useThread)
147 | {
148 | if(Blocksteps.config.stepPeripherals == 1)
149 | {
150 | ArrayList periphs = new ArrayList();
151 | for(BlockPos pos : renderPos)
152 | {
153 | BlockPos periph = pos.add(0, 1, 0);
154 | IBlockState state = world.getBlockState(periph);
155 | if(isBlockTypePeripheral(world, periph, state.getBlock(), state, renderPos))
156 | {
157 | if(getBlockPeripheralHandler(state.getBlock()).requireThread() && Blocksteps.eventHandler.threadCheckBlocks != null && useThread)
158 | // if(useThread)
159 | {
160 | synchronized(Blocksteps.eventHandler.threadCheckBlocks.checks)
161 | {
162 | Blocksteps.eventHandler.threadCheckBlocks.checks.add(new CheckBlockInfo(world, oriPos, periph, state, getBlockPeripheralHandler(state.getBlock()), renderPos));
163 | }
164 | }
165 | else
166 | {
167 | List poses = getBlockPeripheralHandler(state.getBlock()).getRelativeBlocks(world, periph, state, renderPos);
168 | for(BlockPos pos1 : poses)
169 | {
170 | if(!periphs.contains(pos1) && !renderPos.contains(pos1))
171 | {
172 | periphs.add(pos1);
173 | }
174 | }
175 | }
176 | }
177 | }
178 | renderPos.addAll(periphs);
179 | }
180 | }
181 |
182 | public static boolean isAcceptableBlockType(IBlockState state, Block block)
183 | {
184 | return block.getRenderType(state) == ENTITYBLOCK_ANIMATED || block.getMaterial(state) == Material.GLASS || block == Blocks.GLOWSTONE || block == Blocks.WATERLILY || block == Blocks.FARMLAND || block == Blocks.TNT || block == Blocks.ICE || block instanceof BlockSlab || block instanceof BlockStairs;
185 | }
186 |
187 | public static boolean isBlockTypePeripheral(World world, BlockPos pos, Block block, IBlockState state, List availableBlocks)
188 | {
189 | BlockPeripheralHandler handler = getBlockPeripheralHandler(block);
190 | return handler != null && handler.isValidPeripheral(world, pos, state, availableBlocks);
191 | }
192 |
193 | public static BlockPeripheralHandler getBlockPeripheralHandler(Block block)
194 | {
195 | Class clz = block.getClass();
196 | while(clz != Block.class)
197 | {
198 | if(blockPeripheralRegistry.containsKey(clz))
199 | {
200 | return blockPeripheralRegistry.get(clz);
201 | }
202 | clz = clz.getSuperclass();
203 | }
204 | return null;
205 | }
206 |
207 | public static HashMap, BlockPeripheralHandler> blockPeripheralRegistry = new HashMap, BlockPeripheralHandler>();
208 |
209 | public static final ArrayList DUMMY_AVAILABLES = new ArrayList();
210 | public static final GenericHandler DEFAULT_GENERIC_HANDLER = new GenericHandler();
211 | public static final GenericDenyHandler DEFAULT_GENERIC_DENY_HANDLER = new GenericDenyHandler();
212 |
213 | static
214 | {
215 | blockPeripheralRegistry.put(BlockAnvil.class, DEFAULT_GENERIC_HANDLER);
216 | blockPeripheralRegistry.put(BlockBasePressurePlate.class, DEFAULT_GENERIC_HANDLER);
217 | blockPeripheralRegistry.put(BlockBanner.class, DEFAULT_GENERIC_HANDLER);
218 | blockPeripheralRegistry.put(BlockBeacon.class, DEFAULT_GENERIC_HANDLER);
219 | blockPeripheralRegistry.put(BlockBrewingStand.class, DEFAULT_GENERIC_HANDLER);
220 | blockPeripheralRegistry.put(BlockCake.class, DEFAULT_GENERIC_HANDLER);
221 | blockPeripheralRegistry.put(BlockCarpet.class, DEFAULT_GENERIC_HANDLER);
222 | blockPeripheralRegistry.put(BlockCauldron.class, DEFAULT_GENERIC_HANDLER);
223 | blockPeripheralRegistry.put(BlockDragonEgg.class, DEFAULT_GENERIC_HANDLER);
224 | blockPeripheralRegistry.put(BlockDaylightDetector.class, DEFAULT_GENERIC_HANDLER);
225 | blockPeripheralRegistry.put(BlockEnderChest.class, DEFAULT_GENERIC_HANDLER);
226 | blockPeripheralRegistry.put(BlockEnchantmentTable.class, DEFAULT_GENERIC_HANDLER);
227 | blockPeripheralRegistry.put(BlockFenceGate.class, DEFAULT_GENERIC_HANDLER);
228 | blockPeripheralRegistry.put(BlockFire.class, DEFAULT_GENERIC_HANDLER);
229 | blockPeripheralRegistry.put(BlockFlowerPot.class, DEFAULT_GENERIC_HANDLER);
230 | blockPeripheralRegistry.put(BlockGrass.class, DEFAULT_GENERIC_HANDLER);
231 | blockPeripheralRegistry.put(BlockHopper.class, DEFAULT_GENERIC_HANDLER);
232 | blockPeripheralRegistry.put(BlockJukebox.class, DEFAULT_GENERIC_HANDLER);
233 | blockPeripheralRegistry.put(BlockLeaves.class, DEFAULT_GENERIC_HANDLER);
234 | blockPeripheralRegistry.put(BlockMelon.class, DEFAULT_GENERIC_HANDLER);
235 | blockPeripheralRegistry.put(BlockNote.class, DEFAULT_GENERIC_HANDLER);
236 | blockPeripheralRegistry.put(BlockPumpkin.class, DEFAULT_GENERIC_HANDLER);
237 | blockPeripheralRegistry.put(BlockRailBase.class, DEFAULT_GENERIC_HANDLER);
238 | blockPeripheralRegistry.put(BlockRedstoneDiode.class, DEFAULT_GENERIC_HANDLER);
239 | blockPeripheralRegistry.put(BlockRedstoneWire.class, DEFAULT_GENERIC_HANDLER);
240 | blockPeripheralRegistry.put(BlockSapling.class, DEFAULT_GENERIC_HANDLER);
241 | blockPeripheralRegistry.put(BlockSign.class, DEFAULT_GENERIC_HANDLER);
242 | blockPeripheralRegistry.put(BlockSkull.class, DEFAULT_GENERIC_HANDLER);
243 | blockPeripheralRegistry.put(BlockSnow.class, DEFAULT_GENERIC_HANDLER);
244 | blockPeripheralRegistry.put(BlockTrapDoor.class, DEFAULT_GENERIC_HANDLER);
245 | blockPeripheralRegistry.put(BlockTripWire.class, DEFAULT_GENERIC_HANDLER);
246 | blockPeripheralRegistry.put(BlockWall.class, DEFAULT_GENERIC_HANDLER);
247 | blockPeripheralRegistry.put(BlockWorkbench.class, DEFAULT_GENERIC_HANDLER);
248 |
249 | blockPeripheralRegistry.put(BlockLilyPad.class, DEFAULT_GENERIC_DENY_HANDLER);
250 |
251 | blockPeripheralRegistry.put(BlockBush.class, new VerticalGenericHandler(BlockBush.class, 2));
252 | blockPeripheralRegistry.put(BlockCactus.class, new VerticalGenericHandler(BlockCactus.class, 5));
253 | blockPeripheralRegistry.put(BlockCrops.class, new VerticalGenericHandler(BlockCrops.class, 2));
254 | blockPeripheralRegistry.put(BlockDoor.class, new VerticalGenericHandler(BlockDoor.class, 2));
255 | blockPeripheralRegistry.put(BlockLiquid.class, new VerticalGenericHandler(BlockLiquid.class, 15));
256 | blockPeripheralRegistry.put(BlockReed.class, new VerticalGenericHandler(BlockReed.class, 5));
257 |
258 | blockPeripheralRegistry.put(BlockBed.class, new HorizontalGenericHandler(BlockBed.class));
259 | blockPeripheralRegistry.put(BlockChest.class, new HorizontalGenericHandler(BlockChest.class));
260 |
261 | blockPeripheralRegistry.put(BlockPane.class, new SideSolidBlockHandler(BlockPane.class, 5));
262 | blockPeripheralRegistry.put(BlockFence.class, new SideSolidBlockHandler(BlockFence.class, 5));
263 |
264 | blockPeripheralRegistry.put(BlockButton.class, new ButtonHandler());
265 | blockPeripheralRegistry.put(BlockEndPortalFrame.class, new EndPortalHandler());
266 | blockPeripheralRegistry.put(BlockHugeMushroom.class, new MushroomHandler());
267 | blockPeripheralRegistry.put(BlockLog.class, new LogHandler());
268 | blockPeripheralRegistry.put(BlockLadder.class, new LadderHandler());
269 | blockPeripheralRegistry.put(BlockLever.class, new LeverHandler());
270 | blockPeripheralRegistry.put(BlockObsidian.class, new ObsidianHandler());
271 | blockPeripheralRegistry.put(BlockPortal.class, new PortalHandler());
272 | blockPeripheralRegistry.put(BlockTorch.class, new TorchHandler());
273 | blockPeripheralRegistry.put(BlockTripWireHook.class, new TripWireHookHandler());
274 | }
275 | }
276 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/CheckBlockInfo.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.world.World;
8 |
9 | import java.util.List;
10 |
11 | public class CheckBlockInfo
12 | {
13 | public final World world;
14 | public final BlockPos oriPos;
15 | public final BlockPos pos;
16 | public final IBlockState state;
17 | public final BlockPeripheralHandler handler;
18 | public final List availableBlocks;
19 | public List blocksToRender;
20 |
21 | public CheckBlockInfo(World world, BlockPos oriPos, BlockPos pos, IBlockState state, BlockPeripheralHandler handler, List availableBlocks)
22 | {
23 | this.world = world;
24 | this.oriPos = oriPos;
25 | this.pos = pos;
26 | this.state = state;
27 | this.handler = handler;
28 | this.availableBlocks = availableBlocks;
29 | }
30 |
31 | public void doCheck()
32 | {
33 | blocksToRender = handler.getRelativeBlocks(world, pos, state, availableBlocks);
34 | synchronized(Blocksteps.eventHandler.blocksToAdd)
35 | {
36 | Blocksteps.eventHandler.blocksToAdd.add(this);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/ButtonHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockButton;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.util.EnumFacing;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.List;
11 |
12 | public class ButtonHandler extends BlockPeripheralHandler
13 | {
14 | @Override
15 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
16 | {
17 | EnumFacing enumfacing = (EnumFacing)state.getValue(BlockButton.FACING);
18 |
19 | return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/EndPortalHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockEndPortal;
5 | import net.minecraft.block.BlockEndPortalFrame;
6 | import net.minecraft.block.state.IBlockState;
7 | import net.minecraft.util.math.BlockPos;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class EndPortalHandler extends BlockPeripheralHandler
14 | {
15 | @Override
16 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
17 | {
18 | return true;
19 | }
20 |
21 | @Override
22 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
23 | {
24 | ArrayList poses = new ArrayList();
25 |
26 | for(int i = -4; i <= 4; i++)
27 | {
28 | for(int k = -4; k <= 4; k++)
29 | {
30 | BlockPos newPos = pos.add(i, 0, k);
31 | if(BlockEndPortalFrame.class.isInstance(world.getBlockState(newPos).getBlock()) || BlockEndPortal.class.isInstance(world.getBlockState(newPos).getBlock()))
32 | {
33 | poses.add(newPos);
34 | }
35 | }
36 | }
37 | return poses;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/GenericDenyHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.state.IBlockState;
5 | import net.minecraft.util.math.BlockPos;
6 | import net.minecraft.world.IBlockAccess;
7 |
8 | import java.util.List;
9 |
10 | public class GenericDenyHandler extends BlockPeripheralHandler
11 | {
12 | @Override
13 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
14 | {
15 | return false;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/GenericHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.state.IBlockState;
5 | import net.minecraft.util.math.BlockPos;
6 | import net.minecraft.world.IBlockAccess;
7 |
8 | import java.util.List;
9 |
10 | public class GenericHandler extends BlockPeripheralHandler
11 | {
12 | @Override
13 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
14 | {
15 | return true;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/HorizontalGenericHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.Block;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.world.IBlockAccess;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class HorizontalGenericHandler extends BlockPeripheralHandler
13 | {
14 | public final Class extends Block> blockType;
15 |
16 | public HorizontalGenericHandler(Class extends Block> blockType)
17 | {
18 | this.blockType = blockType;
19 | }
20 |
21 | @Override
22 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
23 | {
24 | ArrayList poses = new ArrayList();
25 | poses.add(pos);
26 |
27 | boolean flag = false;
28 | for(int i = -1; i <= 1; i++)
29 | {
30 | if(!flag)
31 | {
32 | for(int k = -1; k <= 1; k++)
33 | {
34 | if(!(i == 0 && k == 0))
35 | {
36 | BlockPos newPos = pos.add(i, 0, k);
37 | if(blockType.isInstance(world.getBlockState(newPos).getBlock()))
38 | {
39 | poses.add(newPos);
40 | poses.add(newPos.add(0, -1, 0));
41 | flag = true;
42 | break;
43 | }
44 | }
45 | }
46 | }
47 | }
48 | return poses;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/LadderHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockLadder;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.util.EnumFacing;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class LadderHandler extends BlockPeripheralHandler
14 | {
15 | @Override
16 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
17 | {
18 | EnumFacing enumfacing = (EnumFacing)state.getValue(BlockLadder.FACING);
19 |
20 | return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
21 | }
22 |
23 | @Override
24 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
25 | {
26 | EnumFacing enumfacing = (EnumFacing)state.getValue(BlockLadder.FACING);
27 | ArrayList poses = new ArrayList();
28 | poses.add(pos);
29 | poses.add(pos.offset(enumfacing.getOpposite()));
30 |
31 | int height = 100;
32 | BlockPos highPos = pos;
33 | while(height > 1)
34 | {
35 | highPos = highPos.add(0, 1, 0);
36 | IBlockState state1 = world.getBlockState(highPos);
37 | if(BlockLadder.class.isInstance(state1.getBlock()))
38 | {
39 | EnumFacing enumfacing1 = (EnumFacing)state1.getValue(BlockLadder.FACING);
40 | poses.add(highPos);
41 | poses.add(highPos.offset(enumfacing1.getOpposite()));
42 | height--;
43 | }
44 | else
45 | {
46 | break;
47 | }
48 | }
49 | return poses;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/LeverHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockLever;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.util.EnumFacing;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.List;
11 |
12 | public class LeverHandler extends BlockPeripheralHandler
13 | {
14 | @Override
15 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
16 | {
17 | EnumFacing enumfacing = ((BlockLever.EnumOrientation)state.getValue(BlockLever.FACING)).getFacing();
18 |
19 | return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/LogHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
5 | import net.minecraft.block.BlockLeaves;
6 | import net.minecraft.block.BlockLog;
7 | import net.minecraft.block.state.IBlockState;
8 | import net.minecraft.util.math.BlockPos;
9 | import net.minecraft.world.IBlockAccess;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class LogHandler extends BlockPeripheralHandler
15 | {
16 | @Override
17 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
18 | {
19 | return true;
20 | }
21 |
22 | @Override
23 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
24 | {
25 | ArrayList poses = new ArrayList();
26 | ArrayList tried = new ArrayList();
27 |
28 |
29 | int tries = Blocksteps.config.treeDetection == 1 ? 100 : 0;
30 | int j = -2;
31 | while(tries > 0)
32 | {
33 | tries = getLeavesAndWood(world, pos.add(0, j, 0), poses, tried, tries);
34 | tries--;
35 | j++;
36 | }
37 |
38 | if(!poses.contains(pos))
39 | {
40 | poses.add(pos);
41 | }
42 |
43 | return poses;
44 | }
45 |
46 | public int getLeavesAndWood(IBlockAccess world, BlockPos pos, ArrayList poses, ArrayList tried, int triesLeft)
47 | {
48 | tried.add(pos);
49 |
50 | for(int i = -5; i <= 5; i++)
51 | {
52 | for(int k = -5; k <= 5; k++)
53 | {
54 | BlockPos newPos = pos.add(i, 0, k);
55 | if(BlockLog.class.isInstance(world.getBlockState(newPos).getBlock()))
56 | {
57 | if(!poses.contains(newPos))
58 | {
59 | poses.add(newPos);
60 | }
61 | if(!tried.contains(newPos))
62 | {
63 | triesLeft = getLeavesAndWood(world, newPos, poses, tried, triesLeft);
64 | }
65 | }
66 | else if(BlockLeaves.class.isInstance(world.getBlockState(newPos).getBlock()))
67 | {
68 | if(!poses.contains(newPos))
69 | {
70 | poses.add(newPos);
71 | }
72 | }
73 | }
74 | }
75 | return triesLeft - 1;
76 | }
77 |
78 | @Override
79 | public boolean requireThread()
80 | {
81 | return true;
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/MushroomHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockHugeMushroom;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.world.IBlockAccess;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class MushroomHandler extends BlockPeripheralHandler
13 | {
14 | @Override
15 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
16 | {
17 | return true;
18 | }
19 |
20 | @Override
21 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
22 | {
23 | ArrayList poses = new ArrayList();
24 | ArrayList tried = new ArrayList();
25 |
26 |
27 | int tries = 100;
28 | int j = -2;
29 | while(tries > 0)
30 | {
31 | tries = getLeavesAndWood(world, pos.add(0, j, 0), poses, tried, tries);
32 | tries--;
33 | j++;
34 | }
35 |
36 | if(!poses.contains(pos))
37 | {
38 | poses.add(pos);
39 | }
40 |
41 | return poses;
42 | }
43 |
44 | public int getLeavesAndWood(IBlockAccess world, BlockPos pos, ArrayList poses, ArrayList tried, int triesLeft)
45 | {
46 | tried.add(pos);
47 |
48 | for(int i = -5; i <= 5; i++)
49 | {
50 | for(int k = -5; k <= 5; k++)
51 | {
52 | BlockPos newPos = pos.add(i, 0, k);
53 | if(BlockHugeMushroom.class.isInstance(world.getBlockState(newPos).getBlock()))
54 | {
55 | if(!poses.contains(newPos))
56 | {
57 | poses.add(newPos);
58 | }
59 | if(!tried.contains(newPos))
60 | {
61 | triesLeft = getLeavesAndWood(world, newPos, poses, tried, triesLeft);
62 | }
63 | }
64 | }
65 | }
66 | return triesLeft - 1;
67 | }
68 |
69 | @Override
70 | public boolean isAlsoSolidBlock()
71 | {
72 | return true;
73 | }
74 |
75 | @Override
76 | public boolean requireThread()
77 | {
78 | return true;
79 | }
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/ObsidianHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import me.ichun.mods.blocksteps.common.Blocksteps;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.init.Blocks;
7 | import net.minecraft.util.math.BlockPos;
8 | import net.minecraft.world.IBlockAccess;
9 | import net.minecraft.world.World;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class ObsidianHandler extends BlockPeripheralHandler
15 | {
16 | @Override
17 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
18 | {
19 | return Blocksteps.config.endTowerDetection == 1 && world instanceof World && ((World)world).provider.getDimension() == 1;
20 | }
21 |
22 | @Override
23 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
24 | {
25 | ArrayList poses = new ArrayList();
26 |
27 | if(world instanceof World && ((World)world).provider.getDimension() == 1)
28 | {
29 | for(int j = 0; j <= 100; j++)
30 | {
31 | for(int i = -7; i <= 7; i++)
32 | {
33 | for(int k = -7; k <= 7; k++)
34 | {
35 | BlockPos newPos = pos.add(i, j, k);
36 | if(world.getBlockState(newPos).getBlock() == Blocks.OBSIDIAN || world.getBlockState(newPos).getBlock() == Blocks.BEDROCK || world.getBlockState(newPos).getBlock() == Blocks.FIRE)
37 | {
38 | poses.add(newPos);
39 | }
40 | }
41 | }
42 | }
43 | }
44 | return poses;
45 | }
46 |
47 | @Override
48 | public boolean isAlsoSolidBlock()
49 | {
50 | return true;
51 | }
52 |
53 | @Override
54 | public boolean requireThread()
55 | {
56 | return true;
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/PortalHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockPortal;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.init.Blocks;
7 | import net.minecraft.util.math.BlockPos;
8 | import net.minecraft.util.EnumFacing;
9 | import net.minecraft.world.IBlockAccess;
10 |
11 | import java.util.ArrayList;
12 | import java.util.List;
13 |
14 | public class PortalHandler extends BlockPeripheralHandler
15 | {
16 | @Override
17 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
18 | {
19 | return true;
20 | }
21 |
22 | @Override
23 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
24 | {
25 | EnumFacing.Axis axis = (EnumFacing.Axis)state.getValue(BlockPortal.AXIS);
26 | ArrayList poses = new ArrayList();
27 | poses.add(pos);
28 |
29 | for(int j = -1; j <= 21; j++)
30 | {
31 | boolean hasPortal = false;
32 | for(int i = 0; i <= 21; i++)
33 | {
34 | if(!(i == 0 && j == 0))
35 | {
36 | BlockPos newPos;
37 | if(axis == EnumFacing.Axis.X)
38 | {
39 | newPos = pos.add(-i, j, 0);
40 | }
41 | else
42 | {
43 | newPos = pos.add(0, j, -i);
44 | }
45 | IBlockState newState = world.getBlockState(newPos);
46 | if(newState.getBlock() == Blocks.OBSIDIAN)
47 | {
48 | poses.add(newPos);
49 | if(hasPortal && j != -1)
50 | {
51 | break;
52 | }
53 | }
54 | else if(newState.getBlock() == Blocks.PORTAL)
55 | {
56 | poses.add(newPos);
57 | hasPortal = true;
58 | }
59 | }
60 | }
61 | for(int i = 0; i <= 21; i++)
62 | {
63 | if(!(i == 0 && j == 0))
64 | {
65 | BlockPos newPos;
66 | if(axis == EnumFacing.Axis.X)
67 | {
68 | newPos = pos.add(i, j, 0);
69 | }
70 | else
71 | {
72 | newPos = pos.add(0, j, i);
73 | }
74 | IBlockState newState = world.getBlockState(newPos);
75 | if(newState.getBlock() == Blocks.OBSIDIAN)
76 | {
77 | poses.add(newPos);
78 | if(hasPortal && j != -1)
79 | {
80 | break;
81 | }
82 | }
83 | else if(newState.getBlock() == Blocks.PORTAL)
84 | {
85 | poses.add(newPos);
86 | hasPortal = true;
87 | }
88 | }
89 | }
90 | if(!hasPortal && j != -1)
91 | {
92 | break;
93 | }
94 | }
95 |
96 | return poses;
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/SideSolidBlockHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.Block;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.util.EnumFacing;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.ArrayList;
11 | import java.util.List;
12 |
13 | public class SideSolidBlockHandler extends BlockPeripheralHandler
14 | {
15 | public final Class extends Block> blockType;
16 | public final int checkHeight;
17 |
18 | public SideSolidBlockHandler(Class extends Block> blockType, int checkHeight)
19 | {
20 | this.blockType = blockType;
21 | this.checkHeight = checkHeight;
22 | }
23 |
24 | @Override
25 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
26 | {
27 | ArrayList poses = new ArrayList();
28 | poses.add(pos);
29 |
30 | int height = checkHeight;
31 | BlockPos highPos = pos;
32 | while(height > 1)
33 | {
34 | if(blockType.isInstance(world.getBlockState(highPos).getBlock()))
35 | {
36 | poses.add(highPos);
37 | for(EnumFacing face : EnumFacing.Plane.HORIZONTAL.facings())
38 | {
39 | BlockPos sidePos = highPos.offset(face);
40 | IBlockState sideState = world.getBlockState(sidePos);
41 | if(!sideState.getBlock().isAir(sideState, world, sidePos) && sideState.getBlock().isNormalCube(sideState, world, sidePos))
42 | {
43 | poses.add(sidePos);
44 | }
45 | }
46 | height--;
47 | highPos = highPos.add(0, 1, 0);
48 | }
49 | else
50 | {
51 | break;
52 | }
53 | }
54 | return poses;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/TorchHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockTorch;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.util.EnumFacing;
8 | import net.minecraft.world.IBlockAccess;
9 |
10 | import java.util.List;
11 |
12 | public class TorchHandler extends BlockPeripheralHandler
13 | {
14 | @Override
15 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
16 | {
17 | EnumFacing enumfacing = (EnumFacing)state.getValue(BlockTorch.FACING);
18 |
19 | return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/TripWireHookHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.BlockLever;
5 | import net.minecraft.block.BlockTripWireHook;
6 | import net.minecraft.block.state.IBlockState;
7 | import net.minecraft.util.math.BlockPos;
8 | import net.minecraft.util.EnumFacing;
9 | import net.minecraft.world.IBlockAccess;
10 |
11 | import java.util.List;
12 |
13 | public class TripWireHookHandler extends BlockPeripheralHandler
14 | {
15 | @Override
16 | public boolean isValidPeripheral(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
17 | {
18 | EnumFacing enumfacing = state.getValue(BlockTripWireHook.FACING);
19 |
20 | return availableBlocks.contains(pos.offset(enumfacing.getOpposite()));
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/blockaid/handler/periphs/VerticalGenericHandler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.blockaid.handler.periphs;
2 |
3 | import me.ichun.mods.blocksteps.api.BlockPeripheralHandler;
4 | import net.minecraft.block.Block;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.util.math.BlockPos;
7 | import net.minecraft.world.IBlockAccess;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | public class VerticalGenericHandler extends BlockPeripheralHandler
13 | {
14 | public final Class extends Block> blockType;
15 | public final int checkHeight;
16 |
17 | public VerticalGenericHandler(Class extends Block> blockType, int checkHeight)
18 | {
19 | this.blockType = blockType;
20 | this.checkHeight = checkHeight;
21 | }
22 |
23 | @Override
24 | public List getRelativeBlocks(IBlockAccess world, BlockPos pos, IBlockState state, List availableBlocks)
25 | {
26 | ArrayList poses = new ArrayList();
27 | poses.add(pos);
28 |
29 | int height = checkHeight;
30 | BlockPos highPos = pos;
31 | while(height > 1)
32 | {
33 | highPos = highPos.add(0, 1, 0);
34 | if(blockType.isInstance(world.getBlockState(highPos).getBlock()))
35 | {
36 | poses.add(highPos);
37 | height--;
38 | }
39 | else
40 | {
41 | break;
42 | }
43 | }
44 | return poses;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/core/ChunkStore.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.core;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import net.minecraft.util.math.BlockPos;
5 | import net.minecraft.util.math.ChunkPos;
6 |
7 | import java.util.HashMap;
8 | import java.util.HashSet;
9 | import java.util.List;
10 |
11 | public class ChunkStore
12 | {
13 | public static HashMap> chunkCache = new HashMap<>();
14 |
15 | public static void addBlocks(List blockPoses)
16 | {
17 | for(BlockPos pos : blockPoses)
18 | {
19 | ChunkPos coord = new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4);
20 | HashSet poses = chunkCache.get(coord);
21 | if(poses == null)
22 | {
23 | poses = new HashSet();
24 | chunkCache.put(coord, poses);
25 | }
26 | poses.add(pos);
27 | }
28 | }
29 |
30 | public static boolean contains(BlockPos pos)
31 | {
32 | ChunkPos coord = new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4);
33 | if(Blocksteps.config.mapType == 2)
34 | {
35 | synchronized(Blocksteps.eventHandler.threadCrawlBlocks.surface)
36 | {
37 | HashSet poses = chunkCache.get(coord);
38 | HashSet surface = Blocksteps.eventHandler.threadCrawlBlocks.surface.get(coord);
39 | return poses != null && poses.contains(pos) || surface != null && surface.contains(pos);
40 | }
41 | }
42 | else
43 | {
44 | HashSet poses = chunkCache.get(coord);
45 | if(poses != null)
46 | {
47 | return poses.contains(pos);
48 | }
49 | }
50 | return false;
51 | }
52 |
53 | public static void clear()
54 | {
55 | chunkCache.clear();
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/core/Config.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.core;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.ichunutil.client.keybind.KeyBind;
5 | import me.ichun.mods.ichunutil.common.core.config.ConfigBase;
6 | import me.ichun.mods.ichunutil.common.core.config.annotations.ConfigProp;
7 | import me.ichun.mods.ichunutil.common.core.config.annotations.IntBool;
8 | import me.ichun.mods.ichunutil.common.core.config.annotations.IntMinMax;
9 | import me.ichun.mods.ichunutil.common.core.config.types.Colour;
10 | import net.minecraftforge.fml.relauncher.Side;
11 | import org.lwjgl.input.Keyboard;
12 |
13 | import java.io.File;
14 |
15 | public class Config extends ConfigBase
16 | {
17 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
18 | @IntMinMax(min = 0, max = 10000000)
19 | public int renderBlockCount = 100000;
20 |
21 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
22 | @IntMinMax(min = 0, max = 32)
23 | public int renderDistance = 6;
24 |
25 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
26 | @IntBool
27 | public int renderSky = 1;
28 |
29 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
30 | @IntMinMax(min = 1, max = 1000)
31 | public int renderSkySize = 75;
32 |
33 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
34 | @IntBool
35 | public int renderCompass = 0;
36 |
37 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
38 | @IntMinMax(min = 200)
39 | public int saveInterval = 20 * 60 * 5;
40 |
41 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
42 | @IntBool
43 | public int trackOtherPlayers = 0;
44 |
45 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
46 | @IntBool
47 | public int hideNamePlates = 0;
48 |
49 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
50 | @IntBool
51 | public int lockMapToHeadYaw = 0;
52 |
53 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
54 | @IntBool
55 | public int lockMapToHeadPitch = 0;
56 |
57 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
58 | @IntMinMax(min = 1, max = 15)
59 | public int stepRadius = 3;
60 |
61 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
62 | @IntBool
63 | public int stepPeripherals = 1;
64 |
65 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
66 | @IntBool
67 | public int treeDetection = 1;
68 |
69 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
70 | @IntBool
71 | public int endTowerDetection = 1;
72 |
73 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
74 | @IntBool
75 | public int brightMap = 0;
76 |
77 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
78 | @IntBool
79 | public int waypointOnDeath = 0;
80 |
81 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
82 | @IntBool
83 | public int waypointIndicator = 1;
84 |
85 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
86 | @IntBool
87 | public int waypointIndicatorThroughBlocks = 0;
88 |
89 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
90 | @IntBool
91 | public int waypointLabelThroughBlocks = 1;
92 |
93 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
94 | @IntMinMax(min = 0)
95 | public int waypointLabelSize = 20;
96 |
97 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
98 | @IntMinMax(min = 0)
99 | public int waypointBeamHeightAdjust = 15;
100 |
101 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
102 | @IntBool
103 | public int waypointRenderInWorld = 1;
104 |
105 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
106 | @IntMinMax(min = -180, max = 180)
107 | public int camStartHorizontal = 45;
108 |
109 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
110 | @IntMinMax(min = -90, max = 90)
111 | public int camStartVertical = 30;
112 |
113 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
114 | @IntMinMax(min = 0, max = 1000000)
115 | public int camStartScale = 800;
116 |
117 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
118 | @IntMinMax(min = 0)
119 | public int camPanHorizontal = 90;
120 |
121 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
122 | @IntMinMax(min = 0)
123 | public int camPanVertical = 15;
124 |
125 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
126 | @IntMinMax(min = 0)
127 | public int camZoom = 100;
128 |
129 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
130 | @IntMinMax(min = -500, max = 500)
131 | public int camPosX = 50;
132 |
133 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
134 | @IntMinMax(min = -500, max = 500)
135 | public int camPosY = 50;
136 |
137 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
138 | @IntMinMax(min = 1, max = 256)
139 | public int surfaceDepth = 2;
140 |
141 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
142 | @IntMinMax(min = 1, max = 256)
143 | public int surfaceHorizontalUpdateDistance = 16;
144 |
145 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
146 | @IntMinMax(min = 1, max = 3)
147 | public int mapType = 1;
148 |
149 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
150 | @IntMinMax(min = 0)
151 | public int mapFreq = 0;
152 |
153 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
154 | @IntMinMax(min = 20, max = 500)
155 | public int mapLoad = 20;
156 |
157 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
158 | @IntBool
159 | public int mapShowEntities = 0;
160 |
161 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
162 | @IntBool
163 | public int mapShowCoordinates = 0;
164 |
165 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
166 | @IntMinMax(min = 0, max = 100)
167 | public int mapStartX = 70;
168 |
169 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
170 | @IntMinMax(min = 0, max = 100)
171 | public int mapStartY = 2;
172 |
173 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
174 | @IntMinMax(min = 0, max = 100)
175 | public int mapEndX = 99;
176 |
177 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
178 | @IntMinMax(min = 0, max = 100)
179 | public int mapEndY = 30;
180 |
181 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
182 | @IntMinMax(min = 0, max = 100)
183 | public int mapBorderOpacity = 100;
184 |
185 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
186 | @IntBool
187 | public int mapBorderOutline = 1;
188 |
189 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
190 | public Colour mapBorderOutlineColour = new Colour(150, 150, 150);
191 |
192 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
193 | @IntMinMax(min = 1, max = 100)
194 | public int mapBorderSize = 1;
195 |
196 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
197 | public Colour mapBorderColour = new Colour(34, 34, 34);
198 |
199 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
200 | @IntMinMax(min = 0, max = 100)
201 | public int mapBackgroundOpacity = 70;
202 |
203 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
204 | public Colour mapBackgroundColour = new Colour(0);
205 |
206 | @ConfigProp(category = "clientOnly", side = Side.CLIENT)
207 | @IntBool
208 | public int easterEgg = 1;
209 |
210 | @ConfigProp
211 | public KeyBind keyCamUp = new KeyBind(Keyboard.KEY_NUMPAD8);
212 |
213 | @ConfigProp
214 | public KeyBind keyCamDown = new KeyBind(Keyboard.KEY_NUMPAD2);
215 |
216 | @ConfigProp
217 | public KeyBind keyCamLeft = new KeyBind(Keyboard.KEY_NUMPAD4);
218 |
219 | @ConfigProp
220 | public KeyBind keyCamRight = new KeyBind(Keyboard.KEY_NUMPAD6);
221 |
222 | @ConfigProp
223 | public KeyBind keyCamUpFS = new KeyBind(Keyboard.KEY_UP);
224 |
225 | @ConfigProp
226 | public KeyBind keyCamDownFS = new KeyBind(Keyboard.KEY_DOWN);
227 |
228 | @ConfigProp
229 | public KeyBind keyCamLeftFS = new KeyBind(Keyboard.KEY_LEFT);
230 |
231 | @ConfigProp
232 | public KeyBind keyCamRightFS = new KeyBind(Keyboard.KEY_RIGHT);
233 |
234 | @ConfigProp
235 | public KeyBind keyCamZoomIn = new KeyBind(Keyboard.KEY_NUMPAD9);
236 |
237 | @ConfigProp
238 | public KeyBind keyCamZoomOut = new KeyBind(Keyboard.KEY_NUMPAD3);
239 |
240 | @ConfigProp
241 | public KeyBind keyToggle = new KeyBind(Keyboard.KEY_NUMPAD5);
242 |
243 | @ConfigProp
244 | public KeyBind keyToggleFullscreen = new KeyBind(Keyboard.KEY_NUMPAD7);
245 |
246 | @ConfigProp
247 | public KeyBind keySwitchMapMode = new KeyBind(Keyboard.KEY_NUMPAD1);
248 |
249 | @ConfigProp
250 | public KeyBind keyWaypoints = new KeyBind(Keyboard.KEY_NUMPAD0);
251 |
252 | public Config(File file)
253 | {
254 | super(file);
255 | }
256 |
257 | @Override
258 | public String getModId()
259 | {
260 | return Blocksteps.MOD_ID;
261 | }
262 |
263 | @Override
264 | public String getModName()
265 | {
266 | return Blocksteps.MOD_NAME;
267 | }
268 | }
269 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/core/MapSaveFile.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.core;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import net.minecraft.util.math.BlockPos;
5 |
6 | import java.util.ArrayList;
7 | import java.util.TreeMap;
8 |
9 | public class MapSaveFile
10 | {
11 | private MapSaveFile(){}
12 |
13 | public TreeMap> stepPoints;
14 | public TreeMap> waypoints;
15 |
16 | public static MapSaveFile create()
17 | {
18 | MapSaveFile file = new MapSaveFile();
19 |
20 | file.stepPoints = new TreeMap>(Blocksteps.eventHandler.steps);
21 | file.waypoints = new TreeMap>(Blocksteps.eventHandler.waypoints);
22 |
23 | return file;
24 | }
25 |
26 | public void load()
27 | {
28 | Blocksteps.eventHandler.steps.clear();
29 | if(stepPoints != null)
30 | {
31 | Blocksteps.eventHandler.steps = stepPoints;
32 | }
33 | Blocksteps.eventHandler.waypoints.clear();
34 | if(waypoints != null)
35 | {
36 | Blocksteps.eventHandler.waypoints = waypoints;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/core/Waypoint.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.core;
2 |
3 | import com.google.gson.annotations.SerializedName;
4 | import me.ichun.mods.blocksteps.common.Blocksteps;
5 | import me.ichun.mods.blocksteps.common.entity.EntityWaypoint;
6 | import me.ichun.mods.ichunutil.client.gui.window.element.IIdentifiable;
7 | import me.ichun.mods.ichunutil.client.gui.window.element.IListable;
8 | import me.ichun.mods.ichunutil.client.render.RendererHelper;
9 | import me.ichun.mods.ichunutil.common.core.util.IOUtil;
10 | import me.ichun.mods.ichunutil.common.core.util.ResourceHelper;
11 | import net.minecraft.client.Minecraft;
12 | import net.minecraft.client.gui.FontRenderer;
13 | import net.minecraft.client.renderer.GlStateManager;
14 | import net.minecraft.client.renderer.OpenGlHelper;
15 | import net.minecraft.client.renderer.Tessellator;
16 | import net.minecraft.client.renderer.VertexBuffer;
17 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
18 | import net.minecraft.entity.Entity;
19 | import net.minecraft.entity.boss.EntityDragon;
20 | import net.minecraft.entity.passive.EntityPig;
21 | import net.minecraft.entity.passive.EntitySheep;
22 | import net.minecraft.item.EnumDyeColor;
23 | import net.minecraft.util.math.BlockPos;
24 | import net.minecraft.util.math.MathHelper;
25 | import net.minecraft.world.World;
26 | import org.apache.commons.lang3.RandomStringUtils;
27 | import org.lwjgl.opengl.GL11;
28 |
29 | import java.util.Locale;
30 | import java.util.Random;
31 |
32 | public class Waypoint
33 | implements Comparable, IIdentifiable, IListable
34 | {
35 | @SerializedName("i")
36 | public String ident;
37 | @SerializedName("n")
38 | public String name;
39 | @SerializedName("p")
40 | public BlockPos pos;
41 | @SerializedName("c")
42 | public int colour;
43 | @SerializedName("v")
44 | public boolean visible;
45 | @SerializedName("s")
46 | public boolean showDistance;
47 | @SerializedName("b")
48 | public boolean beam;
49 | @SerializedName("e")
50 | public String entityType;
51 | @SerializedName("r")
52 | public int renderRange;
53 |
54 | public transient Entity entityInstance;
55 | public transient boolean errored;
56 |
57 | public Waypoint(BlockPos wpPos)
58 | {
59 | ident = RandomStringUtils.randomAscii(IOUtil.IDENTIFIER_LENGTH);
60 | name = "New Waypoint";
61 | pos = wpPos;
62 | int r = 255;
63 | int g = 255;
64 | int b = 255;
65 | if(Minecraft.getMinecraft().theWorld != null)
66 | {
67 | Random rand = Minecraft.getMinecraft().theWorld.rand;
68 | r = rand.nextInt(256);
69 | g = rand.nextInt(256);
70 | b = rand.nextInt(256);
71 | }
72 | colour = (r << 16) + (g << 8) + (b);
73 | visible = true;
74 | showDistance = true;
75 | beam = true;
76 | entityType = "";
77 | renderRange = 1000;
78 | }
79 |
80 | public Waypoint setName(String name)
81 | {
82 | this.name = name;
83 | return this;
84 | }
85 |
86 | @Override
87 | public int compareTo(Object arg0)
88 | {
89 | if(arg0 instanceof Waypoint)
90 | {
91 | Waypoint comp = (Waypoint)arg0;
92 | return name.compareTo(comp.name);
93 | }
94 | return 0;
95 | }
96 |
97 | @Override
98 | public String getIdentifier()
99 | {
100 | return ident;
101 | }
102 |
103 | @Override
104 | public String getName()
105 | {
106 | return " " + name;
107 | }
108 |
109 | @Override
110 | public boolean localizable()
111 | {
112 | return false;
113 | }
114 |
115 | public void render(double d, double d1, double d2, float partialTicks, boolean inWorld)
116 | {
117 | if(this.visible)
118 | {
119 | Minecraft mc = Minecraft.getMinecraft();
120 | int clr = this.colour;
121 | if(Blocksteps.config.easterEgg == 1)
122 | {
123 | if(this.name.equalsIgnoreCase("home") || this.name.equalsIgnoreCase(mc.getSession().getUsername()) || this.name.equalsIgnoreCase("blocksteps") || this.name.equalsIgnoreCase("ichun") || this.name.equalsIgnoreCase("fusionlord") || this.name.equalsIgnoreCase("sheeppig") || this.name.equalsIgnoreCase("sheepig"))
124 | {
125 | int ii = mc.thePlayer.ticksExisted / 25 + Math.abs(this.name.hashCode());
126 | int j = EnumDyeColor.values().length;
127 | int k = ii % j;
128 | int l = (ii + 1) % j;
129 | float f7 = ((float)(mc.thePlayer.ticksExisted % 25) + partialTicks) / 25.0F;
130 | float[] afloat1 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(k));
131 | float[] afloat2 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(l));
132 | clr = ((int)((afloat1[0] * (1.0F - f7) + afloat2[0] * f7) * 255F) << 16) + ((int)((afloat1[1] * (1.0F - f7) + afloat2[1] * f7) * 255F) << 8) + ((int)((afloat1[2] * (1.0F - f7) + afloat2[2] * f7) * 255F));
133 | }
134 | }
135 | if(Blocksteps.config.waypointIndicator == 1)
136 | {
137 | if(this.beam)
138 | {
139 | Tessellator tessellator = Tessellator.getInstance();
140 | VertexBuffer vertexBuffer = tessellator.getBuffer();
141 | double j = 0;
142 | double l = 256;
143 | if(Blocksteps.config.waypointBeamHeightAdjust > 0)
144 | {
145 | double dist = mc.thePlayer.getDistance(this.pos.getX() + 0.5D, this.pos.getY(), this.pos.getZ() + 0.5D);
146 | if(dist < 256D)
147 | {
148 | l = Math.max(Blocksteps.config.waypointBeamHeightAdjust, dist);
149 | }
150 | }
151 | double x = this.pos.getX() - d;
152 | double y = this.pos.getY() - (l / 2D) - d1;
153 | double z = this.pos.getZ() - d2;
154 | int jj = 15728880 % 65536;
155 | int kk = 15728880 / 65536;
156 | OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)jj / 1.0F, (float)kk / 1.0F);
157 | Minecraft.getMinecraft().getTextureManager().bindTexture(ResourceHelper.texBeaconBeam);
158 | GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
159 | GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
160 | GlStateManager.disableLighting();
161 | GlStateManager.disableCull();
162 | GlStateManager.disableBlend();
163 | GlStateManager.depthMask(true);
164 | GlStateManager.tryBlendFuncSeparate(770, 1, 1, 0);
165 | float f2;
166 | if(this.entityInstance != null)
167 | {
168 | f2 = (this.entityInstance.getEntityId() + mc.thePlayer.ticksExisted + partialTicks) * 0.4F;
169 | }
170 | else
171 | {
172 | f2 = (float)mc.theWorld.getTotalWorldTime() + partialTicks;
173 | }
174 | float f3 = -f2 * 0.2F - (float)MathHelper.floor_float(-f2 * 0.1F);
175 | double dd3 = (double)f2 * 0.025D * -1.5D;
176 | vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
177 | double dd4 = 0.1D;
178 | double dd5 = 0.5D + Math.cos(dd3 + 2.356194490192345D) * dd4;
179 | double d6 = 0.5D + Math.sin(dd3 + 2.356194490192345D) * dd4;
180 | double d7 = 0.5D + Math.cos(dd3 + (Math.PI / 4D)) * dd4;
181 | double d8 = 0.5D + Math.sin(dd3 + (Math.PI / 4D)) * dd4;
182 | double d9 = 0.5D + Math.cos(dd3 + 3.9269908169872414D) * dd4;
183 | double d10 = 0.5D + Math.sin(dd3 + 3.9269908169872414D) * dd4;
184 | double d11 = 0.5D + Math.cos(dd3 + 5.497787143782138D) * dd4;
185 | double d12 = 0.5D + Math.sin(dd3 + 5.497787143782138D) * dd4;
186 | double d13 = 0.0D;
187 | double d14 = 1.0D;
188 | double d15 = (double)(-1.0F + f3);
189 | double d16 = (double)((float)256) * (0.5D / dd4) + d15;
190 | float r = (clr >> 16 & 0xff) / 255F;
191 | float g = (clr >> 8 & 0xff) / 255F;
192 | float b = (clr & 0xff) / 255F;
193 | vertexBuffer.pos(x + dd5, y + l, z + d6).tex(d14, d16).color(r, g, b, 0.125F).endVertex();
194 | vertexBuffer.pos(x + dd5, y + j, z + d6).tex(d14, d15).color(r, g, b, 0.125F).endVertex();
195 | vertexBuffer.pos(x + d7, y + j, z + d8).tex(d13, d15).color(r, g, b, 0.125F).endVertex();
196 | vertexBuffer.pos(x + d7, y + l, z + d8).tex(d13, d16).color(r, g, b, 0.125F).endVertex();
197 | vertexBuffer.pos(x + d11, y + l, z + d12).tex(d14, d16).color(r, g, b, 0.125F).endVertex();
198 | vertexBuffer.pos(x + d11, y + j, z + d12).tex(d14, d15).color(r, g, b, 0.125F).endVertex();
199 | vertexBuffer.pos(x + d9, y + j, z + d10).tex(d13, d15).color(r, g, b, 0.125F).endVertex();
200 | vertexBuffer.pos(x + d9, y + l, z + d10).tex(d13, d16).color(r, g, b, 0.125F).endVertex();
201 | vertexBuffer.pos(x + d7, y + l, z + d8).tex(d14, d16).color(r, g, b, 0.125F).endVertex();
202 | vertexBuffer.pos(x + d7, y + j, z + d8).tex(d14, d15).color(r, g, b, 0.125F).endVertex();
203 | vertexBuffer.pos(x + d11, y + j, z + d12).tex(d13, d15).color(r, g, b, 0.125F).endVertex();
204 | vertexBuffer.pos(x + d11, y + l, z + d12).tex(d13, d16).color(r, g, b, 0.125F).endVertex();
205 | vertexBuffer.pos(x + d9, y + l, z + d10).tex(d14, d16).color(r, g, b, 0.125F).endVertex();
206 | vertexBuffer.pos(x + d9, y + j, z + d10).tex(d14, d15).color(r, g, b, 0.125F).endVertex();
207 | vertexBuffer.pos(x + dd5, y + j, z + d6).tex(d13, d15).color(r, g, b, 0.125F).endVertex();
208 | vertexBuffer.pos(x + dd5, y + l, z + d6).tex(d13, d16).color(r, g, b, 0.125F).endVertex();
209 | tessellator.draw();
210 | GlStateManager.enableBlend();
211 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
212 | GlStateManager.depthMask(false);
213 | vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
214 | dd3 = 0.3D;
215 | dd4 = 0.3D;
216 | dd5 = 0.7D;
217 | d6 = 0.3D;
218 | d7 = 0.3D;
219 | d8 = 0.7D;
220 | d9 = 0.7D;
221 | d10 = 0.7D;
222 | d11 = 0.0D;
223 | d12 = 1.0D;
224 | d13 = (double)(-1.0F + f3);
225 | d14 = (double)((float)256) + d13;
226 | vertexBuffer.pos(x + dd3, y + l, z + dd4).tex(d12, d14).color(r, g, b, 0.125F).endVertex();
227 | vertexBuffer.pos(x + dd3, y + j, z + dd4).tex(d12, d13).color(r, g, b, 0.125F).endVertex();
228 | vertexBuffer.pos(x + dd5, y + j, z + d6).tex(d11, d13).color(r, g, b, 0.125F).endVertex();
229 | vertexBuffer.pos(x + dd5, y + l, z + d6).tex(d11, d14).color(r, g, b, 0.125F).endVertex();
230 | vertexBuffer.pos(x + d9, y + l, z + d10).tex(d12, d14).color(r, g, b, 0.125F).endVertex();
231 | vertexBuffer.pos(x + d9, y + j, z + d10).tex(d12, d13).color(r, g, b, 0.125F).endVertex();
232 | vertexBuffer.pos(x + d7, y + j, z + d8).tex(d11, d13).color(r, g, b, 0.125F).endVertex();
233 | vertexBuffer.pos(x + d7, y + l, z + d8).tex(d11, d14).color(r, g, b, 0.125F).endVertex();
234 | vertexBuffer.pos(x + dd5, y + l, z + d6).tex(d12, d14).color(r, g, b, 0.125F).endVertex();
235 | vertexBuffer.pos(x + dd5, y + j, z + d6).tex(d12, d13).color(r, g, b, 0.125F).endVertex();
236 | vertexBuffer.pos(x + d9, y + j, z + d10).tex(d11, d13).color(r, g, b, 0.125F).endVertex();
237 | vertexBuffer.pos(x + d9, y + l, z + d10).tex(d11, d14).color(r, g, b, 0.125F).endVertex();
238 | vertexBuffer.pos(x + d7, y + l, z + d8).tex(d12, d14).color(r, g, b, 0.125F).endVertex();
239 | vertexBuffer.pos(x + d7, y + j, z + d8).tex(d12, d13).color(r, g, b, 0.125F).endVertex();
240 | vertexBuffer.pos(x + dd3, y + j, z + dd4).tex(d11, d13).color(r, g, b, 0.125F).endVertex();
241 | vertexBuffer.pos(x + dd3, y + l, z + dd4).tex(d11, d14).color(r, g, b, 0.125F).endVertex();
242 | tessellator.draw();
243 | GlStateManager.enableLighting();
244 | GlStateManager.enableTexture2D();
245 | GlStateManager.depthMask(true);
246 | }
247 | if(this.entityInstance == null && !errored)
248 | {
249 | try
250 | {
251 | if(this.name.equalsIgnoreCase("sheeppig") || this.name.equalsIgnoreCase("sheepig"))
252 | {
253 | this.entityInstance = new EntityPig(mc.theWorld);
254 | EntityPig pig = (EntityPig)this.entityInstance;
255 | pig.setCustomNameTag("iChun");
256 | pig.enablePersistence();
257 | }
258 | else if(!this.entityType.isEmpty())
259 | {
260 | this.entityInstance = (Entity)Class.forName(this.entityType).getConstructor(World.class).newInstance(mc.theWorld);
261 | }
262 | else
263 | {
264 | this.entityInstance = new EntityWaypoint(mc.theWorld);
265 | }
266 | this.entityInstance.setLocationAndAngles(this.pos.getX() + 0.5D, this.pos.getY(), this.pos.getZ() + 0.5D, 0F, 0F);
267 | }
268 | catch(Exception e)
269 | {
270 | errored = true;
271 | Blocksteps.LOGGER.warn("Error creating waypoint indicator for waypoint " + this.name + " with type " + this.entityType);
272 | e.printStackTrace();
273 | }
274 | }
275 | if(this.entityInstance != null && !errored && mc.thePlayer.getDistanceToEntity(entityInstance) < 150D)
276 | {
277 | double dd0 = this.entityInstance.lastTickPosX + (this.entityInstance.posX - this.entityInstance.lastTickPosX) * (double)partialTicks;
278 | double dd1 = this.entityInstance.lastTickPosY + (this.entityInstance.posY - this.entityInstance.lastTickPosY) * (double)partialTicks;
279 | double dd2 = this.entityInstance.lastTickPosZ + (this.entityInstance.posZ - this.entityInstance.lastTickPosZ) * (double)partialTicks;
280 | float ff1 = this.entityInstance.prevRotationYaw + (this.entityInstance.rotationYaw - this.entityInstance.prevRotationYaw) * partialTicks;
281 |
282 | RendererHelper.setColorFromInt(clr);
283 | GlStateManager.disableLighting();
284 | int j = 15728880 % 65536;
285 | int k = 15728880 / 65536;
286 | OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)j / 1.0F, (float)k / 1.0F);
287 |
288 | GlStateManager.pushMatrix();
289 | GlStateManager.translate(dd0 - d, dd1 - d1 + 0.2F, dd2 - d2);
290 | if(this.beam && (this.name.equalsIgnoreCase("sheeppig") || this.name.equalsIgnoreCase("sheepig") || !this.entityType.isEmpty()))
291 | {
292 | GlStateManager.rotate((this.entityInstance.getEntityId() + mc.thePlayer.ticksExisted + partialTicks) % 400F / 400F * 360F, 0F, 1F, 0F);
293 | if(!(this.entityInstance instanceof EntityDragon))
294 | {
295 | GlStateManager.translate(0F, 0F, this.entityInstance.width / 2F);
296 | }
297 | GlStateManager.rotate(-10F, 1F, 0F, 0F);
298 | }
299 | GlStateManager.scale(0.5D, 0.5D, 0.5D);
300 |
301 | if(Blocksteps.config.waypointIndicatorThroughBlocks == 1)
302 | {
303 | GlStateManager.depthMask(false);
304 | GlStateManager.disableDepth();
305 | }
306 |
307 | // EntityHelperBase.storeBossStatus();
308 |
309 | if(this.entityInstance instanceof EntityDragon)
310 | {
311 | GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F);
312 | }
313 | try
314 | {
315 | mc.getRenderManager().doRenderEntity(this.entityInstance, 0D, 0D, 0D, ff1, 1F, false);
316 | }
317 | catch(Exception e)
318 | {
319 | errored = true;
320 | }
321 | if(this.entityInstance instanceof EntityDragon)
322 | {
323 | GlStateManager.rotate(180F, 0.0F, -1.0F, 0.0F);
324 | }
325 |
326 | // EntityHelperBase.restoreBossStatus();
327 |
328 | if(Blocksteps.config.waypointIndicatorThroughBlocks == 1)
329 | {
330 | GlStateManager.enableDepth();
331 | GlStateManager.depthMask(true);
332 | }
333 |
334 | GlStateManager.popMatrix();
335 |
336 | GlStateManager.enableLighting();
337 | }
338 | }
339 | String str = this.name;
340 | FontRenderer fontrenderer = mc.fontRendererObj;
341 | float f = Blocksteps.config.waypointLabelSize / 10F;
342 | float f1 = 0.016666668F * f;
343 | GlStateManager.pushMatrix();
344 | double dx = (this.pos.getX() + 0.5D) - d;
345 | double dy = (this.pos.getY()) - d1;
346 | double dz = (this.pos.getZ() + 0.5D) - d2;
347 | double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
348 | if(dist < 116D || !inWorld)
349 | {
350 | GlStateManager.translate(this.pos.getX() + 0.5D - d, this.pos.getY() - d1, this.pos.getZ() + 0.5D - d2);
351 | }
352 | else
353 | {
354 | double distt = 116D / dist;
355 | GlStateManager.translate((this.pos.getX() + 0.5D - d) * distt, ((this.pos.getY() - d1) * distt), (this.pos.getZ() + 0.5D - d2) * distt);
356 | }
357 | GL11.glNormal3f(0.0F, 1.0F, 0.0F);
358 | GlStateManager.rotate(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
359 | if(inWorld)
360 | {
361 | if(dist > 16D)
362 | {
363 | f1 *= Math.min(100D, dist) / 16D;
364 | }
365 | GlStateManager.rotate(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
366 | }
367 | else
368 | {
369 | GlStateManager.rotate(Blocksteps.eventHandler.angleX, 1.0F, 0.0F, 0.0F);
370 | }
371 | GlStateManager.scale(-f1, -f1, f1);
372 | GlStateManager.disableLighting();
373 | if(Blocksteps.config.waypointLabelThroughBlocks == 1)
374 | {
375 | GlStateManager.depthMask(false);
376 | GlStateManager.disableDepth();
377 | }
378 | GlStateManager.enableBlend();
379 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
380 | Tessellator tessellator = Tessellator.getInstance();
381 | VertexBuffer vertexBuffer = tessellator.getBuffer();
382 | byte b0 = 0;
383 | GlStateManager.disableTexture2D();
384 | vertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
385 | int j = fontrenderer.getStringWidth(str) / 2;
386 | vertexBuffer.pos((double)(-j - 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
387 | vertexBuffer.pos((double)(-j - 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
388 | vertexBuffer.pos((double)(j + 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
389 | vertexBuffer.pos((double)(j + 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
390 | tessellator.draw();
391 | GlStateManager.enableTexture2D();
392 | fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, clr);
393 | if(this.showDistance)
394 | {
395 | b0 = -9;
396 | str = String.format(Locale.ENGLISH, "%.2f", mc.thePlayer.getDistance(this.pos.getX() + 0.5D, this.pos.getY(), this.pos.getZ() + 0.5D)) + "m";
397 | GlStateManager.disableTexture2D();
398 | vertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
399 | j = fontrenderer.getStringWidth(str) / 2;
400 | vertexBuffer.pos((double)(-j - 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
401 | vertexBuffer.pos((double)(-j - 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
402 | vertexBuffer.pos((double)(j + 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
403 | vertexBuffer.pos((double)(j + 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
404 | tessellator.draw();
405 | GlStateManager.enableTexture2D();
406 | fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, clr);
407 | }
408 | if(mc.gameSettings.showDebugInfo)
409 | {
410 | b0 = 9;
411 | str = "X:" + pos.getX() + " Y:" + pos.getY() + " Z:" + pos.getZ();
412 | GlStateManager.disableTexture2D();
413 | vertexBuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
414 | j = fontrenderer.getStringWidth(str) / 2;
415 | vertexBuffer.pos((double)(-j - 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
416 | vertexBuffer.pos((double)(-j - 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
417 | vertexBuffer.pos((double)(j + 1), (double)(8 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
418 | vertexBuffer.pos((double)(j + 1), (double)(-1 + b0), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
419 | tessellator.draw();
420 | GlStateManager.enableTexture2D();
421 | fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, b0, clr);
422 | }
423 | if(Blocksteps.config.waypointLabelThroughBlocks == 1)
424 | {
425 | GlStateManager.enableDepth();
426 | GlStateManager.depthMask(true);
427 | }
428 | GlStateManager.enableLighting();
429 | GlStateManager.disableBlend();
430 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
431 | GlStateManager.popMatrix();
432 | }
433 | }
434 | }
435 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/entity/EntityWaypoint.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.entity;
2 |
3 | import net.minecraft.entity.Entity;
4 | import net.minecraft.nbt.NBTTagCompound;
5 | import net.minecraft.world.World;
6 |
7 | public class EntityWaypoint extends Entity
8 | {
9 | public EntityWaypoint(World worldIn)
10 | {
11 | super(worldIn);
12 | }
13 |
14 | @Override
15 | public boolean canBeCollidedWith()
16 | {
17 | return false;
18 | }
19 |
20 | @Override
21 | public boolean canBePushed()
22 | {
23 | return false;
24 | }
25 |
26 | @Override
27 | public boolean isEntityAlive()
28 | {
29 | return !this.isDead;
30 | }
31 |
32 | @Override
33 | public boolean writeToNBTOptional(NBTTagCompound par1NBTTagCompound)
34 | {
35 | return false;
36 | }
37 |
38 | @Override
39 | protected void entityInit()
40 | {
41 | }
42 |
43 | @Override
44 | public void readEntityFromNBT(NBTTagCompound nbttagcompound) {}
45 |
46 | @Override
47 | public void writeEntityToNBT(NBTTagCompound nbttagcompound) {}
48 | }
49 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/gui/GuiWaypoints.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.gui;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.gui.window.WindowEditWaypoint;
5 | import me.ichun.mods.blocksteps.common.gui.window.WindowWaypoints;
6 | import me.ichun.mods.ichunutil.client.gui.window.IWorkspace;
7 | import me.ichun.mods.ichunutil.client.gui.window.Window;
8 | import me.ichun.mods.ichunutil.client.gui.window.element.Element;
9 | import net.minecraft.client.Minecraft;
10 | import net.minecraft.client.gui.GuiScreen;
11 | import net.minecraft.client.gui.ScaledResolution;
12 | import net.minecraft.client.renderer.GlStateManager;
13 | import org.lwjgl.input.Keyboard;
14 | import org.lwjgl.input.Mouse;
15 | import org.lwjgl.opengl.GL11;
16 |
17 | import java.util.ArrayList;
18 |
19 | public class GuiWaypoints extends IWorkspace
20 | {
21 | public WindowWaypoints windowWaypoints;
22 | public WindowEditWaypoint windowEditWaypoint;
23 |
24 | public GuiWaypoints()
25 | {
26 | VARIABLE_LEVEL = 0;
27 | }
28 |
29 | @Override
30 | public void initGui()
31 | {
32 | super.initGui();
33 |
34 | levels.clear();
35 |
36 | ArrayList level = new ArrayList<>();
37 |
38 | windowWaypoints = new WindowWaypoints(this, 10, 10, 105, height - 20);
39 | windowEditWaypoint = new WindowEditWaypoint(this, 115, 10, width - 125, height - 20);
40 |
41 | level.add(windowWaypoints);
42 | level.add(windowEditWaypoint);
43 |
44 | levels.add(level);
45 | levels.add(new ArrayList<>());
46 | }
47 |
48 | @Override
49 | public void onGuiClosed()
50 | {
51 | Keyboard.enableRepeatEvents(false);
52 | Blocksteps.eventHandler.cleanWaypoints();
53 | }
54 |
55 | @Override
56 | public boolean canClickOnElement(Window window, Element element)
57 | {
58 | return true;
59 | }
60 |
61 | @Override
62 | public void drawScreen(int mouseX, int mouseY, float renderTick)
63 | {
64 | if(mc == null)
65 | {
66 | return;
67 | }
68 | Minecraft mc = Minecraft.getMinecraft();
69 |
70 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
71 |
72 | ScaledResolution resolution = new ScaledResolution(mc);
73 | GlStateManager.matrixMode(GL11.GL_PROJECTION);
74 | GlStateManager.loadIdentity();
75 | GlStateManager.ortho(0.0D, resolution.getScaledWidth_double(), resolution.getScaledHeight_double(), 0.0D, -5000.0D, 5000.0D);
76 | GlStateManager.matrixMode(GL11.GL_MODELVIEW);
77 | GlStateManager.loadIdentity();
78 |
79 | GlStateManager.pushMatrix();
80 |
81 | drawDefaultBackground();
82 |
83 | boolean onWindow = drawWindows(mouseX, mouseY);
84 |
85 | int scroll = Mouse.getDWheel();
86 |
87 | updateElementHovered(mouseX, mouseY, scroll);
88 |
89 | GlStateManager.popMatrix();
90 |
91 | updateKeyStates();
92 |
93 | updateWindowDragged(mouseX, mouseY);
94 |
95 | updateElementDragged(mouseX, mouseY);
96 |
97 | GlStateManager.matrixMode(GL11.GL_PROJECTION);
98 | GlStateManager.loadIdentity();
99 | GlStateManager.ortho(0.0D, resolution.getScaledWidth_double(), resolution.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
100 | GlStateManager.matrixMode(GL11.GL_MODELVIEW);
101 | GlStateManager.loadIdentity();
102 | }
103 |
104 | @Override
105 | public void keyTyped(char c, int key)
106 | {
107 | if (key == 1)
108 | {
109 | this.mc.displayGuiScreen((GuiScreen)null);
110 |
111 | if (this.mc.currentScreen == null)
112 | {
113 | this.mc.setIngameFocus();
114 | }
115 | }
116 | else if(elementSelected != null)
117 | {
118 | elementSelected.keyInput(c, key);
119 | if(elementSelected.parent == windowEditWaypoint)
120 | {
121 | windowEditWaypoint.keyInput(elementSelected);
122 | }
123 | }
124 | }
125 | }
126 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/gui/window/WindowConfirmDelete.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.gui.window;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.core.ChunkStore;
5 | import me.ichun.mods.blocksteps.common.core.Waypoint;
6 | import me.ichun.mods.blocksteps.common.gui.GuiWaypoints;
7 | import me.ichun.mods.ichunutil.client.gui.Theme;
8 | import me.ichun.mods.ichunutil.client.gui.window.IWorkspace;
9 | import me.ichun.mods.ichunutil.client.gui.window.Window;
10 | import me.ichun.mods.ichunutil.client.gui.window.element.Element;
11 | import me.ichun.mods.ichunutil.client.gui.window.element.ElementButton;
12 | import net.minecraft.client.Minecraft;
13 | import net.minecraft.client.gui.GuiScreen;
14 | import net.minecraft.util.math.BlockPos;
15 | import net.minecraft.util.text.translation.I18n;
16 |
17 | public class WindowConfirmDelete extends Window
18 | {
19 | public Waypoint waypoint;
20 |
21 | public WindowConfirmDelete(IWorkspace parent, Waypoint waypoint)
22 | {
23 | super(parent, 0, 0, 300, 120, 300, 120, "blocksteps.gui.areYouSure", true);
24 |
25 | this.waypoint = waypoint;
26 |
27 | elements.add(new ElementButton(this, width - 140, height - 30, 60, 16, 3, false, 1, 1, "element.button.ok"));
28 | elements.add(new ElementButton(this, width - 70, height - 30, 60, 16, 0, false, 1, 1, "element.button.cancel"));
29 | }
30 |
31 | @Override
32 | public void draw(int mouseX, int mouseY)
33 | {
34 | super.draw(mouseX, mouseY);
35 | if(!minimized)
36 | {
37 | workspace.getFontRenderer().drawString(I18n.translateToLocal(waypoint == null ? "blocksteps.gui.confirmDeleteMap" : "blocksteps.gui.confirmDeleteWaypoint"), posX + 15, posY + 40, Theme.getAsHex(workspace.currentTheme.font), false);
38 | }
39 | }
40 |
41 | @Override
42 | public void elementTriggered(Element element)
43 | {
44 | if(element.id == 0)
45 | {
46 | workspace.removeWindow(this, true);
47 | }
48 | if(element.id == 3)
49 | {
50 | if(workspace.windowDragged == this)
51 | {
52 | workspace.windowDragged = null;
53 | }
54 |
55 | if(waypoint == null)
56 | {
57 | if(!GuiScreen.isShiftKeyDown())
58 | {
59 | Blocksteps.eventHandler.getWaypoints(Minecraft.getMinecraft().theWorld.provider.getDimension()).clear();
60 | }
61 | Blocksteps.eventHandler.getSteps(Minecraft.getMinecraft().theWorld.provider.getDimension()).clear();
62 | ChunkStore.clear();
63 | Blocksteps.eventHandler.renderGlobalProxy.markAllForUpdateFromPos(new BlockPos(Minecraft.getMinecraft().thePlayer));
64 | Blocksteps.eventHandler.repopulateBlocksToRender = Blocksteps.eventHandler.purgeRerender = true;
65 | }
66 | else
67 | {
68 | Blocksteps.eventHandler.getWaypoints(Minecraft.getMinecraft().theWorld.provider.getDimension()).remove(waypoint);
69 | }
70 | ((GuiWaypoints)workspace).windowWaypoints.list.selectedIdentifier = "";
71 |
72 | workspace.removeWindow(this, true);
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/gui/window/WindowEditWaypoint.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.gui.window;
2 |
3 | import com.google.common.base.Splitter;
4 | import me.ichun.mods.blocksteps.common.core.Waypoint;
5 | import me.ichun.mods.blocksteps.common.entity.EntityWaypoint;
6 | import me.ichun.mods.blocksteps.common.gui.GuiWaypoints;
7 | import me.ichun.mods.ichunutil.client.gui.Theme;
8 | import me.ichun.mods.ichunutil.client.gui.window.Window;
9 | import me.ichun.mods.ichunutil.client.gui.window.element.*;
10 | import me.ichun.mods.ichunutil.client.render.RendererHelper;
11 | import net.minecraft.client.Minecraft;
12 | import net.minecraft.client.renderer.GlStateManager;
13 | import net.minecraft.client.renderer.OpenGlHelper;
14 | import net.minecraft.client.renderer.entity.RenderManager;
15 | import net.minecraft.entity.Entity;
16 | import net.minecraft.entity.EntityList;
17 | import net.minecraft.entity.boss.EntityDragon;
18 | import net.minecraft.entity.item.EntityItem;
19 | import net.minecraft.entity.item.EntityPainting;
20 | import net.minecraft.entity.player.EntityPlayer;
21 | import net.minecraft.entity.projectile.EntityArrow;
22 | import net.minecraft.util.math.BlockPos;
23 | import net.minecraft.util.text.translation.I18n;
24 | import net.minecraft.world.World;
25 | import org.lwjgl.BufferUtils;
26 | import org.lwjgl.input.Mouse;
27 | import org.lwjgl.opengl.GL11;
28 |
29 | import java.awt.*;
30 | import java.nio.FloatBuffer;
31 |
32 | public class WindowEditWaypoint extends Window
33 | {
34 | public GuiWaypoints parent;
35 |
36 | public Waypoint selectedWaypoint;
37 |
38 | public ElementTextInput elementName;
39 | public ElementNumberInput elementPosition;
40 | public ElementToggle elementVisible;
41 | public ElementToggle elementShowDistance;
42 | public ElementToggle elementBeam;
43 | public ElementSelector elementEntityType;
44 | public ElementTextInput elementColour;
45 | public ElementNumberInput elementRenderRange;
46 |
47 | public static final int ID_CURRENT_POS = 100;
48 |
49 | public int colourHue;
50 | public Entity entInstance;
51 |
52 | public WindowEditWaypoint(GuiWaypoints parent, int x, int y, int w, int h)
53 | {
54 | super(parent, x, y, w, h, 20, 20, "blocksteps.gui.editWaypoint", true);
55 |
56 | this.parent = parent;
57 |
58 | elementName = new ElementTextInput(this, 10, 30, width - 20, 12, 0, "blocksteps.waypoint.name");
59 | elements.add(elementName);
60 |
61 | elementPosition = new ElementNumberInput(this, 10, 60, width - 20, 12, 1, "blocksteps.waypoint.pos", 3, false);
62 | elements.add(elementPosition);
63 |
64 | elementVisible = new ElementToggle(this, 10, 80, 90, 12, 2, false, 0, 0, "blocksteps.waypoint.visible", "blocksteps.waypoint.visible", false);
65 | elements.add(elementVisible);
66 |
67 | elementShowDistance = new ElementToggle(this, 105, 80, 90, 12, 3, false, 0, 0, "blocksteps.waypoint.showDistance", "blocksteps.waypoint.showDistance", false);
68 | elements.add(elementShowDistance);
69 |
70 | elementBeam = new ElementToggle(this, 200, 80, 90, 12, 3, false, 0, 0, "blocksteps.waypoint.beam", "blocksteps.waypoint.beam", false);
71 | elements.add(elementBeam);
72 |
73 | elementEntityType = new ElementSelector(this, 10, 110, width - 20, 12, 4, "blocksteps.waypoint.entityType", "Waypoint");
74 | for(Object o : EntityList.NAME_TO_CLASS.values())
75 | {
76 | Class extends Entity> clz = (Class)o;
77 | if(!(EntityPainting.class.isAssignableFrom(clz) || EntityItem.class.isAssignableFrom(clz)))
78 | {
79 | elementEntityType.choices.put(clz.getSimpleName(), clz);
80 | }
81 | }
82 | elementEntityType.choices.put(EntityPlayer.class.getSimpleName(), EntityPlayer.class);
83 | elementEntityType.choices.put("Waypoint", EntityArrow.class);//TODO set the waypoint entityrenderer
84 |
85 | elements.add(elementEntityType);
86 |
87 | elementRenderRange = new ElementNumberInput(this, parent.width - 70, 140, 80, 12, 1, "blocksteps.waypoint.renderRangeTooltip", 1, false, 0, Integer.MAX_VALUE) {
88 | @Override
89 | public void resized()
90 | {
91 | posX = parent.width - width - 10;
92 | for(int i = 0; i < textFields.size(); i++)
93 | {
94 | textFields.get(i).xPosition = parent.posX + posX + 2 + ((width / textFields.size()) * i);
95 | textFields.get(i).yPosition = parent.posY + posY + 2;
96 | textFields.get(i).width = (width / textFields.size()) - 18;
97 | textFields.get(i).setCursorPositionZero();
98 | }
99 | }
100 | };
101 | elements.add(elementRenderRange);
102 |
103 | elementColour = new ElementTextInput(this, 0, 0, 50, 12, 0, "blocksteps.waypoint.colour", 6);
104 | elements.add(elementColour);
105 |
106 | elements.add(new ElementButtonTooltip(this, 12 + Minecraft.getMinecraft().fontRendererObj.getStringWidth(I18n.translateToLocal("blocksteps.waypoint.pos")), 49, 9, 9, ID_CURRENT_POS, false, 0, 0, "X", "blocksteps.waypoint.currentPos"));
107 | }
108 |
109 | @Override
110 | public void draw(int mouseX, int mouseY)
111 | {
112 | Waypoint oldWaypoint = selectedWaypoint;
113 | selectedWaypoint = null;
114 | for(ElementListTree.Tree tree : parent.windowWaypoints.list.trees)
115 | {
116 | if(tree.selected)
117 | {
118 | selectedWaypoint = (Waypoint)tree.attachedObject;
119 | if(oldWaypoint != selectedWaypoint)
120 | {
121 | elementName.textField.setText(selectedWaypoint.name);
122 | elementPosition.textFields.get(0).setText(Integer.toString(selectedWaypoint.pos.getX()));
123 | elementPosition.textFields.get(1).setText(Integer.toString(selectedWaypoint.pos.getY()));
124 | elementPosition.textFields.get(2).setText(Integer.toString(selectedWaypoint.pos.getZ()));
125 | elementVisible.toggledState = selectedWaypoint.visible;
126 | elementShowDistance.toggledState = selectedWaypoint.showDistance;
127 | elementBeam.toggledState = selectedWaypoint.beam;
128 | elementEntityType.selected = selectedWaypoint.entityType.isEmpty() ? "Waypoint" : Splitter.on(".").splitToList(selectedWaypoint.entityType).get(Splitter.on(".").splitToList(selectedWaypoint.entityType).size() - 1);
129 | createEntityInstance(selectedWaypoint.entityType);
130 |
131 | float[] hsb = Color.RGBtoHSB(selectedWaypoint.colour >> 16 & 0xff, selectedWaypoint.colour >> 8 & 0xff, selectedWaypoint.colour & 0xff, null);
132 | hsb[1] = hsb[2] = 1F;
133 | colourHue = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
134 | String clr = Integer.toHexString(selectedWaypoint.colour);
135 | while(clr.length() < 6)
136 | {
137 | clr = "0" + clr;
138 | }
139 | elementColour.textField.setText(clr);
140 | elementRenderRange.textFields.get(0).setText(Integer.toString(selectedWaypoint.renderRange));
141 | }
142 | break;
143 | }
144 | }
145 | if(selectedWaypoint != null)
146 | {
147 | elementColour.width = 60 - 7;
148 |
149 | super.draw(mouseX, mouseY);
150 | workspace.getFontRenderer().drawString(I18n.translateToLocal("blocksteps.waypoint.name"), posX + 11, posY + 20, Theme.getAsHex(workspace.currentTheme.font), false);
151 | workspace.getFontRenderer().drawString(I18n.translateToLocal("blocksteps.waypoint.pos"), posX + 11, posY + 50, Theme.getAsHex(workspace.currentTheme.font), false);
152 | workspace.getFontRenderer().drawString(I18n.translateToLocal("blocksteps.waypoint.entityType"), posX + 11, posY + 100, Theme.getAsHex(workspace.currentTheme.font), false);
153 | workspace.getFontRenderer().drawString(I18n.translateToLocal("blocksteps.waypoint.renderRange"), posX + width - 10 - workspace.getFontRenderer().getStringWidth(I18n.translateToLocal("blocksteps.waypoint.renderRange")), posY + 130, Theme.getAsHex(workspace.currentTheme.font), false);
154 |
155 | int x = posX + 11;
156 | int y = posY + height - 12;
157 | GlStateManager.pushMatrix();
158 | GlStateManager.translate(x, y, 0D);
159 | GlStateManager.rotate(-90F, 0F, 0F, 1F);
160 | GlStateManager.translate(-(x), -(y), 0D);
161 | RendererHelper.endGlScissor();
162 | workspace.getFontRenderer().drawString(I18n.translateToLocal("blocksteps.waypoint.colour"), x, y, Theme.getAsHex(workspace.currentTheme.font), false);
163 | GlStateManager.popMatrix();
164 | int size = height - 140;
165 | RendererHelper.drawGradientOnScreen(0xff000000, 0xff000000, 0xffffffff, 0xff000000 | colourHue, posX + 20, posY + height - size - 11, size, size, 0D);
166 |
167 | RendererHelper.drawHueStripOnScreen(255, posX + 20 + size + 3, posY + height - size - 11, 10, size, 0D);
168 |
169 | workspace.getFontRenderer().drawString("#", posX + 20 + size + 16, posY + height - 20, Theme.getAsHex(workspace.currentTheme.font), false);
170 | RendererHelper.drawColourOnScreen(selectedWaypoint.colour, 255, posX + 20 + size + 16, posY + height - 23 - (size - 15) - 3, 60, (size - 15), 0D);
171 |
172 | if(entInstance != null)
173 | {
174 | GlStateManager.enableColorMaterial();
175 | GlStateManager.pushMatrix();
176 | GlStateManager.translate((float)(posX + 20 + size + 16 + 30), (float)(posY + height - 23 - 12 - 3 + 5), 50.0F);
177 | float aScale = 25F;
178 | GlStateManager.scale(-aScale, aScale, aScale);
179 | GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
180 | GlStateManager.rotate(((float)Math.atan((double)(((float)-(posY + height - 23 - 12 - ((size - 15) / 2) - 3 + 5) + (posY + mouseY)) / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
181 | GlStateManager.rotate((float)Math.atan((double)(((float)-(posX + 20 + size + 16 + 30) + (posX + mouseX)) / 40.0F)) * 40.0F, 0.0F, 1.0F, 0.0F);
182 |
183 | RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
184 | float viewY = rendermanager.playerViewY;
185 | rendermanager.setPlayerViewY(180.0F);
186 | RendererHelper.setColorFromInt(selectedWaypoint.colour);
187 | RendererHelper.startGlScissor(posX + 20 + size + 16, posY + height - 23 - (size - 15) - 3, 60, (size - 15));
188 |
189 | // EntityHelperBase.storeBossStatus();
190 | if(entInstance instanceof EntityDragon)
191 | {
192 | GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F);
193 | }
194 | try
195 | {
196 | rendermanager.setRenderShadow(false);
197 | rendermanager.doRenderEntity(entInstance, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
198 | rendermanager.setRenderShadow(true);
199 | }
200 | catch(Exception ignored){}
201 | if(entInstance instanceof EntityDragon)
202 | {
203 | GlStateManager.rotate(180F, 0.0F, -1.0F, 0.0F);
204 | }
205 | // EntityHelperBase.restoreBossStatus();
206 | RendererHelper.startGlScissor(posX + 1, posY + 1, getWidth() - 2, getHeight() - 2);
207 | RendererHelper.setColorFromInt(0xffffff);
208 | rendermanager.setPlayerViewY(viewY);
209 |
210 | GlStateManager.popMatrix();
211 | GlStateManager.disableRescaleNormal();
212 | GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
213 | GlStateManager.disableTexture2D();
214 | GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
215 | GlStateManager.disableLighting();
216 | }
217 |
218 | if(Mouse.isButtonDown(0))
219 | {
220 | if(mouseX >= 20 && mouseY >= height - size - 10 && mouseX < 20 + size && mouseY < height - 11)
221 | {
222 | //is clicking on colour area
223 | FloatBuffer buffer = BufferUtils.createFloatBuffer(3);
224 | GL11.glReadPixels(Mouse.getX(), Mouse.getY(), 1, 1, GL11.GL_RGB, GL11.GL_FLOAT, buffer);
225 | float r = buffer.get();
226 | float g = buffer.get();
227 | float b = buffer.get();
228 | selectedWaypoint.colour = ((int)(r * 255F) << 16) + ((int)(g * 255F) << 8) + ((int)(b * 255F));
229 |
230 | String clr = Integer.toHexString(selectedWaypoint.colour);
231 | while(clr.length() < 6)
232 | {
233 | clr = "0" + clr;
234 | }
235 | elementColour.textField.setText(clr);
236 | }
237 | else if(mouseX >= 20 + size + 3 && mouseY >= height - size - 10 && mouseX < 20 + size + 3 + 10 && mouseY < height - 11)
238 | {
239 | // is clicking on hue strip
240 | FloatBuffer buffer = BufferUtils.createFloatBuffer(3);
241 | GL11.glReadPixels(Mouse.getX(), Mouse.getY(), 1, 1, GL11.GL_RGB, GL11.GL_FLOAT, buffer);
242 | float r = buffer.get();
243 | float g = buffer.get();
244 | float b = buffer.get();
245 | float[] hsb = Color.RGBtoHSB((int)(r * 255F) & 0xff, (int)(g * 255F) & 0xff, (int)(b * 255F) & 0xff, null);
246 | hsb[1] = hsb[2] = 1F;
247 | colourHue = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
248 | }
249 | }
250 |
251 | if(!(selectedWaypoint.pos.getX() == Integer.parseInt(elementPosition.textFields.get(0).getText()) && selectedWaypoint.pos.getY() == Integer.parseInt(elementPosition.textFields.get(1).getText()) && selectedWaypoint.pos.getZ() == Integer.parseInt(elementPosition.textFields.get(2).getText())))
252 | {
253 | selectedWaypoint.pos = new BlockPos(Integer.parseInt(elementPosition.textFields.get(0).getText()), Integer.parseInt(elementPosition.textFields.get(1).getText()), Integer.parseInt(elementPosition.textFields.get(2).getText()));
254 | }
255 | if(selectedWaypoint.entityType.isEmpty() && !elementEntityType.selected.equals("Waypoint") || !elementEntityType.selected.equals(Splitter.on(".").splitToList(selectedWaypoint.entityType).get(Splitter.on(".").splitToList(selectedWaypoint.entityType).size() - 1)))
256 | {
257 | keyInput(elementEntityType);
258 | }
259 | }
260 | }
261 |
262 | public void createEntityInstance(String s)
263 | {
264 | try
265 | {
266 | if(!s.isEmpty())
267 | {
268 | entInstance = (Entity)Class.forName(s).getConstructor(World.class).newInstance(Minecraft.getMinecraft().theWorld);
269 | }
270 | else
271 | {
272 | entInstance = new EntityWaypoint(Minecraft.getMinecraft().theWorld);
273 | }
274 | }
275 | catch(Exception ignored)
276 | {
277 | entInstance = null;
278 | }
279 | }
280 |
281 | public void keyInput(Element e)
282 | {
283 | if(selectedWaypoint != null)
284 | {
285 | if(e == elementName)
286 | {
287 | selectedWaypoint.name = elementName.textField.getText();
288 | }
289 | else if(e == elementVisible)
290 | {
291 | selectedWaypoint.visible = elementVisible.toggledState;
292 | }
293 | else if(e == elementShowDistance)
294 | {
295 | selectedWaypoint.showDistance = elementShowDistance.toggledState;
296 | }
297 | else if(e == elementBeam)
298 | {
299 | selectedWaypoint.beam = elementBeam.toggledState;
300 | }
301 | else if(e == elementEntityType)
302 | {
303 | selectedWaypoint.entityType = elementEntityType.selected.equals("Waypoint") ? "" : ((Class)elementEntityType.choices.get(elementEntityType.selected)).getName();
304 | createEntityInstance(selectedWaypoint.entityType);
305 | }
306 | else if(e == elementColour)
307 | {
308 | try
309 | {
310 | int i = Integer.decode("#" + elementColour.textField.getText());
311 |
312 | float[] hsb = Color.RGBtoHSB(i >> 16 & 0xff, i >> 8 & 0xff, i & 0xff, null);
313 | hsb[1] = hsb[2] = 1F;
314 | colourHue = Color.HSBtoRGB(hsb[0], hsb[1], hsb[2]);
315 | selectedWaypoint.colour = i;
316 | }
317 | catch(NumberFormatException ignored){}
318 | }
319 | else if(e == elementRenderRange)
320 | {
321 | try
322 | {
323 | int i = Integer.parseInt(elementRenderRange.textFields.get(0).getText());
324 | selectedWaypoint.renderRange = i;
325 | }
326 | catch(NumberFormatException ignored){}
327 | }
328 | }
329 | }
330 |
331 | @Override
332 | public void elementTriggered(Element e)
333 | {
334 | keyInput(e);
335 | if(e.id == ID_CURRENT_POS)
336 | {
337 | BlockPos pos = new BlockPos(Minecraft.getMinecraft().thePlayer);
338 | elementPosition.textFields.get(0).setText(Integer.toString(pos.getX()));
339 | elementPosition.textFields.get(1).setText(Integer.toString(pos.getY()));
340 | elementPosition.textFields.get(2).setText(Integer.toString(pos.getZ()));
341 | }
342 | }
343 |
344 | @Override
345 | public void resized()
346 | {
347 | posX = 115;
348 | posY = 10;
349 | width = parent.width - 125;
350 | height = parent.height - 20;
351 |
352 | int size = height - 140;
353 | elementColour.posX = 20 + size + 16 + 7;
354 | elementColour.posY = height - 23;
355 | super.resized();
356 | }
357 |
358 | @Override
359 | public int clickedOnBorder(int mouseX, int mouseY, int id)//only left clicks
360 | {
361 | return 0;
362 | }
363 |
364 | @Override
365 | public boolean canBeDragged()
366 | {
367 | return false;
368 | }
369 |
370 | @Override
371 | public boolean canMinimize()
372 | {
373 | return false;
374 | }
375 |
376 | @Override
377 | public boolean isStatic()
378 | {
379 | return true;
380 | }
381 | }
382 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/gui/window/WindowWaypoints.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.gui.window;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.core.Waypoint;
5 | import me.ichun.mods.blocksteps.common.gui.GuiWaypoints;
6 | import me.ichun.mods.blocksteps.common.gui.window.element.ElementWaypointList;
7 | import me.ichun.mods.ichunutil.client.gui.Theme;
8 | import me.ichun.mods.ichunutil.client.gui.window.Window;
9 | import me.ichun.mods.ichunutil.client.gui.window.element.Element;
10 | import me.ichun.mods.ichunutil.client.gui.window.element.ElementButtonTextured;
11 | import me.ichun.mods.ichunutil.client.gui.window.element.ElementListTree;
12 | import me.ichun.mods.ichunutil.client.render.RendererHelper;
13 | import net.minecraft.client.Minecraft;
14 | import net.minecraft.util.math.BlockPos;
15 | import net.minecraft.util.ResourceLocation;
16 |
17 | import java.util.ArrayList;
18 | import java.util.Collections;
19 |
20 | public class WindowWaypoints extends Window
21 | {
22 | public GuiWaypoints parent;
23 |
24 | public ElementWaypointList list;
25 |
26 | public static final int ID_DONE = -1;
27 | public static final int ID_NEW = 1;
28 | public static final int ID_DEL = 2;
29 | public static final int ID_DEL_MAP = 3;
30 |
31 | public WindowWaypoints(GuiWaypoints parent, int x, int y, int w, int h)
32 | {
33 | super(parent, x, y, w, h, 20, 20, "blocksteps.gui.waypoints", true);
34 |
35 | this.parent = parent;
36 |
37 | elements.add(new ElementButtonTextured(this, 5, parent.height - 40 - 5, ID_DONE, false, 0, 1, "gui.done", new ResourceLocation("blocksteps", "textures/icon/done.png")));
38 | elements.add(new ElementButtonTextured(this, 30, parent.height - 40 - 5, ID_NEW, false, 0, 1, "blocksteps.gui.newWaypoint", new ResourceLocation("blocksteps", "textures/icon/new.png")));
39 | elements.add(new ElementButtonTextured(this, 55, parent.height - 40 - 5, ID_DEL, false, 0, 1, "blocksteps.gui.deleteWaypoint", new ResourceLocation("blocksteps", "textures/icon/delete.png")));
40 | elements.add(new ElementButtonTextured(this, 80, parent.height - 40 - 5, ID_DEL_MAP, false, 0, 1, "blocksteps.gui.deleteMap", new ResourceLocation("blocksteps", "textures/icon/delMap.png")));
41 |
42 | list = new ElementWaypointList(this, 4, 14, 105 - 8, parent.height - 50 - 14, 0, false, false);
43 | elements.add(list);
44 | }
45 |
46 | @Override
47 | public void draw(int mouseX, int mouseY)
48 | {
49 | super.draw(mouseX, mouseY);
50 | RendererHelper.drawColourOnScreen(Theme.getAsHex(Theme.getInstance().windowBorder), 255, posX + BORDER_SIZE, posY + height - 25 - BORDER_SIZE, width - (BORDER_SIZE * 2), 1, 0);
51 |
52 | ArrayList creations = new ArrayList(Blocksteps.eventHandler.getWaypoints(Minecraft.getMinecraft().theWorld.provider.getDimension()));
53 | ArrayList keepOut = new ArrayList();
54 | for(int i = creations.size() - 1; i >= 0; i--)
55 | {
56 | if(creations.get(i).name.contains("New Waypoint") || creations.get(i).name.contains("Death Location"))
57 | {
58 | keepOut.add(creations.get(i));
59 | creations.remove(i);
60 | }
61 | }
62 | list.trees.clear();
63 | Collections.sort(creations);
64 | Collections.sort(keepOut);
65 | for(Waypoint wp : creations)
66 | {
67 | list.createTree(null, wp, 13, 0, false, false);
68 | }
69 | for(Waypoint wp : keepOut)
70 | {
71 | list.createTree(null, wp, 13, 0, false, false);
72 | }
73 | for(ElementListTree.Tree tree : list.trees)
74 | {
75 | if(list.selectedIdentifier.equals(((Waypoint)tree.attachedObject).getIdentifier()))
76 | {
77 | tree.selected = true;
78 | }
79 | }
80 | }
81 |
82 | @Override
83 | public void elementTriggered(Element element)
84 | {
85 | Minecraft mc = Minecraft.getMinecraft();
86 | if(element.id == ID_NEW)
87 | {
88 | if(mc.theWorld != null && mc.thePlayer != null)
89 | {
90 | ArrayList waypoints = Blocksteps.eventHandler.getWaypoints(mc.theWorld.provider.getDimension());
91 | waypoints.add(new Waypoint(new BlockPos(mc.thePlayer)));
92 | list.selectedIdentifier = waypoints.get(waypoints.size() - 1).getIdentifier();
93 | }
94 | }
95 | else if(element.id == ID_DEL)
96 | {
97 | for(ElementListTree.Tree tree : list.trees)
98 | {
99 | if(tree.selected)
100 | {
101 | workspace.addWindowOnTop(new WindowConfirmDelete(workspace, (Waypoint)tree.attachedObject).putInMiddleOfScreen());
102 | break;
103 | }
104 | }
105 | }
106 | else if(element.id == ID_DEL_MAP)
107 | {
108 | workspace.addWindowOnTop(new WindowConfirmDelete(workspace, null).putInMiddleOfScreen());
109 | }
110 | else if(element.id == ID_DONE)
111 | {
112 | Minecraft.getMinecraft().displayGuiScreen(null);
113 | }
114 | }
115 |
116 |
117 | @Override
118 | public void resized()
119 | {
120 | posX = 10;
121 | posY = 10;
122 | width = 105;
123 | height = parent.height - 20;
124 | super.resized();
125 | }
126 |
127 | @Override
128 | public int clickedOnBorder(int mouseX, int mouseY, int id)//only left clicks
129 | {
130 | return 0;
131 | }
132 |
133 | @Override
134 | public boolean canBeDragged()
135 | {
136 | return false;
137 | }
138 |
139 | @Override
140 | public boolean canMinimize()
141 | {
142 | return false;
143 | }
144 |
145 | @Override
146 | public boolean isStatic()
147 | {
148 | return true;
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/gui/window/element/ElementWaypointList.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.gui.window.element;
2 |
3 | import me.ichun.mods.blocksteps.common.core.Waypoint;
4 | import me.ichun.mods.blocksteps.common.gui.window.WindowWaypoints;
5 | import me.ichun.mods.ichunutil.client.gui.window.element.ElementListTree;
6 | import me.ichun.mods.ichunutil.client.render.RendererHelper;
7 | import net.minecraft.util.ResourceLocation;
8 |
9 | public class ElementWaypointList extends ElementListTree
10 | {
11 | public WindowWaypoints parent;
12 | public int mX;
13 | public int mY;
14 |
15 | public ElementWaypointList(WindowWaypoints window, int x, int y, int w, int h, int ID, boolean igMin, boolean drag)
16 | {
17 | super(window, x, y, w, h, ID, igMin, drag);
18 | parent = window;
19 | }
20 |
21 | @Override
22 | public void draw(int mouseX, int mouseY, boolean hover)
23 | {
24 | mX = mouseX;
25 | mY = mouseY;
26 | super.draw(mouseX, mouseY, hover);
27 | }
28 |
29 | @Override
30 | public void createTree(ResourceLocation loc, Object obj, int h, int attach, boolean expandable, boolean collapse)
31 | {
32 | trees.add(new TreeWaypoint(loc, obj, h, attach, expandable, collapse));
33 | }
34 |
35 | @Override
36 | public String tooltip()
37 | {
38 | int treeHeight = 0;
39 | int treeHeight1 = 0;
40 | for(int i = 0; i < trees.size(); i++)
41 | {
42 | Tree tree = trees.get(i);
43 | treeHeight1 += tree.getHeight();
44 | }
45 |
46 | int scrollHeight = 0;
47 | if(treeHeight1 > height)
48 | {
49 | scrollHeight = (int)((height - treeHeight1) * sliderProg);
50 | }
51 |
52 | for(int i = 0; i < trees.size(); i++)
53 | {
54 | Tree tree = trees.get(i);
55 |
56 | if(mX >= posX && mX < posX + width + (treeHeight1 > height ? 10 : 0) && mY >= posY + treeHeight + scrollHeight && mY < posY + treeHeight + scrollHeight + tree.getHeight())
57 | {
58 | return ((Waypoint)tree.attachedObject).name;
59 | }
60 |
61 | treeHeight += tree.getHeight();
62 | }
63 | return null; //return null for no tooltip. This is localized.
64 | }
65 |
66 | public class TreeWaypoint extends Tree
67 | {
68 | public TreeWaypoint(ResourceLocation loc, Object obj, int h, int attach, boolean expandable, boolean collapse)
69 | {
70 | super(loc, obj, h, attach, expandable, collapse);
71 | }
72 |
73 | public Tree draw(int mouseX, int mouseY, boolean hover, int width, int treeHeight, boolean hasScroll, int totalHeight, boolean clicking, boolean rClicking)
74 | {
75 | Tree tree = super.draw(mouseX, mouseY, hover, width, treeHeight, hasScroll, totalHeight, clicking, rClicking);
76 |
77 | RendererHelper.drawColourOnScreen(((Waypoint)attachedObject).colour, 255, getPosX() + 1, getPosY() + treeHeight + 1, 11, 11, 0);
78 |
79 | return tree;
80 | }
81 | }
82 |
83 | }
84 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/layer/LayerSheepPig.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.layer;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.model.ModelSheepPig;
5 | import net.minecraft.client.Minecraft;
6 | import net.minecraft.client.renderer.GlStateManager;
7 | import net.minecraft.client.renderer.entity.RenderPig;
8 | import net.minecraft.client.renderer.entity.layers.LayerRenderer;
9 | import net.minecraft.entity.EntityLivingBase;
10 | import net.minecraft.entity.passive.EntityPig;
11 | import net.minecraft.entity.passive.EntitySheep;
12 | import net.minecraft.item.EnumDyeColor;
13 | import net.minecraft.util.ResourceLocation;
14 |
15 | public class LayerSheepPig implements LayerRenderer
16 | {
17 | public ModelSheepPig modelSheepPig = new ModelSheepPig();
18 | private static final ResourceLocation texSheepPig = new ResourceLocation("blocksteps","textures/model/sheeppig.png");
19 | private final RenderPig renderPig;
20 |
21 | public LayerSheepPig(RenderPig renderPig)
22 | {
23 | this.renderPig = renderPig;
24 | }
25 |
26 | //func_177093_a(entity, f8, f7, partialTicks, f5, f4, f9, 0.0625F);
27 | public void doRenderLayer(EntityPig pig, float f, float f1, float renderTick, float f2, float f3, float f4, float f5)
28 | {
29 | if(Blocksteps.config.easterEgg == 1 && Blocksteps.eventHandler.renderingMinimap && !pig.isInvisible())
30 | {
31 | Minecraft.getMinecraft().getTextureManager().bindTexture(texSheepPig);
32 |
33 | if (pig.hasCustomName() && "iChun".equals(pig.getCustomNameTag()))
34 | {
35 | int i = Minecraft.getMinecraft().thePlayer.ticksExisted / 25 + pig.getEntityId();
36 | int j = EnumDyeColor.values().length;
37 | int k = i % j;
38 | int l = (i + 1) % j;
39 | float f7 = ((float)(Minecraft.getMinecraft().thePlayer.ticksExisted % 25) + renderTick) / 25.0F;
40 | float[] afloat1 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(k));
41 | float[] afloat2 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(l));
42 | GlStateManager.color(afloat1[0] * (1.0F - f7) + afloat2[0] * f7, afloat1[1] * (1.0F - f7) + afloat2[1] * f7, afloat1[2] * (1.0F - f7) + afloat2[2] * f7);
43 | }
44 | else
45 | {
46 | float[] afloat = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(pig.getEntityId() & 15));
47 | GlStateManager.color(afloat[0], afloat[1], afloat[2]);
48 | }
49 |
50 | modelSheepPig.setModelAttributes(renderPig.getMainModel());
51 | modelSheepPig.setLivingAnimations(pig, f, f1, renderTick);
52 | modelSheepPig.render(pig, f, f1, f2, f3, f4, f5);
53 | }
54 | }
55 |
56 | @Override
57 | public boolean shouldCombineTextures()
58 | {
59 | return true;
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/model/ModelSheepPig.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.model;
2 |
3 | import net.minecraft.client.model.ModelPig;
4 | import net.minecraft.client.model.ModelRenderer;
5 |
6 | /**
7 | * ModelPig - Either Mojang or a mod author
8 | * Created using Tabula 5.1.0
9 | */
10 | public class ModelSheepPig extends ModelPig
11 | {
12 |
13 | public ModelSheepPig()
14 | {
15 | super(0.0F);
16 | this.textureWidth = 64;
17 | this.textureHeight = 64;
18 | this.leg4 = new ModelRenderer(this, 0, 48);
19 | this.leg4.setRotationPoint(3.0F, 18.0F, -5.0F);
20 | this.leg4.addBox(-2.0F, 0.5F, -2.0F, 4, 4, 4, 0.5F);
21 | this.leg2 = new ModelRenderer(this, 0, 48);
22 | this.leg2.setRotationPoint(3.0F, 18.0F, 7.0F);
23 | this.leg2.addBox(-2.0F, 0.48F, -2.0F, 4, 4, 4, 0.5F);
24 | this.body = new ModelRenderer(this, 24, 38);
25 | this.body.setRotationPoint(-0.5F, 11.5F, 1.5F);
26 | this.body.addBox(-5.0F, -10.0F, -7.0F, 11, 17, 9, 0.0F);
27 | this.setRotateAngle(body, 1.5707963267948966F, 0.0F, 0.0F);
28 | this.leg3 = new ModelRenderer(this, 0, 48);
29 | this.leg3.setRotationPoint(-3.0F, 18.0F, -5.0F);
30 | this.leg3.addBox(-2.0F, 0.5F, -2.0F, 4, 4, 4, 0.5F);
31 | this.leg1 = new ModelRenderer(this, 0, 48);
32 | this.leg1.setRotationPoint(-3.0F, 18.0F, 7.0F);
33 | this.leg1.addBox(-2.0F, 0.48F, -2.0F, 4, 4, 4, 0.5F);
34 | this.head = new ModelRenderer(this, 22, 33);
35 | this.head.setRotationPoint(0.0F, 12.0F, -6.0F);
36 | this.head.addBox(-4.5F, -4.5F, -6.5F, 9, 9, 7, 0.0F);
37 | }
38 |
39 | /**
40 | * This is a helper function from Tabula to set the rotation of model parts
41 | */
42 | public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
43 | modelRenderer.rotateAngleX = x;
44 | modelRenderer.rotateAngleY = y;
45 | modelRenderer.rotateAngleZ = z;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/model/ModelWaypoint.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.model;
2 |
3 | import net.minecraft.client.model.ModelBase;
4 | import net.minecraft.client.model.ModelRenderer;
5 | import net.minecraft.client.renderer.GlStateManager;
6 | import net.minecraft.entity.Entity;
7 | import net.minecraftforge.fml.relauncher.Side;
8 | import net.minecraftforge.fml.relauncher.SideOnly;
9 |
10 | @SideOnly(Side.CLIENT)
11 | public class ModelWaypoint extends ModelBase
12 | {
13 | private ModelRenderer glass = new ModelRenderer(this, "glass");
14 |
15 | public ModelWaypoint()
16 | {
17 | this.glass.setTextureOffset(0, 0).addBox(-4.0F, -4.0F, -4.0F, 8, 8, 8);
18 | }
19 |
20 | public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
21 | {
22 | GlStateManager.pushMatrix();
23 | GlStateManager.scale(2.0F, 2.0F, 2.0F);
24 | GlStateManager.translate(0.0F, -0.5F, 0.0F);
25 | GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F);
26 | GlStateManager.translate(0.0F, 0.8F, 0.0F);
27 | GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F);
28 | this.glass.render(scale);
29 | float f6 = 0.875F;
30 | GlStateManager.scale(f6, f6, f6);
31 | GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F);
32 | GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F);
33 | this.glass.render(scale);
34 | GlStateManager.scale(f6, f6, f6);
35 | GlStateManager.rotate(60.0F, 0.7071F, 0.0F, 0.7071F);
36 | GlStateManager.rotate(p_78088_3_, 0.0F, 1.0F, 0.0F);
37 | this.glass.render(scale);
38 | GlStateManager.popMatrix();
39 | }
40 | }
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/render/ListChunkFactoryBlocksteps.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.render;
2 |
3 | import net.minecraft.client.renderer.RenderGlobal;
4 | import net.minecraft.client.renderer.chunk.IRenderChunkFactory;
5 | import net.minecraft.client.renderer.chunk.RenderChunk;
6 | import net.minecraft.world.World;
7 |
8 | public class ListChunkFactoryBlocksteps implements IRenderChunkFactory
9 | {
10 | @Override
11 | public RenderChunk create(World worldIn, RenderGlobal globalRenderer, int index)
12 | {
13 | return new ListedRenderChunkBlocksteps(worldIn, globalRenderer, index);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/render/ListedRenderChunkBlocksteps.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.render;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.core.ChunkStore;
5 | import net.minecraft.block.Block;
6 | import net.minecraft.block.state.IBlockState;
7 | import net.minecraft.client.Minecraft;
8 | import net.minecraft.client.renderer.RegionRenderCache;
9 | import net.minecraft.client.renderer.RenderGlobal;
10 | import net.minecraft.client.renderer.WorldRenderer;
11 | import net.minecraft.client.renderer.chunk.ChunkCompileTaskGenerator;
12 | import net.minecraft.client.renderer.chunk.CompiledChunk;
13 | import net.minecraft.client.renderer.chunk.ListedRenderChunk;
14 | import net.minecraft.client.renderer.chunk.VisGraph;
15 | import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
16 | import net.minecraft.tileentity.TileEntity;
17 | import net.minecraft.util.BlockRenderLayer;
18 | import net.minecraft.util.EnumBlockRenderType;
19 | import net.minecraft.util.math.BlockPos;
20 | import net.minecraft.util.BlockRenderLayer;
21 | import net.minecraft.world.World;
22 |
23 | import java.util.Iterator;
24 |
25 | public class ListedRenderChunkBlocksteps extends ListedRenderChunk
26 | {
27 | public ListedRenderChunkBlocksteps(World worldIn, RenderGlobal renderGlobalIn, int indexIn)
28 | {
29 | super(worldIn, renderGlobalIn, indexIn);
30 | }
31 |
32 | @Override
33 | public void rebuildChunk(float x, float y, float z, ChunkCompileTaskGenerator generator)
34 | {
35 | CompiledChunk compiledchunk = new CompiledChunk();
36 | BlockPos blockpos = this.position;
37 | BlockPos blockpos1 = blockpos.add(15, 15, 15);
38 | generator.getLock().lock();
39 | RegionRenderCache regionrendercache;
40 |
41 | try
42 | {
43 | if (generator.getStatus() != ChunkCompileTaskGenerator.Status.COMPILING)
44 | {
45 | return;
46 | }
47 |
48 | regionrendercache = new RegionRenderCacheBlocksteps(this.world, blockpos.add(-1, -1, -1), blockpos1.add(1, 1, 1), 1);
49 | generator.setCompiledChunk(compiledchunk);
50 | }
51 | finally
52 | {
53 | generator.getLock().unlock();
54 | }
55 |
56 | VisGraph visgraph = new VisGraph();
57 |
58 | Minecraft mc = Minecraft.getMinecraft();
59 |
60 | if (!regionrendercache.extendedLevelsInChunkCache())
61 | {
62 | ++renderChunksUpdated;
63 | Iterator iterator = BlockPos.getAllInBoxMutable(blockpos, blockpos1).iterator();
64 |
65 | while (iterator.hasNext())
66 | {
67 | BlockPos.MutableBlockPos mutableblockpos = (BlockPos.MutableBlockPos)iterator.next();
68 | IBlockState iblockstate = regionrendercache.getBlockState(mutableblockpos);
69 | Block block = iblockstate.getBlock();
70 |
71 | if(Blocksteps.config.mapType == 2)
72 | {
73 | synchronized(Blocksteps.eventHandler.threadCrawlBlocks.surface)
74 | {
75 | renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc);
76 | }
77 | }
78 | else
79 | {
80 | renderBlock(mutableblockpos, iblockstate, block, visgraph, regionrendercache, generator, compiledchunk, blockpos, mc);
81 | }
82 | }
83 |
84 | BlockRenderLayer[] aenumworldblocklayer = BlockRenderLayer.values();
85 | int j = aenumworldblocklayer.length;
86 |
87 | for (int k = 0; k < j; ++k)
88 | {
89 | BlockRenderLayer enumworldblocklayer = aenumworldblocklayer[k];
90 |
91 | if (compiledchunk.isLayerStarted(enumworldblocklayer))
92 | {
93 | this.postRenderBlocks(enumworldblocklayer, x, y, z, generator.getRegionRenderCacheBuilder().getWorldRendererByLayer(enumworldblocklayer), compiledchunk);
94 | }
95 | }
96 | }
97 |
98 | compiledchunk.setVisibility(visgraph.computeVisibility());
99 | }
100 |
101 | public void renderBlock(BlockPos.MutableBlockPos mutableblockpos, IBlockState iblockstate, Block block, VisGraph visgraph, RegionRenderCache regionrendercache, ChunkCompileTaskGenerator generator, CompiledChunk compiledchunk, BlockPos blockpos, Minecraft mc)
102 | {
103 | boolean hasBlock = ChunkStore.contains(mutableblockpos) || Blocksteps.config.mapType == 3 || Blocksteps.config.mapType == 4;
104 |
105 | if (block.isOpaqueCube())
106 | {
107 | visgraph.func_178606_a(mutableblockpos);
108 | }
109 |
110 | if (hasBlock && block.hasTileEntity(iblockstate))
111 | {
112 | TileEntity tileentity = regionrendercache.getTileEntity(new BlockPos(mutableblockpos));
113 |
114 | if (tileentity != null && TileEntityRendererDispatcher.instance.hasSpecialRenderer(tileentity))
115 | {
116 | compiledchunk.addTileEntity(tileentity);
117 | }
118 | }
119 |
120 | for(BlockRenderLayer enumworldblocklayer1 : BlockRenderLayer.values()) {
121 | if(!block.canRenderInLayer(enumworldblocklayer1)) continue;
122 | net.minecraftforge.client.ForgeHooksClient.setRenderLayer(enumworldblocklayer1);
123 | int i = enumworldblocklayer1.ordinal();
124 |
125 | if (block.getDefaultState().getRenderType() != EnumBlockRenderType.INVISIBLE)
126 | {
127 | WorldRenderer worldrenderer = generator.getRegionRenderCacheBuilder().getWorldRendererByLayerId(i);
128 |
129 | if (!compiledchunk.isLayerStarted(enumworldblocklayer1))
130 | {
131 | compiledchunk.setLayerStarted(enumworldblocklayer1);
132 | this.preRenderBlocks(worldrenderer, blockpos);
133 | }
134 |
135 | if (hasBlock && mc.getBlockRendererDispatcher().renderBlock(iblockstate, mutableblockpos, regionrendercache, worldrenderer))
136 | {
137 | compiledchunk.setLayerUsed(enumworldblocklayer1);
138 | }
139 | }
140 | }
141 | }
142 | }
143 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/render/RegionRenderCacheBlocksteps.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.render;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.core.ChunkStore;
5 | import net.minecraft.block.state.IBlockState;
6 | import net.minecraft.client.Minecraft;
7 | import net.minecraft.client.renderer.RegionRenderCache;
8 | import net.minecraft.init.Blocks;
9 | import net.minecraft.util.math.BlockPos;
10 | import net.minecraft.world.World;
11 |
12 | public class RegionRenderCacheBlocksteps extends RegionRenderCache
13 | {
14 | public RegionRenderCacheBlocksteps(World worldIn, BlockPos posFromIn, BlockPos posToIn, int subIn)
15 | {
16 | super(worldIn, posFromIn, posToIn, subIn);
17 | }
18 |
19 | @Override
20 | public IBlockState getBlockState(BlockPos pos)
21 | {
22 | if(Blocksteps.config.mapType == 4)
23 | {
24 | Minecraft mc = Minecraft.getMinecraft();
25 | int rangeHori = (Blocksteps.config.renderDistance == 0 ? (mc.gameSettings.renderDistanceChunks - 1) : (Blocksteps.config.renderDistance - 1)) * 16;
26 | double dx = pos.getX() - mc.thePlayer.posX;
27 | double dz = pos.getZ() - mc.thePlayer.posZ;
28 | double dist = Math.sqrt(dx * dx + dz * dz);
29 | if(dist > rangeHori)
30 | {
31 | return Blocks.AIR.getDefaultState();
32 | }
33 | }
34 | else if(Blocksteps.config.mapType != 3 && !ChunkStore.contains(pos))
35 | {
36 | return Blocks.AIR.getDefaultState();
37 | }
38 | return super.getBlockState(pos);
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/render/RenderGlobalProxy.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.render;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.core.ChunkStore;
5 | import me.ichun.mods.blocksteps.common.core.Waypoint;
6 | import net.minecraft.block.Block;
7 | import net.minecraft.client.Minecraft;
8 | import net.minecraft.client.particle.Particle;
9 | import net.minecraft.client.renderer.*;
10 | import net.minecraft.client.renderer.culling.ICamera;
11 | import net.minecraft.client.renderer.entity.RenderManager;
12 | import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
13 | import net.minecraft.client.renderer.vertex.VertexBuffer;
14 | import net.minecraft.entity.Entity;
15 | import net.minecraft.entity.player.EntityPlayer;
16 | import net.minecraft.entity.projectile.EntityWitherSkull;
17 | import net.minecraft.init.Blocks;
18 | import net.minecraft.init.Items;
19 | import net.minecraft.item.Item;
20 | import net.minecraft.item.ItemDye;
21 | import net.minecraft.potion.PotionType;
22 | import net.minecraft.potion.PotionUtils;
23 | import net.minecraft.tileentity.TileEntity;
24 | import net.minecraft.tileentity.TileEntityChest;
25 | import net.minecraft.util.EnumParticleTypes;
26 | import net.minecraft.util.SoundCategory;
27 | import net.minecraft.util.SoundEvent;
28 | import net.minecraft.util.math.BlockPos;
29 | import net.minecraft.util.EnumFacing;
30 | import net.minecraft.util.math.MathHelper;
31 | import net.minecraft.world.chunk.Chunk;
32 | import net.minecraftforge.fml.relauncher.Side;
33 | import net.minecraftforge.fml.relauncher.SideOnly;
34 | import org.lwjgl.opengl.GL11;
35 |
36 | import javax.annotation.Nullable;
37 | import java.util.ArrayList;
38 | import java.util.Iterator;
39 | import java.util.List;
40 | import java.util.Random;
41 |
42 | @SideOnly(Side.CLIENT)
43 | public class RenderGlobalProxy extends RenderGlobal
44 | {
45 | public boolean setupTerrain = false;
46 |
47 | public RenderGlobalProxy(Minecraft par1Minecraft)
48 | {
49 | super(par1Minecraft);
50 | }
51 |
52 | @Override
53 | public void loadRenderers()
54 | {
55 | if (this.theWorld != null && !setupTerrain)
56 | {
57 | this.displayListEntitiesDirty = true;
58 | Blocks.LEAVES.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);
59 | Blocks.LEAVES2.setGraphicsLevel(this.mc.gameSettings.fancyGraphics);
60 | this.renderDistanceChunks = Blocksteps.config.renderDistance > 0 ? Blocksteps.config.renderDistance : this.mc.gameSettings.renderDistanceChunks;
61 | boolean flag = this.vboEnabled;
62 | this.vboEnabled = OpenGlHelper.useVbo();
63 |
64 | this.renderContainer = new RenderList();
65 | this.renderChunkFactory = new ListChunkFactoryBlocksteps();
66 |
67 | if (flag != this.vboEnabled)
68 | {
69 | this.generateStars();
70 | this.generateSky();
71 | this.generateSky2();
72 | }
73 |
74 | if (this.viewFrustum != null)
75 | {
76 | this.viewFrustum.deleteGlResources();
77 | }
78 |
79 | this.stopChunkUpdates();
80 | this.viewFrustum = new ViewFrustum(this.theWorld, this.mc.gameSettings.renderDistanceChunks, this, this.renderChunkFactory);
81 |
82 | if (this.theWorld != null)
83 | {
84 | Entity entity = this.mc.getRenderViewEntity();
85 |
86 | if (entity != null)
87 | {
88 | this.viewFrustum.updateChunkPositions(entity.posX, entity.posZ);
89 | }
90 | }
91 |
92 | this.renderEntitiesStartupCounter = 2;
93 | }
94 | }
95 |
96 | @Override
97 | public void generateSky2()
98 | {
99 | if (this.sky2VBO != null)
100 | {
101 | this.sky2VBO.deleteGlBuffers();
102 | }
103 |
104 | if (this.glSkyList2 >= 0)
105 | {
106 | GLAllocation.deleteDisplayLists(this.glSkyList2);
107 | this.glSkyList2 = -1;
108 | }
109 |
110 | if (this.vboEnabled)
111 | {
112 | this.sky2VBO = new VertexBuffer(this.vertexBufferFormat);
113 | }
114 | else
115 | {
116 | this.glSkyList2 = GLAllocation.generateDisplayLists(1);
117 | GL11.glNewList(this.glSkyList2, GL11.GL_COMPILE);
118 | GL11.glEndList();
119 | }
120 | }
121 |
122 | @Override
123 | public void generateSky()
124 | {
125 | if (this.skyVBO != null)
126 | {
127 | this.skyVBO.deleteGlBuffers();
128 | }
129 |
130 | if (this.glSkyList >= 0)
131 | {
132 | GLAllocation.deleteDisplayLists(this.glSkyList);
133 | this.glSkyList = -1;
134 | }
135 |
136 | if (this.vboEnabled)
137 | {
138 | this.skyVBO = new VertexBuffer(this.vertexBufferFormat);
139 | }
140 | else
141 | {
142 | this.glSkyList = GLAllocation.generateDisplayLists(1);
143 | GL11.glNewList(this.glSkyList, GL11.GL_COMPILE);
144 | GL11.glEndList();
145 | }
146 | }
147 |
148 | @Override
149 | public void renderEntities(Entity renderViewEntity, ICamera camera, float partialTicks)
150 | {
151 | int pass = net.minecraftforge.client.MinecraftForgeClient.getRenderPass();
152 | if (this.renderEntitiesStartupCounter > 0)
153 | {
154 | if (pass > 0) return;
155 | --this.renderEntitiesStartupCounter;
156 | }
157 | else
158 | {
159 | double d0 = renderViewEntity.prevPosX + (renderViewEntity.posX - renderViewEntity.prevPosX) * (double)partialTicks;
160 | double d1 = renderViewEntity.prevPosY + (renderViewEntity.posY - renderViewEntity.prevPosY) * (double)partialTicks;
161 | double d2 = renderViewEntity.prevPosZ + (renderViewEntity.posZ - renderViewEntity.prevPosZ) * (double)partialTicks;
162 | this.theWorld.theProfiler.startSection("prepare");
163 | TileEntityRendererDispatcher.instance.prepare(this.theWorld, this.mc.getTextureManager(), this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.objectMouseOver, partialTicks);
164 | this.renderManager.cacheActiveRenderInfo(this.theWorld, this.mc.fontRendererObj, this.mc.getRenderViewEntity(), this.mc.pointedEntity, this.mc.gameSettings, partialTicks);
165 | if (pass == 0) // no indentation to shrink patch
166 | {
167 | this.countEntitiesTotal = 0;
168 | this.countEntitiesRendered = 0;
169 | this.countEntitiesHidden = 0;
170 | }
171 | Entity entity1 = this.mc.getRenderViewEntity();
172 | double d3 = entity1.lastTickPosX + (entity1.posX - entity1.lastTickPosX) * (double)partialTicks;
173 | double d4 = entity1.lastTickPosY + (entity1.posY - entity1.lastTickPosY) * (double)partialTicks;
174 | double d5 = entity1.lastTickPosZ + (entity1.posZ - entity1.lastTickPosZ) * (double)partialTicks;
175 | TileEntityRendererDispatcher.staticPlayerX = d3;
176 | TileEntityRendererDispatcher.staticPlayerY = d4;
177 | TileEntityRendererDispatcher.staticPlayerZ = d5;
178 | this.renderManager.setRenderPosition(d3, d4, d5);
179 | this.mc.entityRenderer.enableLightmap();
180 | this.theWorld.theProfiler.endStartSection("global");
181 | List list = this.theWorld.getLoadedEntityList();
182 | if (pass == 0) // no indentation to shrink patch
183 | {
184 | this.countEntitiesTotal = list.size();
185 | }
186 |
187 | RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
188 | float viewX = rendermanager.playerViewX;
189 | float viewY = rendermanager.playerViewY;
190 | rendermanager.playerViewX = Blocksteps.eventHandler.angleX;
191 | rendermanager.setPlayerViewY(Blocksteps.eventHandler.angleY + 180F);
192 |
193 | int i;
194 | Entity entity2;
195 |
196 | for (i = 0; i < this.theWorld.weatherEffects.size(); ++i)
197 | {
198 | entity2 = (Entity)this.theWorld.weatherEffects.get(i);
199 | if (!entity2.shouldRenderInPass(pass)) continue;
200 | ++this.countEntitiesRendered;
201 |
202 | if (shouldRenderEntity(entity2) && entity2.isInRangeToRender3d(d0, d1, d2))
203 | {
204 | this.renderManager.renderEntityStatic(entity2, partialTicks, false);
205 | }
206 | }
207 |
208 | this.theWorld.theProfiler.endStartSection("entities");
209 | Iterator iterator = this.renderInfos.iterator();
210 | RenderGlobal.ContainerLocalRenderInformation containerlocalrenderinformation;
211 |
212 | while (iterator.hasNext())
213 | {
214 | containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator.next();
215 | Chunk chunk = this.theWorld.getChunkFromBlockCoords(containerlocalrenderinformation.renderChunk.getPosition());
216 | Iterator iterator2 = chunk.getEntityLists()[containerlocalrenderinformation.renderChunk.getPosition().getY() / 16].iterator();
217 |
218 | while (iterator2.hasNext())
219 | {
220 | Entity entity3 = (Entity)iterator2.next();
221 | if (!entity3.shouldRenderInPass(pass)) continue;
222 | boolean flag2 = this.renderManager.shouldRender(entity3, camera, d0, d1, d2) || entity3.riddenByEntity == this.mc.thePlayer;
223 |
224 | if (flag2)
225 | {
226 | if (!shouldRenderEntity(entity3) || entity3.posY >= 0.0D && entity3.posY < 256.0D && !this.theWorld.isBlockLoaded(new BlockPos(entity3)))
227 | {
228 | continue;
229 | }
230 |
231 | ++this.countEntitiesRendered;
232 | this.renderManager.renderEntitySimple(entity3, partialTicks);
233 | }
234 |
235 | if (!flag2 && entity3 instanceof EntityWitherSkull && shouldRenderEntity(entity3))
236 | {
237 | this.mc.getRenderManager().renderWitherSkull(entity3, partialTicks);
238 | }
239 | }
240 | }
241 |
242 | if(!Blocksteps.eventHandler.hideWaypoints)
243 | {
244 | ArrayList points = Blocksteps.eventHandler.getWaypoints(mc.theWorld.provider.getDimension());
245 | for(Waypoint wp : points)
246 | {
247 | double dx = mc.thePlayer.posX - (wp.pos.getX() + 0.5D);
248 | double dz = mc.thePlayer.posZ - (wp.pos.getZ() + 0.5D);
249 | double dist = Math.sqrt(dx * dx + dz * dz);
250 | if(wp.renderRange == 0 || dist < wp.renderRange * 10D)
251 | {
252 | wp.render(renderManager.renderPosX, renderManager.renderPosY, renderManager.renderPosZ, partialTicks, false);
253 | }
254 | }
255 | }
256 |
257 | rendermanager.playerViewX = viewX;
258 | rendermanager.setPlayerViewY(viewY);
259 |
260 | this.theWorld.theProfiler.endStartSection("blockentities");
261 | RenderHelper.enableStandardItemLighting();
262 | iterator = this.renderInfos.iterator();
263 | TileEntity tileentity;
264 |
265 | while (iterator.hasNext())
266 | {
267 | containerlocalrenderinformation = (RenderGlobal.ContainerLocalRenderInformation)iterator.next();
268 | Iterator iterator1 = containerlocalrenderinformation.renderChunk.getCompiledChunk().getTileEntities().iterator();
269 |
270 | while (iterator1.hasNext())
271 | {
272 | tileentity = (TileEntity)iterator1.next();
273 | if (!tileentity.shouldRenderInPass(pass) || !camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox())) continue;
274 | TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, -1);
275 | }
276 | }
277 |
278 | this.preRenderDamagedBlocks();
279 | iterator = this.damagedBlocks.values().iterator();
280 |
281 | while (iterator.hasNext())
282 | {
283 | DestroyBlockProgress destroyblockprogress = (DestroyBlockProgress)iterator.next();
284 | BlockPos blockpos = destroyblockprogress.getPosition();
285 | tileentity = this.theWorld.getTileEntity(blockpos);
286 |
287 | if (tileentity instanceof TileEntityChest)
288 | {
289 | TileEntityChest tileentitychest = (TileEntityChest)tileentity;
290 |
291 | if (tileentitychest.adjacentChestXNeg != null)
292 | {
293 | blockpos = blockpos.offset(EnumFacing.WEST);
294 | tileentity = this.theWorld.getTileEntity(blockpos);
295 | }
296 | else if (tileentitychest.adjacentChestZNeg != null)
297 | {
298 | blockpos = blockpos.offset(EnumFacing.NORTH);
299 | tileentity = this.theWorld.getTileEntity(blockpos);
300 | }
301 | }
302 |
303 | Block block = this.theWorld.getBlockState(blockpos).getBlock();
304 |
305 | if (tileentity != null && tileentity.shouldRenderInPass(pass) && tileentity.canRenderBreaking() && camera.isBoundingBoxInFrustum(tileentity.getRenderBoundingBox()))
306 | {
307 | TileEntityRendererDispatcher.instance.renderTileEntity(tileentity, partialTicks, destroyblockprogress.getPartialBlockDamage());
308 | }
309 | }
310 |
311 | this.postRenderDamagedBlocks();
312 | this.mc.entityRenderer.disableLightmap();
313 | this.mc.mcProfiler.endSection();
314 | }
315 | }
316 |
317 | public boolean shouldRenderEntity(Entity entity)
318 | {
319 | BlockPos pos = new BlockPos(entity);
320 |
321 | Minecraft mc = Minecraft.getMinecraft();
322 |
323 | if(Blocksteps.config.mapType == 3 || entity == mc.getRenderViewEntity() || entity instanceof EntityPlayer && Blocksteps.config.trackOtherPlayers == 1 || mc.getRenderViewEntity() != null && ((entity == mc.getRenderViewEntity().riddenByEntity || entity == mc.getRenderViewEntity().ridingEntity) || mc.getRenderViewEntity().ridingEntity != null && entity == mc.getRenderViewEntity().ridingEntity.ridingEntity))
324 | {
325 | return true;
326 | }
327 | else if(Blocksteps.config.mapType == 4)
328 | {
329 | int rangeHori = (Blocksteps.config.renderDistance == 0 ? (mc.gameSettings.renderDistanceChunks - 1) : (Blocksteps.config.renderDistance - 1)) * 16;
330 | double dx = pos.getX() - mc.thePlayer.posX;
331 | double dz = pos.getZ() - mc.thePlayer.posZ;
332 | double dist = Math.sqrt(dx * dx + dz * dz);
333 | return dist < rangeHori;
334 | }
335 |
336 | return Blocksteps.config.mapShowEntities == 1 && (ChunkStore.contains(pos) || ChunkStore.contains(pos.add(0, -1, 0)) || ChunkStore.contains(pos.add(0, -2, 0)));
337 | }
338 |
339 | public void markAllForUpdateFromPos(BlockPos ref)
340 | {
341 | int rangeHori = Math.max((Blocksteps.config.renderDistance == 0 ? (mc.gameSettings.renderDistanceChunks) : (Blocksteps.config.renderDistance)), 1) * 16;
342 | BlockPos min = ref.add(-rangeHori, 0, -rangeHori);
343 | BlockPos max = ref.add(rangeHori, 0, rangeHori);
344 | markBlocksForUpdate(min.getX(), 0, min.getZ(), max.getX(), theWorld.getActualHeight(), max.getZ());
345 | }
346 |
347 | @Override
348 | public void playRecord(@Nullable SoundEvent soundIn, BlockPos pos){}
349 |
350 | @Override
351 | public void playSoundToAllNearExcept(@Nullable EntityPlayer player, SoundEvent soundIn, SoundCategory category, double x, double y, double z, float volume, float pitch){}
352 |
353 | @Override
354 | public void broadcastSound(int soundID, BlockPos pos, int data){}
355 |
356 | @Override
357 | public void playEvent(EntityPlayer player, int type, BlockPos blockPosIn, int data) //Remove every case that plays sound instead
358 | {
359 | Random random = this.theWorld.rand;
360 |
361 | switch (type)
362 | {
363 | case 2000:
364 | int i1 = data % 3 - 1;
365 | int i = data / 3 % 3 - 1;
366 | double d8 = (double)blockPosIn.getX() + (double)i1 * 0.6D + 0.5D;
367 | double d10 = (double)blockPosIn.getY() + 0.5D;
368 | double d12 = (double)blockPosIn.getZ() + (double)i * 0.6D + 0.5D;
369 |
370 | for (int k1 = 0; k1 < 10; ++k1)
371 | {
372 | double d13 = random.nextDouble() * 0.2D + 0.01D;
373 | double d14 = d8 + (double)i1 * 0.01D + (random.nextDouble() - 0.5D) * (double)i * 0.5D;
374 | double d17 = d10 + (random.nextDouble() - 0.5D) * 0.5D;
375 | double d20 = d12 + (double)i * 0.01D + (random.nextDouble() - 0.5D) * (double)i1 * 0.5D;
376 | double d23 = (double)i1 * d13 + random.nextGaussian() * 0.01D;
377 | double d25 = -0.03D + random.nextGaussian() * 0.01D;
378 | double d27 = (double)i * d13 + random.nextGaussian() * 0.01D;
379 | this.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d14, d17, d20, d23, d25, d27, new int[0]);
380 | }
381 |
382 | return;
383 | case 2001:
384 | Block block = Block.getBlockById(data & 4095);
385 | this.mc.effectRenderer.addBlockDestroyEffects(blockPosIn, block.getStateFromMeta(data >> 12 & 255));
386 | break;
387 | case 2002:
388 | double d6 = (double)blockPosIn.getX();
389 | double d7 = (double)blockPosIn.getY();
390 | double d9 = (double)blockPosIn.getZ();
391 |
392 | for (int j1 = 0; j1 < 8; ++j1)
393 | {
394 | this.spawnParticle(EnumParticleTypes.ITEM_CRACK, d6, d7, d9, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[] { Item.getIdFromItem(Items.SPLASH_POTION)});
395 | }
396 |
397 | PotionType potiontype = PotionType.getPotionTypeForID(data);
398 | int k = PotionUtils.getPotionColor(potiontype);
399 | float f = (float)(k >> 16 & 255) / 255.0F;
400 | float f1 = (float)(k >> 8 & 255) / 255.0F;
401 | float f2 = (float)(k >> 0 & 255) / 255.0F;
402 | EnumParticleTypes enumparticletypes = potiontype.hasInstantEffect() ? EnumParticleTypes.SPELL_INSTANT : EnumParticleTypes.SPELL;
403 |
404 | for (int i2 = 0; i2 < 100; ++i2)
405 | {
406 | double d16 = random.nextDouble() * 4.0D;
407 | double d19 = random.nextDouble() * Math.PI * 2.0D;
408 | double d22 = Math.cos(d19) * d16;
409 | double d24 = 0.01D + random.nextDouble() * 0.5D;
410 | double d26 = Math.sin(d19) * d16;
411 | Particle particle1 = this.spawnEntityFX(enumparticletypes.getParticleID(), enumparticletypes.getShouldIgnoreRange(), d6 + d22 * 0.1D, d7 + 0.3D, d9 + d26 * 0.1D, d22, d24, d26, new int[0]);
412 |
413 | if (particle1 != null)
414 | {
415 | float f5 = 0.75F + random.nextFloat() * 0.25F;
416 | particle1.setRBGColorF(f * f5, f1 * f5, f2 * f5);
417 | particle1.multiplyVelocity((float)d16);
418 | }
419 | }
420 | break;
421 | case 2003:
422 | double d0 = (double)blockPosIn.getX() + 0.5D;
423 | double d1 = (double)blockPosIn.getY();
424 | double d2 = (double)blockPosIn.getZ() + 0.5D;
425 |
426 | for (int j = 0; j < 8; ++j)
427 | {
428 | this.spawnParticle(EnumParticleTypes.ITEM_CRACK, d0, d1, d2, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D, new int[] {Item.getIdFromItem(Items.ENDER_EYE)});
429 | }
430 |
431 | for (double d11 = 0.0D; d11 < (Math.PI * 2D); d11 += 0.15707963267948966D)
432 | {
433 | this.spawnParticle(EnumParticleTypes.PORTAL, d0 + Math.cos(d11) * 5.0D, d1 - 0.4D, d2 + Math.sin(d11) * 5.0D, Math.cos(d11) * -5.0D, 0.0D, Math.sin(d11) * -5.0D, new int[0]);
434 | this.spawnParticle(EnumParticleTypes.PORTAL, d0 + Math.cos(d11) * 5.0D, d1 - 0.4D, d2 + Math.sin(d11) * 5.0D, Math.cos(d11) * -7.0D, 0.0D, Math.sin(d11) * -7.0D, new int[0]);
435 | }
436 |
437 | return;
438 | case 2004:
439 |
440 | for (int l1 = 0; l1 < 20; ++l1)
441 | {
442 | double d15 = (double)blockPosIn.getX() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D;
443 | double d18 = (double)blockPosIn.getY() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D;
444 | double d21 = (double)blockPosIn.getZ() + 0.5D + ((double)this.theWorld.rand.nextFloat() - 0.5D) * 2.0D;
445 | this.theWorld.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d15, d18, d21, 0.0D, 0.0D, 0.0D, new int[0]);
446 | this.theWorld.spawnParticle(EnumParticleTypes.FLAME, d15, d18, d21, 0.0D, 0.0D, 0.0D, new int[0]);
447 | }
448 |
449 | return;
450 | case 2005:
451 | ItemDye.spawnBonemealParticles(this.theWorld, blockPosIn, data);
452 | break;
453 | case 2006:
454 |
455 | for (int l = 0; l < 200; ++l)
456 | {
457 | float f3 = random.nextFloat() * 4.0F;
458 | float f4 = random.nextFloat() * ((float)Math.PI * 2F);
459 | double d3 = (double)(MathHelper.cos(f4) * f3);
460 | double d4 = 0.01D + random.nextDouble() * 0.5D;
461 | double d5 = (double)(MathHelper.sin(f4) * f3);
462 | Particle particle = this.spawnEntityFX(EnumParticleTypes.DRAGON_BREATH.getParticleID(), false, (double)blockPosIn.getX() + d3 * 0.1D, (double)blockPosIn.getY() + 0.3D, (double)blockPosIn.getZ() + d5 * 0.1D, d3, d4, d5, new int[0]);
463 |
464 | if (particle != null)
465 | {
466 | particle.multiplyVelocity(f3);
467 | }
468 | }
469 | break;
470 | case 3000:
471 | this.theWorld.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, true, (double)blockPosIn.getX() + 0.5D, (double)blockPosIn.getY() + 0.5D, (double)blockPosIn.getZ() + 0.5D, 0.0D, 0.0D, 0.0D, new int[0]);
472 | break;
473 | case 3001:
474 | }
475 | }
476 | }
477 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/render/RenderWaypoint.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.render;
2 |
3 | import me.ichun.mods.blocksteps.common.entity.EntityWaypoint;
4 | import me.ichun.mods.blocksteps.common.model.ModelWaypoint;
5 | import me.ichun.mods.ichunutil.common.core.util.ResourceHelper;
6 | import net.minecraft.client.Minecraft;
7 | import net.minecraft.client.model.ModelBase;
8 | import net.minecraft.client.renderer.GlStateManager;
9 | import net.minecraft.client.renderer.entity.Render;
10 | import net.minecraft.client.renderer.entity.RenderManager;
11 | import net.minecraft.util.ResourceLocation;
12 | import net.minecraft.util.math.MathHelper;
13 | import net.minecraftforge.fml.client.registry.IRenderFactory;
14 |
15 | public class RenderWaypoint extends Render
16 | {
17 | private ModelBase modelWaypoint = new ModelWaypoint();
18 |
19 | public RenderWaypoint(RenderManager manager)
20 | {
21 | super(manager);
22 | }
23 |
24 | @Override
25 | protected ResourceLocation getEntityTexture(EntityWaypoint entity)
26 | {
27 | return ResourceHelper.texEnderCrystal;
28 | }
29 |
30 | @Override
31 | public void doRender(EntityWaypoint entity, double x, double y, double z, float entityYaw, float partialTicks)
32 | {
33 | float f2 = (float)entity.getEntityId() + Minecraft.getMinecraft().thePlayer.ticksExisted + partialTicks;
34 | GlStateManager.pushMatrix();
35 | GlStateManager.translate((float)x, (float)y, (float)z);
36 | this.bindTexture(ResourceHelper.texEnderCrystal);
37 | float f3 = MathHelper.sin(f2 * 0.2F) / 2.0F + 0.5F;
38 | f3 += f3 * f3;
39 | this.modelWaypoint.render(entity, 0.0F, f2 * 3.0F, f3 * 0.2F, 0.0F, 0.0F, 0.0625F);
40 | GlStateManager.popMatrix();
41 | super.doRender(entity, x, y, z, entityYaw, partialTicks);
42 | }
43 |
44 | public static class RenderFactory implements IRenderFactory
45 | {
46 | @Override
47 | public Render super EntityWaypoint> createRenderFor(RenderManager manager)
48 | {
49 | return new RenderWaypoint(manager);
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/thread/ThreadBlockCrawler.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.thread;
2 |
3 | import me.ichun.mods.blocksteps.common.Blocksteps;
4 | import me.ichun.mods.blocksteps.common.blockaid.BlockStepHandler;
5 | import net.minecraft.block.BlockLiquid;
6 | import net.minecraft.block.state.IBlockState;
7 | import net.minecraft.client.Minecraft;
8 | import net.minecraft.util.math.BlockPos;
9 | import net.minecraft.util.math.ChunkPos;
10 |
11 | import java.util.*;
12 |
13 | public class ThreadBlockCrawler extends Thread
14 | {
15 | public final Map> crawler = new HashMap<>();
16 | public final Map> surface = Collections.synchronizedMap(new HashMap>());
17 | public final ArrayList updatePoses = new ArrayList<>();
18 | public boolean needChecks = false;
19 |
20 | public ThreadBlockCrawler()
21 | {
22 | this.setName("Blocksteps Block Crawler Thread");
23 | this.setDaemon(true);
24 | }
25 |
26 | @Override
27 | public void run()
28 | {
29 | try
30 | {
31 | boolean execute = true;
32 | while(execute)
33 | {
34 | if(needChecks)
35 | {
36 | Minecraft mc = Minecraft.getMinecraft();
37 | if(mc.thePlayer != null && mc.theWorld.provider.getDimension() != -1)
38 | {
39 | updatePoses.clear();
40 |
41 | BlockPos ref = new BlockPos(mc.thePlayer.posX, 0, mc.thePlayer.posZ);
42 | int rangeHori = Math.max((Blocksteps.config.renderDistance == 0 ? (mc.gameSettings.renderDistanceChunks) : (Blocksteps.config.renderDistance)), 1) * 16;
43 |
44 | HashMap hasInfo = new HashMap<>();
45 |
46 | for(int i = -rangeHori; i <= rangeHori; i++)
47 | {
48 | for(int k = -rangeHori; k <= rangeHori; k++)
49 | {
50 | ChunkPos chunk = new ChunkPos((ref.getX() + i) >> 4, (ref.getZ() + k) >> 4);
51 | if(!hasInfo.containsKey(chunk))
52 | {
53 | hasInfo.put(chunk, surface.containsKey(chunk));
54 | }
55 | if((rangeHori - Math.abs(i) > 18 && rangeHori - Math.abs(k) > 18) && hasInfo.get(chunk))
56 | {
57 | continue;
58 | }
59 |
60 | int j = mc.theWorld.getActualHeight() + 1;
61 | int finds = 0;
62 | while(j > 0 && finds < Blocksteps.config.surfaceDepth && mc.theWorld != null)
63 | {
64 | j--;
65 | BlockPos pos = ref.add(i, j, k);
66 | IBlockState state = mc.theWorld.getBlockState(pos);
67 | if(BlockStepHandler.isBlockTypePeripheral(mc.theWorld, pos, state.getBlock(), state, BlockStepHandler.DUMMY_AVAILABLES))
68 | {
69 | addPos(pos);
70 | continue;
71 | }
72 | if(state.getBlock().isAir(state, mc.theWorld, pos) || !(state.getBlock().isNormalCube(state, mc.theWorld, pos) || BlockStepHandler.isAcceptableBlockType(state, state.getBlock()) || BlockLiquid.class.isInstance(state.getBlock())))
73 | {
74 | continue;
75 | }
76 | addPos(pos);
77 | if(finds == 0)
78 | {
79 | ArrayList periphs = new ArrayList<>();
80 | BlockStepHandler.addPeripherals(mc.theWorld, pos, periphs, false);
81 | for(BlockPos pos1 : periphs)
82 | {
83 | addPos(pos1);
84 | }
85 | }
86 | finds++;
87 | updatePoses.add(pos);
88 | }
89 | }
90 | }
91 |
92 | synchronized(surface)
93 | {
94 | Iterator>> ite = surface.entrySet().iterator();
95 | while(ite.hasNext())
96 | {
97 | Map.Entry> e = ite.next();
98 | double dx = e.getKey().chunkXPos << 4 - ref.getX();
99 | double dz = e.getKey().chunkZPos << 4 - ref.getZ();
100 | double dist = Math.sqrt(dx * dx + dz * dz);
101 | if(dist > ((Blocksteps.config.renderDistance == 0 ? (mc.gameSettings.renderDistanceChunks) : (Blocksteps.config.renderDistance)) + 4) * 16) //if the cache is >4 chunks away from the range, clear it off.
102 | {
103 | ite.remove();
104 | }
105 | }
106 |
107 | surface.putAll(crawler);
108 | crawler.clear();
109 | }
110 |
111 | for(BlockPos pos : updatePoses)
112 | {
113 | IBlockState state = mc.theWorld.getBlockState(pos);
114 | Blocksteps.eventHandler.renderGlobalProxy.notifyBlockUpdate(mc.theWorld, pos, state, state, 3);
115 | }
116 | }
117 | needChecks = false;
118 | }
119 | Thread.sleep(50L);
120 | }
121 | }
122 | catch(Exception e)
123 | {
124 | e.printStackTrace();
125 | }
126 | }
127 |
128 | private void addPos(BlockPos pos)
129 | {
130 | ChunkPos coord = new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4);
131 | HashSet poses = crawler.get(coord);
132 | if(poses == null)
133 | {
134 | poses = new HashSet<>();
135 | crawler.put(coord, poses);
136 | }
137 | poses.add(pos);
138 | }
139 | }
140 |
--------------------------------------------------------------------------------
/src/main/java/me/ichun/mods/blocksteps/common/thread/ThreadCheckBlocks.java:
--------------------------------------------------------------------------------
1 | package me.ichun.mods.blocksteps.common.thread;
2 |
3 | import me.ichun.mods.blocksteps.common.blockaid.CheckBlockInfo;
4 | import net.minecraft.client.Minecraft;
5 |
6 | import java.util.ArrayList;
7 | import java.util.Collections;
8 | import java.util.List;
9 |
10 | public class ThreadCheckBlocks extends Thread
11 | {
12 | public final List checks = Collections.synchronizedList(new ArrayList());
13 | public ArrayList checksList = new ArrayList<>();
14 |
15 | public ThreadCheckBlocks()
16 | {
17 | this.setName("Blocksteps Block Checker Thread");
18 | this.setDaemon(true);
19 | }
20 |
21 | @Override
22 | public void run()
23 | {
24 | try
25 | {
26 | while(true)
27 | {
28 | synchronized(checks)
29 | {
30 | if(!checks.isEmpty())
31 | {
32 | checksList.addAll(checks);
33 | checks.clear();
34 | }
35 | }
36 | if(!checksList.isEmpty())
37 | {
38 | CheckBlockInfo info = checksList.get(0);
39 | if(info.world == Minecraft.getMinecraft().theWorld)
40 | {
41 | info.doCheck();
42 | }
43 | checksList.remove(0);
44 | Thread.sleep(2L);
45 | }
46 | else
47 | {
48 | Thread.sleep(50L);
49 | }
50 | }
51 | }
52 | catch(Exception e)
53 | {
54 | e.printStackTrace();
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/lang/en_US.lang:
--------------------------------------------------------------------------------
1 | blocksteps.config.prop.renderBlockCount.name=Maximum blocks to count per server
2 | blocksteps.config.prop.renderDistance.name=Maximum chunks for rendering
3 | blocksteps.config.prop.renderSky.name=Render Sky
4 | blocksteps.config.prop.renderSkySize.name=Render Sky Size
5 | blocksteps.config.prop.renderCompass.name=Render Arrow Compass
6 | blocksteps.config.prop.saveInterval.name=Save Interval
7 | blocksteps.config.prop.stepRadius.name=Step Radius
8 | blocksteps.config.prop.trackOtherPlayers.name=Track other players
9 | blocksteps.config.prop.hideNamePlates.name=Hide Name Plates
10 | blocksteps.config.prop.lockMapToHeadYaw.name=Lock Map to Head Yaw
11 | blocksteps.config.prop.lockMapToHeadPitch.name=Lock Map to Head Pitch
12 | blocksteps.config.prop.stepPeripherals.name=Enable Step Peripherals
13 | blocksteps.config.prop.treeDetection.name=Enable Tree Detection
14 | blocksteps.config.prop.endTowerDetection.name=Enable End Tower Detection
15 | blocksteps.config.prop.brightMap.name=Bright Light Map?
16 | blocksteps.config.prop.waypointOnDeath.name=Create Waypoint on Death?
17 | blocksteps.config.prop.waypointIndicator.name=Render Waypoint Indicator?
18 | blocksteps.config.prop.waypointIndicatorThroughBlocks.name=Render Waypoint Indicator Through Blocks?
19 | blocksteps.config.prop.waypointLabelThroughBlocks.name=Render Waypoint Label Through Blocks?
20 | blocksteps.config.prop.waypointLabelSize.name=Waypoint Label Size
21 | blocksteps.config.prop.waypointBeamHeightAdjust.name=Adjust Beam Height?
22 | blocksteps.config.prop.waypointRenderInWorld.name=Render Waypoint in World?
23 | blocksteps.config.prop.camStartHorizontal.name=Camera Start Horizontal
24 | blocksteps.config.prop.camStartVertical.name=Camera Start Vertical
25 | blocksteps.config.prop.camStartScale.name=Camera Start Zoom
26 | blocksteps.config.prop.camPanHorizontal.name=Camera Pan Horizontal
27 | blocksteps.config.prop.camPanVertical.name=Camera Pan Vertical
28 | blocksteps.config.prop.camZoom.name=Camera Zoom
29 | blocksteps.config.prop.camPosX.name=Camera Horizontal Position
30 | blocksteps.config.prop.camPosY.name=Camera Vertical Position
31 | blocksteps.config.prop.surfaceDepth.name=Surface Depth
32 | blocksteps.config.prop.surfaceHorizontalUpdateDistance.name=Surface Horizontal Update Distance
33 | blocksteps.config.prop.mapType.name=Map Type
34 | blocksteps.config.prop.mapFreq.name=Map Refresh Rate
35 | blocksteps.config.prop.mapLoad.name=Map Load Timer
36 | blocksteps.config.prop.mapShowEntities.name=Show Entities on Map
37 | blocksteps.config.prop.mapShowCoordinates.name=Show Player Coordinates
38 | blocksteps.config.prop.mapStartX.name=Actual Map Left Border
39 | blocksteps.config.prop.mapStartY.name=Actual Map Top Border
40 | blocksteps.config.prop.mapEndX.name=Actual Map Right Border
41 | blocksteps.config.prop.mapEndY.name=Actual Map Bottom Border
42 | blocksteps.config.prop.mapBorderOpacity.name=Map Border Opacity
43 | blocksteps.config.prop.mapBorderOutline.name=Enable Map Border Outline
44 | blocksteps.config.prop.mapBorderOutlineColour.name=Map Border Outline Colour
45 | blocksteps.config.prop.mapBorderSize.name=Map Border Size
46 | blocksteps.config.prop.mapBorderColour.name=Map Border Colour
47 | blocksteps.config.prop.mapBackgroundOpacity.name=Map Background Opacity
48 | blocksteps.config.prop.mapBackgroundColour.name=Map Background Colour
49 | blocksteps.config.prop.easterEgg.name=Easter Egg
50 | blocksteps.config.prop.keyCamUp.name=Camera Up
51 | blocksteps.config.prop.keyCamDown.name=Camera Down
52 | blocksteps.config.prop.keyCamLeft.name=Camera Left
53 | blocksteps.config.prop.keyCamRight.name=Camera Right
54 | blocksteps.config.prop.keyCamUpFS.name=Camera Up (Full Screen)
55 | blocksteps.config.prop.keyCamDownFS.name=Camera Down (Full Screen)
56 | blocksteps.config.prop.keyCamLeftFS.name=Camera Left (Full Screen)
57 | blocksteps.config.prop.keyCamRightFS.name=Camera Right (Full Screen)
58 | blocksteps.config.prop.keyCamZoomIn.name=Camera Zoom In
59 | blocksteps.config.prop.keyCamZoomOut.name=Camera Zoom Out
60 | blocksteps.config.prop.keyToggle.name=Mini-Map Toggle
61 | blocksteps.config.prop.keyToggleFullscreen.name=Toggle Full Screen
62 | blocksteps.config.prop.keySwitchMapMode.name=Switch Map Mode/Rerender
63 | blocksteps.config.prop.keyWaypoints.name=Waypoints
64 |
65 | blocksteps.config.prop.renderBlockCount.comment=The maximum number of blocks to track on each server for rendering.
66 | blocksteps.config.prop.renderDistance.comment=Maximum chunks for rendering.\n0 = Minecraft default\nI would recommend 6 as a render distance since this is a minimap.
67 | blocksteps.config.prop.renderSky.comment=Render the sky?
68 | blocksteps.config.prop.renderSkySize.comment=Size of the sky render in the mini map.
69 | blocksteps.config.prop.renderCompass.comment=Render an arrow compass that constantly faces north?
70 | blocksteps.config.prop.saveInterval.comment=Time between automatically saving your mini-map info (in ticks).
71 | blocksteps.config.prop.trackOtherPlayers.comment=Should we track other players on the map as well?
72 | blocksteps.config.prop.hideNamePlates.comment=Enable "Hide GUI" when rendering the mini-map to hide player names?
73 | blocksteps.config.prop.lockMapToHeadYaw.comment=Lock the map to the player's look direction (yaw)?
74 | blocksteps.config.prop.lockMapToHeadPitch.comment=Lock the map to the player's look direction (pitch)?
75 | blocksteps.config.prop.stepRadius.comment=Step radius of each step, in blocks
76 | blocksteps.config.prop.stepPeripherals.comment=Enable step "peripherals", grass on blocks, dirt blocks, that kinda sort.
77 | blocksteps.config.prop.treeDetection.comment=Tree detection can be very laggy in ways, turn it off if it bothers you.
78 | blocksteps.config.prop.endTowerDetection.comment=End Tower detection can be very laggy in ways, turn it off if it bothers you.
79 | blocksteps.config.prop.brightMap.comment=Make the entire map maximum brightness by simulating night vision?
80 | blocksteps.config.prop.waypointOnDeath.comment=Create waypoint when you die?
81 | blocksteps.config.prop.waypointIndicator.comment=Render the waypoint type indicator?
82 | blocksteps.config.prop.waypointIndicatorThroughBlocks.comment=Render the waypoint indicator through (most) blocks? Translucent blocks will render over these unfortunately.
83 | blocksteps.config.prop.waypointLabelThroughBlocks.comment=Render the waypoint label through (most) blocks? Translucent blocks will render over these unfortunately.
84 | blocksteps.config.prop.waypointLabelSize.comment=Size of the labels of waypoints.
85 | blocksteps.config.prop.waypointBeamHeightAdjust.comment=Adjust beam height as you get closer to it?\nThis value sets the minimum beam height.\nSet to 0 to disable and enable permanent maximum beam height (256 blocks)
86 | blocksteps.config.prop.waypointRenderInWorld.comment=Render waypoints in the world when enabled?
87 | blocksteps.config.prop.camStartHorizontal.comment=Amount (in degrees) the camera starts being panned horizontally.
88 | blocksteps.config.prop.camStartVertical.comment=Amount (in degrees) the camera starts being panned vertically.
89 | blocksteps.config.prop.camStartScale.comment=Amount the camera starts zoomed.
90 | blocksteps.config.prop.camPanHorizontal.comment=Amount (in degrees) to pan the camera horizontally.
91 | blocksteps.config.prop.camPanVertical.comment=Amount (in degrees) to pan the camera vertically.
92 | blocksteps.config.prop.camZoom.comment=Amount to zoom when the keys are hit.
93 | blocksteps.config.prop.camPosX.comment=Position of the camera horizontally (in percentage) on the map.
94 | blocksteps.config.prop.camPosY.comment=Position of the camera vertically (in percentage) on the map.
95 | blocksteps.config.prop.surfaceDepth.comment=How deep the surface search should be.
96 | blocksteps.config.prop.surfaceHorizontalUpdateDistance.comment=How far the player must travel (in blocks) horizontally before the map tries to update the surface blocks again.
97 | blocksteps.config.prop.mapType.comment=Current Map Type\n1 = Blocksteps, where only blocks you stepped on are visible. This type actually saves. \n Blocksteps may be somewhat unoptimized, the community voted that I finished the mod and you are reading the configs of the completed contents.\n I have however, tried to optimize it as much as I can. I would recommend staying on this mode.\n2 = Blocksteps + Surface, blocksteps mode and a mode called Surface, which, well, renders just the surface.\n Surface is made more for photographic use rather than active use.\n Surface may also have issues rendering on the surface and be unoptimized.\n3 = Full Overview, you get a general 3D map of the area.\n4 = Cylindrical Slice, purely for pretty pictures and stuff.
98 | blocksteps.config.prop.mapFreq.comment=Map refresh rate a second. Caps to the rendering speed of Minecraft.\nOnly supported if you have framebuffers enabled.\nHowever, turning this on (setting it higher than 0) will disable the translucent mini map background.\nIt will be replaced with the colour of the horizon.\nSet to 0 to bind to Minecraft render refresh rate.
99 | blocksteps.config.prop.mapLoad.comment=Time to allow the actual world map to load before grabbing the world data for the mini-map render (in ticks).
100 | blocksteps.config.prop.mapShowEntities.comment=Show Entities on the map?\nFor Blocksteps map type, only entities on shown blocks will render.
101 | blocksteps.config.prop.mapShowCoordinates.comment=Show the player's coordinates on the bottom left of the map?
102 | blocksteps.config.prop.mapStartX.comment=The left border (in percentage of the screen) of the actual map to render.
103 | blocksteps.config.prop.mapStartY.comment=The top border (in percentage of the screen) of the actual map to render.
104 | blocksteps.config.prop.mapEndX.comment=The right border (in percentage of the screen) of the actual map to render.
105 | blocksteps.config.prop.mapEndY.comment=The bottom border (in percentage of the screen) of the actual map to render.
106 | blocksteps.config.prop.mapBorderOpacity.comment=Opacity of a drawn solid map border around the actual map?
107 | blocksteps.config.prop.mapBorderOutline.comment=Enable an outline around the border.
108 | blocksteps.config.prop.mapBorderOutlineColour.comment=Colour of the map outline border.
109 | blocksteps.config.prop.mapBorderSize.comment=Size of the map border.
110 | blocksteps.config.prop.mapBorderColour.comment=Colour of the map border.
111 | blocksteps.config.prop.mapBackgroundOpacity.comment=Opacity of the map background.
112 | blocksteps.config.prop.mapBackgroundColour.comment=Colour of the map background.
113 | blocksteps.config.prop.easterEgg.comment=Enable Easter Eggs?
114 | blocksteps.config.prop.keyCamUp.comment=Key to pan the camera up.
115 | blocksteps.config.prop.keyCamDown.comment=Key to pan the camera down.
116 | blocksteps.config.prop.keyCamLeft.comment=Key to pan the camera left.
117 | blocksteps.config.prop.keyCamRight.comment=Key to pan the camera right.
118 | blocksteps.config.prop.keyCamUpFS.comment=Key to move the camera up (in full screen).
119 | blocksteps.config.prop.keyCamDownFS.comment=Key to move the camera down (in full screen).
120 | blocksteps.config.prop.keyCamLeftFS.comment=Key to move the camera left (in full screen).
121 | blocksteps.config.prop.keyCamRightFS.comment=Key to move the camera right (in full screen).
122 | blocksteps.config.prop.keyCamZoomIn.comment=Key to zoom in.
123 | blocksteps.config.prop.keyCamZoomOut.comment=Key to zoom out.
124 | blocksteps.config.prop.keyToggle.comment=Key to toggle the mini-map. Toggles waypoints when in fullscreen.
125 | blocksteps.config.prop.keyToggleFullscreen.comment=Key to toggle full screen.
126 | blocksteps.config.prop.keySwitchMapMode.comment=Key toggles between the available map modes.\n\nSometimes, the world data isn't available when the world is loaded.\nHold SHIFT and Use this key to purge a rerender and recollect block data.
127 | blocksteps.config.prop.keyWaypoints.comment=Key to show the waypoints menu.
128 |
129 | blocksteps.gui.newWaypoint=New Waypoint
130 | blocksteps.gui.deleteWaypoint=Delete Waypoint
131 | blocksteps.gui.deleteMap=Delete Map Storage\nHold shift when confirming to delete just map step data.
132 |
133 | blocksteps.gui.waypoints=Waypoints
134 | blocksteps.gui.editWaypoint=Edit Waypoint
135 | blocksteps.gui.areYouSure=Are you sure?
136 | blocksteps.gui.confirmDeleteWaypoint=Delete Waypoint?
137 | blocksteps.gui.confirmDeleteMap=Delete Map Data?
138 |
139 | blocksteps.mapType.type=Map Type:
140 | blocksteps.mapType.blocksteps=Blocksteps
141 | blocksteps.mapType.surface=Blocksteps + Surface
142 | blocksteps.mapType.threedee=Full Overview
143 | blocksteps.mapType.cylindricalSlice=Cylindrical Slice
144 |
145 | blocksteps.waypoint.show=Showing waypoints
146 | blocksteps.waypoint.hide=Hiding waypoints
147 | blocksteps.waypoint.name=Waypoint name
148 | blocksteps.waypoint.pos=Position
149 | blocksteps.waypoint.currentPos=Set position to current position
150 | blocksteps.waypoint.colour=Colour
151 | blocksteps.waypoint.visible=Visible?
152 | blocksteps.waypoint.showDistance=Show Distance?
153 | blocksteps.waypoint.beam=Beam?
154 | blocksteps.waypoint.entityType=Waypoint type
155 | blocksteps.waypoint.renderRange=Render range
156 | blocksteps.waypoint.renderRangeTooltip=Render range of the waypoint. Set to 0 if you want the waypoint to always render.
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/lang/zh_CN.lang:
--------------------------------------------------------------------------------
1 | blocksteps.config.prop.renderBlockCount.name=服务器最大方块数量
2 | blocksteps.config.prop.renderDistance.name=最大渲染区块数量
3 | blocksteps.config.prop.renderSky.name=渲染天空
4 | blocksteps.config.prop.renderSkySize.name=天空大小
5 | blocksteps.config.prop.renderCompass.name=渲染罗盘箭
6 | blocksteps.config.prop.saveInterval.name=保存间隔
7 | blocksteps.config.prop.stepRadius.name=步半径
8 | blocksteps.config.prop.trackOtherPlayers.name=跟踪其他玩家
9 | blocksteps.config.prop.hideNamePlates.name=隐藏玩家名称
10 | blocksteps.config.prop.lockMapToHeadYaw.name=锁定地图到玩家的Yaw值
11 | blocksteps.config.prop.lockMapToHeadPitch.name=锁定地图到玩家的Pitch值
12 | blocksteps.config.prop.stepPeripherals.name=检测步周围方块
13 | blocksteps.config.prop.treeDetection.name=检测树木
14 | blocksteps.config.prop.endTowerDetection.name=检测末地黑曜石柱
15 | blocksteps.config.prop.brightMap.name=加亮地图?
16 | blocksteps.config.prop.waypointOnDeath.name=死亡时创建路点?
17 | blocksteps.config.prop.waypointIndicator.name=渲染路点指示物?
18 | blocksteps.config.prop.waypointIndicatorThroughBlocks.name=透过方块渲染路点指示物?
19 | blocksteps.config.prop.waypointLabelThroughBlocks.name=透过方块渲染路点标签?
20 | blocksteps.config.prop.waypointLabelSize.name=路点标签大小
21 | blocksteps.config.prop.waypointBeamHeightAdjust.name=光柱最小高度
22 | blocksteps.config.prop.waypointRenderInWorld.name=在世界中渲染路点?
23 | blocksteps.config.prop.camStartHorizontal.name=摄像机初始水平旋转位置
24 | blocksteps.config.prop.camStartVertical.name=摄像机初始竖直旋转位置
25 | blocksteps.config.prop.camStartScale.name=摄像机初始缩放
26 | blocksteps.config.prop.camPanHorizontal.name=摄像机水平旋转单位
27 | blocksteps.config.prop.camPanVertical.name=摄像机竖直旋转单位
28 | blocksteps.config.prop.camZoom.name=摄像机缩放
29 | blocksteps.config.prop.camPosX.name=摄像机水平位置
30 | blocksteps.config.prop.camPosY.name=摄像机竖直位置
31 | blocksteps.config.prop.surfaceDepth.name=地表深度
32 | blocksteps.config.prop.surfaceHorizontalUpdateDistance.name=地表水平更新距离
33 | blocksteps.config.prop.mapType.name=地图类型
34 | blocksteps.config.prop.mapFreq.name=地图刷新率
35 | blocksteps.config.prop.mapLoad.name=地图加载计时
36 | blocksteps.config.prop.mapShowEntities.name=显示实体
37 | blocksteps.config.prop.mapShowCoordinates.name=显示玩家坐标
38 | blocksteps.config.prop.mapStartX.name=地图左边框位置
39 | blocksteps.config.prop.mapStartY.name=地图上边框位置
40 | blocksteps.config.prop.mapEndX.name=地图右边框位置
41 | blocksteps.config.prop.mapEndY.name=地图下边框位置
42 | blocksteps.config.prop.mapBorderOpacity.name=地图边框透明度
43 | blocksteps.config.prop.mapBorderOutline.name=显示地图边框轮廓
44 | blocksteps.config.prop.mapBorderOutlineColour.name=地图边框轮廓颜色
45 | blocksteps.config.prop.mapBorderSize.name=地图边框大小
46 | blocksteps.config.prop.mapBorderColour.name=地图边框颜色
47 | blocksteps.config.prop.mapBackgroundOpacity.name=地图背景透明度
48 | blocksteps.config.prop.mapBackgroundColour.name=地图背景颜色
49 | blocksteps.config.prop.easterEgg.name=彩蛋
50 | blocksteps.config.prop.keyCamUp.name=向上旋转摄像机
51 | blocksteps.config.prop.keyCamDown.name=向下旋转摄像机
52 | blocksteps.config.prop.keyCamLeft.name=向左旋转摄像机
53 | blocksteps.config.prop.keyCamRight.name=向右旋转摄像机
54 | blocksteps.config.prop.keyCamUpFS.name=上移摄像机 (全屏)
55 | blocksteps.config.prop.keyCamDownFS.name=下移摄像机 (全屏)
56 | blocksteps.config.prop.keyCamLeftFS.name=左移摄像机 (全屏)
57 | blocksteps.config.prop.keyCamRightFS.name=右移摄像机 (全屏)
58 | blocksteps.config.prop.keyCamZoomIn.name=放大地图
59 | blocksteps.config.prop.keyCamZoomOut.name=缩小地图
60 | blocksteps.config.prop.keyToggle.name=开关小地图
61 | blocksteps.config.prop.keyToggleFullscreen.name=切换全屏
62 | blocksteps.config.prop.keySwitchMapMode.name=更换地图模式/渲染器
63 | blocksteps.config.prop.keyWaypoints.name=路点
64 |
65 | blocksteps.config.prop.renderBlockCount.comment=在每个服务器上记录的最大方块数
66 | blocksteps.config.prop.renderDistance.comment=最大渲染区块数量.\n0 = Minecraft默认\n因为这是个小地图,我推荐设置渲染距离为6.
67 | blocksteps.config.prop.renderSky.comment=是否渲染天空?
68 | blocksteps.config.prop.renderSkySize.comment=在小地图中天空的大小
69 | blocksteps.config.prop.renderCompass.comment=渲染一个一直指向北方的罗盘箭(右下角的那个箭)?
70 | blocksteps.config.prop.saveInterval.comment=自动保存小地图信息间隔时间(ticks)
71 | blocksteps.config.prop.trackOtherPlayers.comment=是否同样跟踪在地图上的其他玩家?
72 | blocksteps.config.prop.hideNamePlates.comment=在渲染小地图是启用"隐藏GUI"来隐藏玩家的名字?
73 | blocksteps.config.prop.lockMapToHeadYaw.comment=锁定地图到玩家的指向方向(yaw)?
74 | blocksteps.config.prop.lockMapToHeadPitch.comment=锁定地图到玩家的指向方向(pitch)?
75 | blocksteps.config.prop.stepRadius.comment=每一步的半径(格)
76 | blocksteps.config.prop.stepPeripherals.comment=记录步"周围"方块,即方块上的草,泥土方块之类的东西
77 | blocksteps.config.prop.treeDetection.comment=树的检测可能会非常卡,如果你觉得影响到正常游戏可以关掉
78 | blocksteps.config.prop.endTowerDetection.comment=末地黑曜石塔的检测可能会非常卡,如果你觉得影响到正常游戏可以关掉
79 | blocksteps.config.prop.brightMap.comment=通过模拟夜视效果使得地图亮度最大?
80 | blocksteps.config.prop.waypointOnDeath.comment=在你死的时候创建路点?
81 | blocksteps.config.prop.waypointIndicator.comment=渲染路点类型指示?
82 | blocksteps.config.prop.waypointIndicatorThroughBlocks.comment=穿过(大部分)方块渲染路点指示? 很不幸,半透明方块将会在路点之上渲染
83 | blocksteps.config.prop.waypointLabelThroughBlocks.comment=穿过(大部分)方块渲染路点标签? 很不幸,半透明方块将会在标签之上渲染
84 | blocksteps.config.prop.waypointLabelSize.comment=路点标签的大小
85 | blocksteps.config.prop.waypointBeamHeightAdjust.comment=随着你靠近路点是否调整光柱高度?\n这个值设定了最小的光柱高度\n设置为0以禁用并启用永久最大光柱高度(256格)
86 | blocksteps.config.prop.waypointRenderInWorld.comment=启用时在世界中渲染路点?
87 | blocksteps.config.prop.camStartHorizontal.comment=摄像机初始水平旋转角度
88 | blocksteps.config.prop.camStartVertical.comment=摄像机初始竖直旋转角度
89 | blocksteps.config.prop.camStartScale.comment=摄像机初始缩放值
90 | blocksteps.config.prop.camPanHorizontal.comment=旋转键按下后摄像机的单位水平旋转角度
91 | blocksteps.config.prop.camPanVertical.comment=旋转键按下后摄像机的单位竖直旋转角度
92 | blocksteps.config.prop.camZoom.comment=当缩放键按下时改变的缩放值
93 | blocksteps.config.prop.camPosX.comment=小地图中摄像机的水平位置(百分比)
94 | blocksteps.config.prop.camPosY.comment=小地图中摄像机的竖直位置(百分比)
95 | blocksteps.config.prop.surfaceDepth.comment=地表向下搜索的深度
96 | blocksteps.config.prop.surfaceHorizontalUpdateDistance.comment=在地图尝试更新地表方块之前,玩家需要水平行走多远(格)?
97 | blocksteps.config.prop.mapType.comment=当前地图类型\n1 = Blocksteps, 只有你走过的方块才会渲染. 这个模式实际上保存了下来.\n Blocksteps可能还不是很优化, mod社区投票让我完成了这个mod,并且你正在阅读完整内容的config.\n 我已经尝试尽可能地优化了. 我推荐你停留在这个模式\n2 = Blocksteps + 地表, Blocksteps模式和一个叫做地表的模式,它只会渲染地表.\n 地表模式更适合于摄影用途而不是日常使用.\n 地表模式渲染地表时可能也会有一些问题,并且它也是没有优化的.\n3 = 全景,你会得到所在区域的一个总体的3D地图.\n4 = 圆柱,仅仅为了摄影或者其它用途.
98 | blocksteps.config.prop.mapFreq.comment=一秒内地图的刷新率. 上限为Minecraft的渲染速度.\n仅在你开启帧缓冲的时候可用.\n然而,打开这个(值高于0)将会禁用半透明的小地图背景.\n背景将会被替换成水平线的颜色.\n设置为0以绑定到Minecraft渲染刷新率.
99 | blocksteps.config.prop.mapLoad.comment=在获取小地图需要的地图数据之前允许实际世界地图加载的时间 (ticks)
100 | blocksteps.config.prop.mapShowEntities.comment=在地图上显示实体?\n对于Blocksteps地图类型,只有在显示方块上的实体才会渲染.
101 | blocksteps.config.prop.mapShowCoordinates.comment=在地图左下角显示玩家的坐标?
102 | blocksteps.config.prop.mapStartX.comment=非全屏模式下地图的左边框(对于屏幕的百分比)
103 | blocksteps.config.prop.mapStartY.comment=非全屏模式下地图的上边框(对于屏幕的百分比)
104 | blocksteps.config.prop.mapEndX.comment=非全屏模式下地图的右边框(对于屏幕的百分比)
105 | blocksteps.config.prop.mapEndY.comment=非全屏模式下地图的下边框(对于屏幕的百分比)
106 | blocksteps.config.prop.mapBorderOpacity.comment=地图周围一圈边框的透明度?
107 | blocksteps.config.prop.mapBorderOutline.comment=在边框周围显示轮廓
108 | blocksteps.config.prop.mapBorderOutlineColour.comment=地图边框轮廓的颜色
109 | blocksteps.config.prop.mapBorderSize.comment=地图边框的大小
110 | blocksteps.config.prop.mapBorderColour.comment=地图边框的颜色
111 | blocksteps.config.prop.mapBackgroundOpacity.comment=地图背景的透明度
112 | blocksteps.config.prop.mapBackgroundColour.comment=地图背景的颜色
113 | blocksteps.config.prop.easterEgg.comment=是否启用彩蛋?
114 | blocksteps.config.prop.keyCamUp.comment=向上旋转摄像机的按键
115 | blocksteps.config.prop.keyCamDown.comment=向下旋转摄像机的按键
116 | blocksteps.config.prop.keyCamLeft.comment=向左旋转摄像机的按键
117 | blocksteps.config.prop.keyCamRight.comment=向右旋转摄像机的按键
118 | blocksteps.config.prop.keyCamUpFS.comment=上移摄像机的按键 (全屏)
119 | blocksteps.config.prop.keyCamDownFS.comment=下移摄像机的按键 (全屏)
120 | blocksteps.config.prop.keyCamLeftFS.comment=左移摄像机的按键 (全屏)
121 | blocksteps.config.prop.keyCamRightFS.comment=右移摄像机的按键 (全屏)
122 | blocksteps.config.prop.keyCamZoomIn.comment=放大的按键
123 | blocksteps.config.prop.keyCamZoomOut.comment=缩小的按键
124 | blocksteps.config.prop.keyToggle.comment=开关小地图的按键. 全屏时开关路点
125 | blocksteps.config.prop.keyToggleFullscreen.comment=切换全屏的按键
126 | blocksteps.config.prop.keySwitchMapMode.comment=在可用地图模式间切换的按键.\n\n有时地图数据在地图加载之后可能不会立即读取.\n按住SHIFT并按下这个按键可以强制重渲染并重获取方块数据.
127 | blocksteps.config.prop.keyWaypoints.comment=显示路点菜单的按键
128 |
129 | blocksteps.gui.newWaypoint=新建路点
130 | blocksteps.gui.deleteWaypoint=删除路点
131 | blocksteps.gui.deleteMap=删除地图存档\n在确认时按住Shift仅删除地图的脚步数据
132 |
133 | blocksteps.gui.waypoints=路点
134 | blocksteps.gui.editWaypoint=编辑路点
135 | blocksteps.gui.areYouSure=你确定吗?
136 | blocksteps.gui.confirmDeleteWaypoint=删除路点?
137 | blocksteps.gui.confirmDeleteMap=删除地图数据?
138 |
139 | blocksteps.mapType.type=地图类型:
140 | blocksteps.mapType.blocksteps=Blocksteps
141 | blocksteps.mapType.surface=Blocksteps + 地表
142 | blocksteps.mapType.threedee=全景
143 | blocksteps.mapType.cylindricalSlice=圆柱
144 |
145 | blocksteps.waypoint.show=显示路点
146 | blocksteps.waypoint.hide=隐藏路点
147 | blocksteps.waypoint.name=路点名称
148 | blocksteps.waypoint.pos=位置
149 | blocksteps.waypoint.currentPos=设定位置到当前位置
150 | blocksteps.waypoint.colour=颜色
151 | blocksteps.waypoint.visible=是否可见?
152 | blocksteps.waypoint.showDistance=显示距离?
153 | blocksteps.waypoint.beam=光柱?
154 | blocksteps.waypoint.entityType=路点类型
155 | blocksteps.waypoint.renderRange=渲染距离
156 | blocksteps.waypoint.renderRangeTooltip=路点的渲染距离. 如果你想让路点一直渲染请设为0
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/textures/icon/delMap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/src/main/resources/assets/blocksteps/textures/icon/delMap.png
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/textures/icon/delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/src/main/resources/assets/blocksteps/textures/icon/delete.png
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/textures/icon/done.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/src/main/resources/assets/blocksteps/textures/icon/done.png
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/textures/icon/new.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/src/main/resources/assets/blocksteps/textures/icon/new.png
--------------------------------------------------------------------------------
/src/main/resources/assets/blocksteps/textures/model/sheeppig.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iChun/Blocksteps/c3a023863533354d65409cb825a00f2b54def4ee/src/main/resources/assets/blocksteps/textures/model/sheeppig.png
--------------------------------------------------------------------------------
/src/main/resources/mcmod.info:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "modid" : "blocksteps",
4 | "name" : "Blocksteps",
5 | "version" : "${version}",
6 | "url" : "http://ichun.me/mods/blocksteps/",
7 | "credits" : "",
8 | "authorList": [
9 | "iChun"
10 | ],
11 | "description": "Adds a small 3D minimap of the blocks you've stepped on.",
12 | "updateUrl" : "",
13 | "parent" : "",
14 | "screenshots": [
15 | ],
16 | "dependencies": [
17 | "Forge", "iChunUtil"
18 | ]
19 | }
20 | ]
--------------------------------------------------------------------------------
/src/main/resources/pack.mcmeta:
--------------------------------------------------------------------------------
1 | {
2 | "pack":{
3 | "pack_format":2,
4 | "description":"Blocksteps"
5 | }
6 | }
--------------------------------------------------------------------------------