- Merge remote-tracking branch 'origin/master'
- Switch to MC 1.10.X - Make it compile...master
commit
1192bfcbcd
|
@ -5,6 +5,7 @@
|
|||
*.class
|
||||
*.log
|
||||
*.pid
|
||||
*.log.gz
|
||||
|
||||
# Package Files
|
||||
*.jar
|
||||
|
@ -35,4 +36,10 @@ Thumbs.db
|
|||
desktop.ini
|
||||
|
||||
# Misc
|
||||
download/
|
||||
download/
|
||||
config/
|
||||
saves/
|
||||
crash-reports/
|
||||
screenshots/
|
||||
usernamecache.json
|
||||
options.txt
|
|
@ -1 +1 @@
|
|||
Subproject commit 930c842774bcb88f83d4ece114396eb07f86fbcc
|
||||
Subproject commit cb83cbc551fb9489f1355ffafec533288bed5948
|
25
README.md
25
README.md
|
@ -1,31 +1,14 @@
|
|||
OpenBlocks
|
||||
=========
|
||||
|
||||
An open source random collection of blocks and miscellaneous cool stuff
|
||||
An open source random collection of blocks and miscellaneous cool stuff.
|
||||
|
||||
Current Version
|
||||
-
|
||||
|
||||
**1.4.0 for Minecraft 1.7.10**
|
||||
You'll also need OpenModsLib 0.6.
|
||||
For stable release downloads, click [here](https://www.openmods.info).
|
||||
|
||||
For stable release downloads, click [here](http://www.openmods.info/).
|
||||
For snapshot versions, check the [Jenkins](http://www.openmods.info:8080/).
|
||||
For snapshot versions, check the [Jenkins](https://builds.openmods.info).
|
||||
|
||||
FREQUENTLY ASKED QUESTIONS:
|
||||
-----------
|
||||
* "I dropped OpenBlocks into the mod folder and I **can't get it to work**!"
|
||||
* OpenModsLib is required for versions past v.1.2.2.
|
||||
* "I want to **disable** feature X!"
|
||||
* Setting any block or item's ID to 0 will disable it.
|
||||
* "How come my **elevators don't always work?**"
|
||||
* Recently, we made a change to the way elevators work-- they now require XP. You can disable this change in the config.
|
||||
* "Automatic enchantment tables won't enchant past a certain level!"
|
||||
* They require bookshelves, just like their mundane counterparts.
|
||||
* "Things like Thermal Expansion Fluiducts won't work with the automatic enchanter/anvil!"
|
||||
* You need to select the relevant side on the GUI to allow input. The tab you're looking for is on the right.
|
||||
* "How can I **contact** the OpenMods team?"
|
||||
* We're often on EsperNet IRC at #OpenMods, but you can also open up a new issue on our GitHub or send a message to us on reddit.
|
||||
**[FAQ](https://openmods.info/faq.html)**
|
||||
|
||||
|
||||
What does it contain?
|
||||
|
|
56
build.gradle
56
build.gradle
|
@ -16,29 +16,16 @@ buildscript {
|
|||
name = 'Forge'
|
||||
url = 'http://files.minecraftforge.net/maven'
|
||||
}
|
||||
maven {
|
||||
name 'OpenMods Third Party'
|
||||
url 'http://repo.openmods.info/artifactory/simple/thirdparty'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dependencies {
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.1-SNAPSHOT'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name 'Forge'
|
||||
url 'http://files.minecraftforge.net/maven'
|
||||
}
|
||||
maven {
|
||||
name 'MinecraftS3'
|
||||
url 'http://s3.amazonaws.com/Minecraft.Download/libraries'
|
||||
}
|
||||
maven {
|
||||
name "OpenMods"
|
||||
url "http://repo.openmods.info/artifactory/openmods"
|
||||
}
|
||||
maven {
|
||||
name "OpenMods 3rd party"
|
||||
url "http://repo.openmods.info/artifactory/thirdparty"
|
||||
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
|
||||
classpath 'net.thesilkminer.gradle.translationchecker:TranslationChecker:1.1'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,8 +37,8 @@ apply plugin: 'net.minecraftforge.gradle.forge'
|
|||
dependencies {
|
||||
compile project(":OpenModsLib") // Load OpenModsLib from submodule
|
||||
|
||||
compile "info.computercraft:ComputerCraft-API:1.78"
|
||||
compile "openperipheral:OpenPeripheralCore-API:"+opc_api_version
|
||||
compile "info.computercraft:ComputerCraft-API:1.80pr0"
|
||||
compile "info.openmods:OpenPeripheralCore-API:"+opc_api_version
|
||||
}
|
||||
|
||||
//================================================
|
||||
|
@ -60,8 +47,7 @@ dependencies {
|
|||
// Grab system env
|
||||
ext.env = System.getenv()
|
||||
|
||||
mod_version += "." + (env.BUILD_NUMBER ?: 'dev')
|
||||
version = mc_ver + "-" + mod_version
|
||||
version = mc_version + "-" + mod_version
|
||||
|
||||
ext.in_jenkins = false
|
||||
// Get Jenkins metadata
|
||||
|
@ -93,14 +79,14 @@ if (!in_jenkins) {
|
|||
|
||||
// Get Git metadata (if in Jenkins)
|
||||
ext.gitManifest = manifest {
|
||||
if (env.GIT_BRANCH != null) {
|
||||
if (branch != null) {
|
||||
attributes("Git-Branch": branch, "Git-Hash": hash)
|
||||
}
|
||||
}
|
||||
|
||||
// Setup Forge plugin
|
||||
minecraft {
|
||||
version = mc_ver + "-" + forge_ver
|
||||
version = mc_version + "-" + forge_version
|
||||
runDir = "run"
|
||||
|
||||
mappings = mcp_mappings
|
||||
|
@ -116,12 +102,13 @@ minecraft {
|
|||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", rootProject.mod_version
|
||||
inputs.property "version", mod_version
|
||||
inputs.property "mc_version", mc_version
|
||||
|
||||
// Process mcmod.info
|
||||
from(sourceSets.main.resources.srcDirs) {
|
||||
include '**/*.info'
|
||||
expand 'version':mod_version,'MCVersion':mc_ver
|
||||
expand 'version':mod_version, 'mc_version':mc_version
|
||||
}
|
||||
|
||||
// Copy anything else directly
|
||||
|
@ -178,3 +165,16 @@ artifacts {
|
|||
archives apiJar
|
||||
archives apiSrcJar
|
||||
}
|
||||
|
||||
task updateTranslations(type: net.thesilkminer.gradle.plugin.translationchecker.tasks.TranslationCheckTask) {
|
||||
modId = "openblocks"
|
||||
}
|
||||
|
||||
task checkTranslations(type: net.thesilkminer.gradle.plugin.translationchecker.tasks.TranslationCheckTask) {
|
||||
modId = "openblocks"
|
||||
dryRun = true
|
||||
}
|
||||
|
||||
task wrapper (type: Wrapper) {
|
||||
gradleVersion = "2.14"
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
mod_version=1.5.1
|
||||
mod_version=1.6
|
||||
api_version=1.1
|
||||
opc_api_version=3.3.2-1.8
|
||||
mc_ver=1.8.9
|
||||
forge_ver=11.15.0.1675
|
||||
mcp_mappings=stable_20
|
||||
opc_api_version=3.5-unstable
|
||||
mc_version=1.10.2
|
||||
forge_version=12.18.3.2185
|
||||
mcp_mappings=snapshot_20161111
|
||||
|
|
Binary file not shown.
|
@ -1,6 +1,6 @@
|
|||
#Mon Sep 14 12:28:28 PDT 2015
|
||||
#Sun Mar 19 21:46:20 CET 2017
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
||||
|
|
|
@ -6,12 +6,30 @@
|
|||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
|
@ -30,6 +48,7 @@ die ( ) {
|
|||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
|
@ -40,31 +59,11 @@ case "`uname`" in
|
|||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
|
@ -90,7 +89,7 @@ location of your Java installation."
|
|||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
|
@ -114,6 +113,7 @@ fi
|
|||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
|
@ -161,4 +161,4 @@ function splitJvmOpts() {
|
|||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
|
|
|
@ -1,90 +1,90 @@
|
|||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windowz variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
goto execute
|
||||
|
||||
:4NT_args
|
||||
@rem Get arguments from the 4NT Shell from JP Software
|
||||
set CMD_LINE_ARGS=%$
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
|
|
|
@ -2,7 +2,6 @@ package openblocks;
|
|||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.enchantment.EnchantmentData;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
|
@ -10,19 +9,36 @@ import net.minecraft.item.Item;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.IFuelHandler;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.RegistryDelegate;
|
||||
import net.minecraftforge.oredict.*;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import net.minecraftforge.oredict.RecipeSorter;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import net.minecraftforge.oredict.ShapelessOreRecipe;
|
||||
import openblocks.OpenBlocks.Enchantments;
|
||||
import openblocks.common.Stencil;
|
||||
import openblocks.common.TrophyHandler;
|
||||
import openblocks.common.item.*;
|
||||
import openblocks.common.recipe.*;
|
||||
import openblocks.enchantments.*;
|
||||
import openblocks.common.item.ItemGoldenEye;
|
||||
import openblocks.common.item.ItemImaginary;
|
||||
import openblocks.common.item.ItemPaintBrush;
|
||||
import openblocks.common.item.MetaStencil;
|
||||
import openblocks.common.item.MetasBucket;
|
||||
import openblocks.common.item.MetasGeneric;
|
||||
import openblocks.common.item.MetasGenericUnstackable;
|
||||
import openblocks.common.recipe.CrayonGlassesRecipe;
|
||||
import openblocks.common.recipe.CrayonMixingRecipe;
|
||||
import openblocks.common.recipe.EpicEraserRecipe;
|
||||
import openblocks.common.recipe.GoldenEyeRechargeRecipe;
|
||||
import openblocks.common.recipe.MapCloneRecipe;
|
||||
import openblocks.common.recipe.MapResizeRecipe;
|
||||
import openblocks.enchantments.EnchantmentExplosive;
|
||||
import openblocks.enchantments.EnchantmentFlimFlam;
|
||||
import openblocks.enchantments.EnchantmentLastStand;
|
||||
import openblocks.enchantments.ExplosiveEnchantmentsHandler;
|
||||
import openblocks.enchantments.FlimFlamEnchantmentsHandler;
|
||||
import openblocks.enchantments.LastStandEnchantmentsHandler;
|
||||
import openmods.colors.ColorMeta;
|
||||
import openmods.config.properties.ConfigProperty;
|
||||
import openmods.config.properties.OnLineModifiable;
|
||||
|
@ -69,9 +85,17 @@ public class Config {
|
|||
public static boolean displayAllFilledTanks = true;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "trophy", name = "trophyDropChance", comment = "The chance (from 0 to 1) of a trophy drop. for example, 0.001 for 1/1000")
|
||||
@ConfigProperty(category = "tanks", name = "fluidDifferenceUpdateThreshold", comment = "Minimal difference in fluid level between neigbors required for tank update (can be used for performance finetuning")
|
||||
public static int tankFluidUpdateThreshold = 0;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "trophy", name = "trophyDropChance", comment = "Legacy value. For actual configuration, see 'trophyDropChanceFormula'")
|
||||
public static double trophyDropChance = 0.001;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "trophy", name = "trophyDropChanceFormula", comment = "Formula for calculating trophy drop chance. Trophy drops when result is positive.")
|
||||
public static String trophyDropChanceFormula = "let([bias=rand()/4, selection=rand()], (looting + bias) * chance - selection)";
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "dropblock", name = "irregularBlocksArePassable", comment = "The elevator will try to pass through blocks that have custom collision boxes")
|
||||
public static boolean irregularBlocksArePassable = true;
|
||||
|
@ -193,6 +217,10 @@ public class Config {
|
|||
@ConfigProperty(category = "graves", name = "skeletonSpawnRate", comment = "Spawn rate, range: 0..1, default: about 1 per 50s")
|
||||
public static double skeletonSpawnRate = 0.002;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "graves", name = "requiresGraveInInv", comment = "Require gravestone to be in a player's inventory (it is consumed)")
|
||||
public static boolean requiresGraveInInv = false;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "graves", name = "specialActionFrequency", comment = "Frequency of special action on grave digging, 0..1")
|
||||
public static double graveSpecialAction = 0.03;
|
||||
|
@ -202,23 +230,32 @@ public class Config {
|
|||
public static boolean graveBase = true;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "graves", name = "voidFix", comment = "Should grave try to spawn when player died by falling into void? (false -> legacy behaviour)")
|
||||
public static boolean voidGraves = true;
|
||||
@ConfigProperty(category = "graves", name = "minimalPosY", comment = "Minimal height where grave should be spawned (default value selected to prevent spawning in bedrock)")
|
||||
public static int minGraveY = 6;
|
||||
|
||||
@ConfigProperty(category = "features", name = "explosiveEnchantmentId", comment = "Id of explosive enchantment")
|
||||
public static int explosiveEnchantmentId = 211;
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "graves", name = "maximalPosY", comment = "Maximal height where grave should be spawned (default value selected to prevent spawning in bedrock)")
|
||||
public static int maxGraveY = 255 - 6;
|
||||
|
||||
@ConfigProperty(category = "features", name = "lastStandEnchantmentId", comment = "Id of last stand enchantment")
|
||||
public static int lastStandEnchantmentId = 212;
|
||||
@ConfigProperty(category = "features", name = "explosiveEnchantment", comment = "Is 'Explosive' enchantment enabled")
|
||||
public static boolean explosiveEnchantmentEnabled = true;
|
||||
|
||||
@ConfigProperty(category = "features", name = "flimFlamEnchantmentId", comment = "Id of flim flam enchantment")
|
||||
public static int flimFlamEnchantmentId = 213;
|
||||
@ConfigProperty(category = "features", name = "lastStandEnchantment", comment = "Is 'Last Stand' enchantment enabled")
|
||||
public static boolean lastStandEnchantmentEnabled = true;
|
||||
|
||||
@ConfigProperty(category = "features", name = "flimFlamEnchantment", comment = "Is 'Flim-flam' enchantment enabled")
|
||||
public static boolean flimFlamEnchantmentEnabled = true;
|
||||
|
||||
@ConfigProperty(category = "features", name = "explosiveEnchantGrief", comment = "Explosive enchant can break blocks at level 3")
|
||||
public static boolean explosiveEnchantGrief = true;
|
||||
|
||||
@ConfigProperty(category = "cursor", name = "cursorMaxDamage", comment = "Amount of damage a cursor can take")
|
||||
public static int cursorMaxDamage = 128;
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "features", name = "lastStandFormula", comment = "Formula for XP cost (variables: hp,dmg,ench,xp). Note: calculation only triggers when hp - dmg < 1.")
|
||||
public static String lastStandEnchantmentFormula = "max(1, 50*(1-(hp-dmg))/ench)";
|
||||
|
||||
// 64 blocks, since containers usually have 64 blocks usability range (IInventory.isUseableByPlayer)
|
||||
@ConfigProperty(category = "cursor", name = "cursorMaxDistance", comment = "Maximum distance cursor can reach (warning: increasing may cause crashes)")
|
||||
public static int cursorDistanceLimit = 64;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "additional", name = "disableMobNames", comment = "List any mob names you want disabled on the server")
|
||||
|
@ -268,6 +305,25 @@ public class Config {
|
|||
@ConfigProperty(category = "sponge", name = "spongeRange", comment = "Sponge block range (distance from center)")
|
||||
public static int spongeStickRange = 3;
|
||||
|
||||
@ConfigProperty(category = "projector", name = "lightUpWhenWorking", comment = "Projector will light up whenever it is displaying a map")
|
||||
public static boolean litWhenDisplayingMap = true;
|
||||
|
||||
@ConfigProperty(category = "projector", name = "renderHolographicCone", comment = "Projector will render a holographic cone whenever active")
|
||||
public static boolean renderHoloCone = true;
|
||||
|
||||
@ConfigProperty(category = "projector", name = "brightness", comment = "The projector's cone will use the specified brightness value to render.\n"
|
||||
+ "Value must be between 0 and 255 inclusive. To use the default world brightness set -1 as the value.\n"
|
||||
+ "Keep in mind that default brightness means that the cone will render as light blue during the day and dark blue during the night.")
|
||||
public static int coneBrightness = -1;
|
||||
|
||||
@ConfigProperty(category = "projector", name = "lightLevel", comment = "Level of light emitted by the active projector. Defaults to 10. Must be at maximum 15 and positive")
|
||||
public static int projectorLightLevelValue = 10;
|
||||
|
||||
@ConfigProperty(category = "projector", name = "renderHolographicGrid", comment = "The holographic cone will display a grid.\n"
|
||||
+ "The grid texture may look a bit pixelated and there may be a little gap between two corners.\n"
|
||||
+ "This is not an error and it is only a texture calculation problem (e.g. 0.25 does not correctly correspond to 16 pixels in a 64x64 texture)")
|
||||
public static boolean renderHoloGrid = false;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "loot", name = "donationStation")
|
||||
public static boolean donationStationLoot = false;
|
||||
|
@ -303,6 +359,9 @@ public class Config {
|
|||
@ConfigProperty(category = "guide", name = "renderDistanceSq", comment = "Square of guide maximum render distance")
|
||||
public static double guideRenderRangeSq = 256 * 256;
|
||||
|
||||
@ConfigProperty(category = "guide", name = "useAdvancedRenderer", comment = "Try to use advanced OpenGL for performance improvement")
|
||||
public static boolean useAdvancedRenderer = true;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "scaffolding", name = "despawnRate", comment = "The rate at which scaffolding should break. 0 - fastest")
|
||||
public static int scaffoldingDespawnRate = 4;
|
||||
|
@ -327,6 +386,10 @@ public class Config {
|
|||
@ConfigProperty(category = "devnull", name = "sneakClickToGui", comment = "If true, /dev/null will require sneaking in addition to clicking air to open gui")
|
||||
public static boolean devNullSneakGui = true;
|
||||
|
||||
@OnLineModifiable
|
||||
@ConfigProperty(category = "hangglider", name = "enableThermal", comment = "Enable a whole new level of hanggliding experience through thermal lift. See keybindings for acoustic vario controls")
|
||||
public static boolean hanggliderEnableThermal = true;
|
||||
|
||||
public static void register() {
|
||||
final List<IRecipe> recipeList = CraftingManager.getInstance().getRecipeList();
|
||||
|
||||
|
@ -340,23 +403,23 @@ public class Config {
|
|||
OpenBlocks.Items.genericUnstackable.initRecipes();
|
||||
|
||||
if (OpenBlocks.Blocks.ladder != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.ladder, Blocks.ladder, Blocks.trapdoor));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.ladder, Blocks.LADDER, Blocks.TRAPDOOR));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.guide != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.guide, "grg", "gtg", "grg", 'g', "blockGlass", 't', Blocks.torch, 'r', "dustRedstone"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.guide, "grg", "gtg", "grg", 'g', "blockGlass", 't', Blocks.TORCH, 'r', "dustRedstone"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.builderGuide != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.builderGuide, "grg", "ete", "grg", 'g', "blockGlass", 't', Blocks.torch, 'r', "dustRedstone", 'e', Items.ender_pearl));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.builderGuide, "grg", "ete", "grg", 'g', "blockGlass", 't', Blocks.TORCH, 'r', "dustRedstone", 'e', Items.ENDER_PEARL));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.elevator != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.elevator, "www", "wew", "www", 'w', Blocks.wool, 'e', Items.ender_pearl));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.elevator, "www", "wew", "www", 'w', Blocks.WOOL, 'e', Items.ENDER_PEARL));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.elevatorRotating != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.elevatorRotating, "wiw", "wew", "wiw", 'w', Blocks.wool, 'e', Items.ender_pearl, 'i', "ingotIron"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.elevatorRotating, "wiw", "wew", "wiw", 'w', Blocks.WOOL, 'e', Items.ENDER_PEARL, 'i', "ingotIron"));
|
||||
|
||||
if (OpenBlocks.Blocks.elevator != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.elevatorRotating, OpenBlocks.Blocks.elevator, "ingotIron", "ingotIron"));
|
||||
|
@ -364,51 +427,51 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Blocks.target != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.target, "www", "www", "s s", 'w', Blocks.wool, 's', "stickWood"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.target, "www", "www", "s s", 'w', Blocks.WOOL, 's', "stickWood"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.flag != null) {
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.flag, 3), "scc", "sc ", "s ", 'c', Blocks.carpet, 's', "stickWood"));
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.flag, 3), "scc", "sc ", "s ", 'c', Blocks.CARPET, 's', "stickWood"));
|
||||
}
|
||||
if (OpenBlocks.Blocks.tank != null) {
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.tank, 2), "ogo", "ggg", "ogo", 'g', "paneGlass", 'o', Blocks.obsidian));
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.tank, 2), "ogo", "ggg", "ogo", 'g', "paneGlass", 'o', Blocks.OBSIDIAN));
|
||||
}
|
||||
if (OpenBlocks.Blocks.trophy != null) {
|
||||
MinecraftForge.EVENT_BUS.register(new TrophyHandler());
|
||||
}
|
||||
if (OpenBlocks.Blocks.bearTrap != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.bearTrap, "fif", "fif", "fif", 'f', Blocks.iron_bars, 'i', "ingotIron"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.bearTrap, "fif", "fif", "fif", 'f', Blocks.IRON_BARS, 'i', "ingotIron"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.sprinkler != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.sprinkler, "ifi", "iri", "ifi", 'i', "ingotIron", 'r', Blocks.redstone_torch, 'f', Blocks.iron_bars));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.sprinkler, "ifi", "iri", "ifi", 'i', "ingotIron", 'r', Blocks.REDSTONE_TORCH, 'f', Blocks.IRON_BARS));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.cannon != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.cannon, " d ", " f ", "iri", 'd', Blocks.dispenser, 'f', Blocks.iron_bars, 'i', "ingotIron", 'r', "blockRedstone"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.cannon, " d ", " f ", "iri", 'd', Blocks.DISPENSER, 'f', Blocks.IRON_BARS, 'i', "ingotIron", 'r', "blockRedstone"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.vacuumHopper != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.vacuumHopper, Blocks.hopper, Blocks.obsidian, Items.ender_eye));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.vacuumHopper, Blocks.HOPPER, Blocks.OBSIDIAN, Items.ENDER_EYE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.sponge != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.sponge, Blocks.wool, "slimeball"));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Blocks.sponge, Blocks.WOOL, "slimeball"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.bigButton != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.bigButton, "bb", "bb", 'b', Blocks.stone_button));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.bigButton, "bb", "bb", 'b', Blocks.STONE_BUTTON));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.imaginary != null) {
|
||||
{
|
||||
ItemStack pencil = ItemImaginary.setupValues(null, new ItemStack(OpenBlocks.Blocks.imaginary, 1, ItemImaginary.DAMAGE_PENCIL));
|
||||
recipeList.add(new ShapelessOreRecipe(pencil, Items.coal, "stickWood", Items.ender_eye, "slimeball"));
|
||||
recipeList.add(new ShapelessOreRecipe(pencil, Items.COAL, "stickWood", Items.ENDER_EYE, "slimeball"));
|
||||
}
|
||||
|
||||
for (ColorMeta color : ColorMeta.getAllColors()) {
|
||||
ItemStack crayon = ItemImaginary.setupValues(color.rgb, new ItemStack(OpenBlocks.Blocks.imaginary, 1, ItemImaginary.DAMAGE_CRAYON));
|
||||
recipeList.add(new ShapelessOreRecipe(crayon, color.oreName, Items.paper, Items.ender_eye, "slimeball"));
|
||||
recipeList.add(new ShapelessOreRecipe(crayon, color.oreName, Items.PAPER, Items.ENDER_EYE, "slimeball"));
|
||||
}
|
||||
|
||||
recipeList.add(new CrayonMixingRecipe());
|
||||
|
@ -416,11 +479,11 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Blocks.fan != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.fan, "f", "i", "s", 'f', Blocks.iron_bars, 'i', "ingotIron", 's', Blocks.stone_slab));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.fan, "f", "i", "s", 'f', Blocks.IRON_BARS, 'i', "ingotIron", 's', Blocks.STONE_SLAB));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.xpBottler != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpBottler, "iii", "ibi", "iii", 'i', "ingotIron", 'b', Items.glass_bottle));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpBottler, "iii", "ibi", "iii", 'i', "ingotIron", 'b', Items.GLASS_BOTTLE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.villageHighlighter != null) {
|
||||
|
@ -432,66 +495,61 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Blocks.autoAnvil != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.autoAnvil, "iii", "iai", "rrr", 'i', "ingotIron", 'a', Blocks.anvil, 'r', "dustRedstone"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.autoAnvil, "iii", "iai", "rrr", 'i', "ingotIron", 'a', Blocks.ANVIL, 'r', "dustRedstone"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.autoEnchantmentTable != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.autoEnchantmentTable, "iii", "iei", "rrr", 'i', "ingotIron", 'e', Blocks.enchanting_table, 'r', "dustRedstone"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.autoEnchantmentTable, "iii", "iei", "rrr", 'i', "ingotIron", 'e', Blocks.ENCHANTING_TABLE, 'r', "dustRedstone"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.xpDrain != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpDrain, "iii", "iii", "iii", 'i', Blocks.iron_bars));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpDrain, "iii", "iii", "iii", 'i', Blocks.IRON_BARS));
|
||||
}
|
||||
if (OpenBlocks.Blocks.blockBreaker != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.blockBreaker, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Items.diamond_pickaxe));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.blockBreaker, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Items.DIAMOND_PICKAXE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.blockPlacer != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.blockPlacer, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Blocks.piston));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.blockPlacer, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Blocks.PISTON));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.itemDropper != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.itemDropper, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Blocks.hopper));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.itemDropper, "icc", "src", "icc", 'i', "ingotIron", 'c', "cobblestone", 'r', "dustRedstone", 's', Blocks.HOPPER));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.ropeLadder != null) {
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.ropeLadder, 8), "sts", "sts", "sts", 't', "stickWood", 's', Items.string));
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.ropeLadder, 8), "sts", "sts", "sts", 't', "stickWood", 's', Items.STRING));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.donationStation != null) {
|
||||
WeightedRandomChestContent drop = new WeightedRandomChestContent(new ItemStack(OpenBlocks.Blocks.donationStation), 1, 1, 2);
|
||||
|
||||
if (donationStationLoot) {
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(drop);
|
||||
}
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.donationStation, "ppp", "pcp", "ppp", 'p', Items.porkchop, 'c', "chestWood"));
|
||||
// TODO 1.10 Loot tables
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.donationStation, "ppp", "pcp", "ppp", 'p', Items.PORKCHOP, 'c', "chestWood"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.paintMixer != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.paintMixer, "ooo", "i i", "iii", 'o', Blocks.obsidian, 'i', "ingotIron"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.paintMixer, "ooo", "i i", "iii", 'o', Blocks.OBSIDIAN, 'i', "ingotIron"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.canvas != null) {
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.canvas, 9), "ppp", "pfp", "ppp", 'p', Items.paper, 'f', Blocks.oak_fence)); // TODO OreDict?
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Blocks.canvas, 9), "ppp", "pfp", "ppp", 'p', Items.PAPER, 'f', Blocks.OAK_FENCE)); // TODO OreDict?
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.projector != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.projector, "grl", "iri", "srs", 's', Blocks.stone_slab, 'r', "dustRedstone", 'g', "dustGlowstone", 'i', "ingotIron", 'l', "gemLapis"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.projector, "lrg", "iri", "srs", 's', Blocks.stone_slab, 'r', "dustRedstone", 'g', "dustGlowstone", 'i', "ingotIron", 'l', "gemLapis"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.projector, "grl", "iri", "srs", 's', Blocks.STONE_SLAB, 'r', "dustRedstone", 'g', "dustGlowstone", 'i', "ingotIron", 'l', "gemLapis"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.projector, "lrg", "iri", "srs", 's', Blocks.STONE_SLAB, 'r', "dustRedstone", 'g', "dustGlowstone", 'i', "ingotIron", 'l', "gemLapis"));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.goldenEgg != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.goldenEgg, "ggg", "geg", "ggg", 'g', "ingotGold", 'e', Items.egg));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.goldenEgg, "ggg", "geg", "ggg", 'g', "ingotGold", 'e', Items.EGG));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.sky != null) {
|
||||
final ItemStack normal6 = new ItemStack(OpenBlocks.Blocks.sky, 6, 0);
|
||||
final ItemStack normal = new ItemStack(OpenBlocks.Blocks.sky, 1, 1);
|
||||
final ItemStack inverted = new ItemStack(OpenBlocks.Blocks.sky, 1, 0);
|
||||
recipeList.add(new ShapedOreRecipe(normal6, "geg", "gsg", "geg", 'g', "blockGlassColorless", 'e', Items.ender_eye, 's', Blocks.end_stone));
|
||||
recipeList.add(new ShapelessOreRecipe(inverted, normal, Blocks.redstone_torch));
|
||||
recipeList.add(new ShapelessOreRecipe(normal, inverted, Blocks.redstone_torch));
|
||||
recipeList.add(new ShapedOreRecipe(normal6, "geg", "gsg", "geg", 'g', "blockGlassColorless", 'e', Items.ENDER_EYE, 's', Blocks.END_STONE));
|
||||
recipeList.add(new ShapelessOreRecipe(inverted, normal, Blocks.REDSTONE_TORCH));
|
||||
recipeList.add(new ShapelessOreRecipe(normal, inverted, Blocks.REDSTONE_TORCH));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.drawingTable != null) {
|
||||
|
@ -499,7 +557,7 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Blocks.xpShower != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpShower, "iii", " o", 'i', "ingotIron", 'o', Blocks.obsidian));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Blocks.xpShower, "iii", " o", 'i', "ingotIron", 'o', Blocks.OBSIDIAN));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Blocks.scaffolding != null) {
|
||||
|
@ -523,12 +581,11 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Items.sonicGlasses != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.sonicGlasses, "ihi", "oso", " ", 's', "stickWood", 'h', Items.iron_helmet, 'o', Blocks.obsidian, 'i', "ingotIron"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.sonicGlasses, "ihi", "oso", " ", 's', "stickWood", 'h', Items.IRON_HELMET, 'o', Blocks.OBSIDIAN, 'i', "ingotIron"));
|
||||
ItemStack stack = new ItemStack(OpenBlocks.Items.sonicGlasses);
|
||||
|
||||
if (sonicGlassesLoot) {
|
||||
WeightedRandomChestContent drop = new WeightedRandomChestContent(stack, 1, 1, 2);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(drop);
|
||||
// TODO 1.10 Loot tables
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,7 +593,7 @@ public class Config {
|
|||
if (OpenBlocks.Items.pencilGlasses != null) {
|
||||
ItemStack block = new ItemStack(OpenBlocks.Blocks.imaginary, 1, ItemImaginary.DAMAGE_PENCIL);
|
||||
ItemImaginary.setupValues(null, block);
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.pencilGlasses, block, Items.paper));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.pencilGlasses, block, Items.PAPER));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.crayonGlasses != null) {
|
||||
|
@ -546,9 +603,7 @@ public class Config {
|
|||
}
|
||||
|
||||
if (technicolorGlassesLoot && OpenBlocks.Items.technicolorGlasses != null) {
|
||||
WeightedRandomChestContent drop = new WeightedRandomChestContent(new ItemStack(OpenBlocks.Items.technicolorGlasses), 1, 1, 2);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(drop);
|
||||
// TODO 1.10 Loot tables
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +614,7 @@ public class Config {
|
|||
if (OpenBlocks.Items.craneBackpack != null) {
|
||||
ItemStack line = MetasGeneric.line.newItemStack();
|
||||
ItemStack beam = MetasGeneric.beam.newItemStack();
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.craneBackpack, MetasGeneric.craneEngine.newItemStack(), MetasGeneric.craneMagnet.newItemStack(), beam, beam, line, line, line, Items.leather));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.craneBackpack, MetasGeneric.craneEngine.newItemStack(), MetasGeneric.craneMagnet.newItemStack(), beam, beam, line, line, line, Items.LEATHER));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.slimalyzer != null) {
|
||||
|
@ -567,11 +622,11 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Items.sleepingBag != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.sleepingBag, "cc ", "www", "ccw", 'c', Blocks.carpet, 'w', Blocks.wool));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.sleepingBag, "cc ", "www", "ccw", 'c', Blocks.CARPET, 'w', Blocks.WOOL));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.paintBrush != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.paintBrush, "w ", " s ", " s", 'w', Blocks.wool, 's', "stickWood"));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.paintBrush, "w ", " s ", " s", 'w', Blocks.WOOL, 's', "stickWood"));
|
||||
|
||||
final ItemStack template = new ItemStack(OpenBlocks.Items.paintBrush, 1, OreDictionary.WILDCARD_VALUE);
|
||||
for (ColorMeta color : ColorMeta.getAllColors()) {
|
||||
|
@ -582,11 +637,7 @@ public class Config {
|
|||
if (paintBrushLoot) {
|
||||
for (int color : new int[] { 0xFF0000, 0x00FF00, 0x0000FF }) {
|
||||
ItemStack stack = ItemPaintBrush.createStackWithColor(color);
|
||||
WeightedRandomChestContent drop = new WeightedRandomChestContent(stack, 1, 1, 2);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(drop);
|
||||
// TODO 1.10 Loot tables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -597,9 +648,7 @@ public class Config {
|
|||
|
||||
if (stencilLoot) {
|
||||
for (Stencil stencil : Stencil.values()) {
|
||||
WeightedRandomChestContent drop = new WeightedRandomChestContent(new ItemStack(OpenBlocks.Items.stencil, 1, stencil.ordinal()), 1, 1, 2);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(drop);
|
||||
ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR).addItem(drop);
|
||||
// TODO 1.10 Loot tables
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -628,32 +677,32 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Items.cartographer != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.cartographer, MetasGeneric.assistantBase.newItemStack(), Items.ender_eye));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.cartographer, MetasGeneric.assistantBase.newItemStack(), Items.ENDER_EYE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.goldenEye != null) {
|
||||
recipeList.add(new GoldenEyeRechargeRecipe());
|
||||
RecipeSorter.register("openblocks:golden_eye_recharge", GoldenEyeRechargeRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Items.goldenEye, 1, ItemGoldenEye.MAX_DAMAGE), "ggg", "geg", "ggg", 'g', "nuggetGold", 'e', Items.ender_eye));
|
||||
recipeList.add(new ShapedOreRecipe(new ItemStack(OpenBlocks.Items.goldenEye, 1, ItemGoldenEye.MAX_DAMAGE), "ggg", "geg", "ggg", 'g', "nuggetGold", 'e', Items.ENDER_EYE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.tastyClay != null) {
|
||||
final ItemStack cocoa = ColorMeta.BROWN.createStack(Items.dye, 1);
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.tastyClay, 2), Items.clay_ball, Items.milk_bucket, cocoa));
|
||||
final ItemStack cocoa = ColorMeta.BROWN.createStack(Items.DYE, 1);
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.tastyClay, 2), Items.CLAY_BALL, Items.MILK_BUCKET, cocoa));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.cursor != null) {
|
||||
final ItemStack whiteWool = ColorMeta.WHITE.createStack(Blocks.wool, 1);
|
||||
final ItemStack whiteWool = ColorMeta.WHITE.createStack(Blocks.WOOL, 1);
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.cursor, "w ", "www", "www", 'w', whiteWool));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.infoBook != null) {
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.infoBook), Items.clay_ball, Items.book));
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.infoBook), Items.CLAY_BALL, Items.BOOK));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.devNull != null) {
|
||||
MinecraftForge.EVENT_BUS.register(OpenBlocks.Items.devNull);
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.devNull), "cobblestone", Items.apple));
|
||||
recipeList.add(new ShapelessOreRecipe(new ItemStack(OpenBlocks.Items.devNull), "cobblestone", Items.APPLE));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.spongeonastick != null) {
|
||||
|
@ -663,13 +712,13 @@ public class Config {
|
|||
}
|
||||
|
||||
if (OpenBlocks.Items.pedometer != null) {
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.pedometer, "www", "rcr", "www", 'w', "plankWood", 'r', "dustRedstone", 'c', Items.clock));
|
||||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.pedometer, "www", "rcr", "www", 'w', "plankWood", 'r', "dustRedstone", 'c', Items.CLOCK));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.epicEraser != null) {
|
||||
recipeList.add(new EpicEraserRecipe());
|
||||
RecipeSorter.register("openblocks:epic_eraser", EpicEraserRecipe.class, RecipeSorter.Category.SHAPELESS, "after:minecraft:shapeless");
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.epicEraser, "gemLapis", "slimeball", Blocks.wool));
|
||||
recipeList.add(new ShapelessOreRecipe(OpenBlocks.Items.epicEraser, "gemLapis", "slimeball", Blocks.WOOL));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.filledBucket != null) {
|
||||
|
@ -681,25 +730,26 @@ public class Config {
|
|||
recipeList.add(new ShapedOreRecipe(OpenBlocks.Items.wrench, "iii", "iii", 'i', "ingotIron"));
|
||||
}
|
||||
|
||||
if (explosiveEnchantmentId > 0) {
|
||||
if (explosiveEnchantmentEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new ExplosiveEnchantmentsHandler());
|
||||
Enchantments.explosive = new EnchantmentExplosive(explosiveEnchantmentId);
|
||||
GameRegistry.register(new EnchantmentExplosive().setRegistryName(OpenBlocks.location("explosive")));
|
||||
}
|
||||
|
||||
if (lastStandEnchantmentId > 0) {
|
||||
if (lastStandEnchantmentEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new LastStandEnchantmentsHandler());
|
||||
Enchantments.lastStand = new EnchantmentLastStand(lastStandEnchantmentId);
|
||||
GameRegistry.register(new EnchantmentLastStand().setRegistryName(OpenBlocks.location("last_stand")));
|
||||
}
|
||||
|
||||
if (flimFlamEnchantmentId > 0) {
|
||||
if (flimFlamEnchantmentEnabled) {
|
||||
FlimFlamEnchantmentsHandler.registerCapability();
|
||||
MinecraftForge.EVENT_BUS.register(new FlimFlamEnchantmentsHandler());
|
||||
Enchantments.flimFlam = new EnchantmentFlimFlam(flimFlamEnchantmentId);
|
||||
GameRegistry.register(new EnchantmentFlimFlam().setRegistryName(OpenBlocks.location("flim_flam")));
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int emeraldCount = 1 << i;
|
||||
ItemStack result = Items.enchanted_book.getEnchantedItemStack(new EnchantmentData(Enchantments.flimFlam, i + 1));
|
||||
ItemStack result = Items.ENCHANTED_BOOK.getEnchantedItemStack(new EnchantmentData(Enchantments.flimFlam, i + 1));
|
||||
Object recipe[] = new Object[emeraldCount + 1];
|
||||
recipe[0] = Items.book;
|
||||
recipe[0] = Items.BOOK;
|
||||
Arrays.fill(recipe, 1, recipe.length, "gemEmerald");
|
||||
recipeList.add(new ShapelessOreRecipe(result, recipe));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
package openblocks;
|
||||
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openmods.api.IProxy;
|
||||
|
||||
public interface IOpenBlocksProxy extends IProxy {
|
||||
public void spawnLiquidSpray(World worldObj, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3 velocity);
|
||||
public int getParticleSettings();
|
||||
|
||||
public void spawnLiquidSpray(World worldObj, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3d velocity);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,27 +1,30 @@
|
|||
package openblocks;
|
||||
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
import com.google.common.base.Throwables;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import openblocks.OpenBlocks.Items;
|
||||
import codechicken.nei.api.IConfigureNEI;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import openmods.Log;
|
||||
|
||||
public class NEIOpenBlocksConfig implements IConfigureNEI {
|
||||
|
||||
private static final String API = "codechicken.nei.api.API";
|
||||
private static final String HIDE_ITEM = "hideItem";
|
||||
|
||||
private Method hideItem;
|
||||
|
||||
@Override
|
||||
public void loadConfig() {
|
||||
try {
|
||||
// I have no idea how to link with NEI API
|
||||
Class<?> cls = Class.forName("codechicken.nei.api.API");
|
||||
Method hide = cls.getMethod("hideItem", ItemStack.class);
|
||||
|
||||
if (Items.heightMap != null) hide.invoke(null, new ItemStack(Items.heightMap, 1, OreDictionary.WILDCARD_VALUE));
|
||||
} catch (Throwable t) {
|
||||
Throwables.propagate(t);
|
||||
if (OpenBlocks.Blocks.canvasGlass != null) {
|
||||
API$hideItem(new ItemStack(OpenBlocks.Blocks.canvasGlass));
|
||||
}
|
||||
|
||||
if (OpenBlocks.Items.heightMap != null) {
|
||||
API$hideItem(new ItemStack(OpenBlocks.Items.heightMap, 1, OreDictionary.WILDCARD_VALUE));
|
||||
}
|
||||
|
||||
Log.info("OpenBlocks NEI Integration loaded successfully");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -34,4 +37,12 @@ public class NEIOpenBlocksConfig implements IConfigureNEI {
|
|||
return "0.0";
|
||||
}
|
||||
|
||||
private void API$hideItem(final ItemStack stack) {
|
||||
try {
|
||||
if (this.hideItem == null) this.hideItem = Class.forName(API).getMethod(HIDE_ITEM, ItemStack.class);
|
||||
this.hideItem.invoke(null, stack);
|
||||
} catch (final Throwable thr) {
|
||||
Throwables.propagate(thr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
|
@ -11,35 +11,190 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.stats.Achievement;
|
||||
import net.minecraft.stats.StatBase;
|
||||
import net.minecraft.stats.StatBasic;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.*;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
import net.minecraftforge.fml.common.event.*;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLInterModComms;
|
||||
import net.minecraftforge.fml.common.event.FMLMissingMappingsEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||
import net.minecraftforge.fml.common.registry.*;
|
||||
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerCareer;
|
||||
import net.minecraftforge.fml.common.registry.VillagerRegistry.VillagerProfession;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import openblocks.common.*;
|
||||
import openblocks.common.block.*;
|
||||
import openblocks.common.entity.*;
|
||||
import openblocks.common.item.*;
|
||||
import openblocks.common.CommandInventory;
|
||||
import openblocks.common.DonationUrlManager;
|
||||
import openblocks.common.ElevatorActionHandler;
|
||||
import openblocks.common.ElevatorBlockRules;
|
||||
import openblocks.common.EntityEventHandler;
|
||||
import openblocks.common.GameRuleManager;
|
||||
import openblocks.common.LuggageDropHandler;
|
||||
import openblocks.common.MagnetWhitelists;
|
||||
import openblocks.common.MapDataManager;
|
||||
import openblocks.common.PedometerHandler;
|
||||
import openblocks.common.PlayerDeathHandler;
|
||||
import openblocks.common.PlayerInventoryStore;
|
||||
import openblocks.common.ServerTickHandler;
|
||||
import openblocks.common.block.BlockAutoAnvil;
|
||||
import openblocks.common.block.BlockAutoEnchantmentTable;
|
||||
import openblocks.common.block.BlockBearTrap;
|
||||
import openblocks.common.block.BlockBigButton;
|
||||
import openblocks.common.block.BlockBlockBreaker;
|
||||
import openblocks.common.block.BlockBlockPlacer;
|
||||
import openblocks.common.block.BlockBuilderGuide;
|
||||
import openblocks.common.block.BlockCannon;
|
||||
import openblocks.common.block.BlockCanvas;
|
||||
import openblocks.common.block.BlockCanvasGlass;
|
||||
import openblocks.common.block.BlockDonationStation;
|
||||
import openblocks.common.block.BlockDrawingTable;
|
||||
import openblocks.common.block.BlockElevator;
|
||||
import openblocks.common.block.BlockElevatorRotating;
|
||||
import openblocks.common.block.BlockFan;
|
||||
import openblocks.common.block.BlockFlag;
|
||||
import openblocks.common.block.BlockGoldenEgg;
|
||||
import openblocks.common.block.BlockGrave;
|
||||
import openblocks.common.block.BlockGuide;
|
||||
import openblocks.common.block.BlockHeal;
|
||||
import openblocks.common.block.BlockImaginary;
|
||||
import openblocks.common.block.BlockItemDropper;
|
||||
import openblocks.common.block.BlockLadder;
|
||||
import openblocks.common.block.BlockPaintCan;
|
||||
import openblocks.common.block.BlockPaintMixer;
|
||||
import openblocks.common.block.BlockPath;
|
||||
import openblocks.common.block.BlockProjector;
|
||||
import openblocks.common.block.BlockRopeLadder;
|
||||
import openblocks.common.block.BlockScaffolding;
|
||||
import openblocks.common.block.BlockSky;
|
||||
import openblocks.common.block.BlockSponge;
|
||||
import openblocks.common.block.BlockSprinkler;
|
||||
import openblocks.common.block.BlockTank;
|
||||
import openblocks.common.block.BlockTarget;
|
||||
import openblocks.common.block.BlockTrophy;
|
||||
import openblocks.common.block.BlockVacuumHopper;
|
||||
import openblocks.common.block.BlockVillageHighlighter;
|
||||
import openblocks.common.block.BlockXPBottler;
|
||||
import openblocks.common.block.BlockXPDrain;
|
||||
import openblocks.common.block.BlockXPShower;
|
||||
import openblocks.common.entity.EntityCartographer;
|
||||
import openblocks.common.entity.EntityGoldenEye;
|
||||
import openblocks.common.entity.EntityHangGlider;
|
||||
import openblocks.common.entity.EntityItemProjectile;
|
||||
import openblocks.common.entity.EntityLuggage;
|
||||
import openblocks.common.entity.EntityMagnet;
|
||||
import openblocks.common.entity.EntityMiniMe;
|
||||
import openblocks.common.entity.EntityMountedBlock;
|
||||
import openblocks.common.entity.EntityXPOrbNoFly;
|
||||
import openblocks.common.item.ItemCartographer;
|
||||
import openblocks.common.item.ItemCraneBackpack;
|
||||
import openblocks.common.item.ItemCraneControl;
|
||||
import openblocks.common.item.ItemCursor;
|
||||
import openblocks.common.item.ItemDevNull;
|
||||
import openblocks.common.item.ItemElevator;
|
||||
import openblocks.common.item.ItemEmptyMap;
|
||||
import openblocks.common.item.ItemEpicEraser;
|
||||
import openblocks.common.item.ItemFilledBucket;
|
||||
import openblocks.common.item.ItemFlagBlock;
|
||||
import openblocks.common.item.ItemGoldenEye;
|
||||
import openblocks.common.item.ItemGuide;
|
||||
import openblocks.common.item.ItemHangGlider;
|
||||
import openblocks.common.item.ItemHeightMap;
|
||||
import openblocks.common.item.ItemImaginary;
|
||||
import openblocks.common.item.ItemImaginationGlasses;
|
||||
import openblocks.common.item.ItemImaginationGlasses.ItemCrayonGlasses;
|
||||
import openblocks.common.tileentity.*;
|
||||
import openblocks.enchantments.flimflams.*;
|
||||
import openblocks.common.item.ItemInfoBook;
|
||||
import openblocks.common.item.ItemLuggage;
|
||||
import openblocks.common.item.ItemOBGeneric;
|
||||
import openblocks.common.item.ItemOBGenericUnstackable;
|
||||
import openblocks.common.item.ItemPaintBrush;
|
||||
import openblocks.common.item.ItemPaintCan;
|
||||
import openblocks.common.item.ItemPedometer;
|
||||
import openblocks.common.item.ItemSkyBlock;
|
||||
import openblocks.common.item.ItemSleepingBag;
|
||||
import openblocks.common.item.ItemSlimalyzer;
|
||||
import openblocks.common.item.ItemSonicGlasses;
|
||||
import openblocks.common.item.ItemSpongeOnAStick;
|
||||
import openblocks.common.item.ItemSqueegee;
|
||||
import openblocks.common.item.ItemTankBlock;
|
||||
import openblocks.common.item.ItemTastyClay;
|
||||
import openblocks.common.item.ItemTrophyBlock;
|
||||
import openblocks.common.item.ItemWrench;
|
||||
import openblocks.common.tileentity.TileEntityAutoAnvil;
|
||||
import openblocks.common.tileentity.TileEntityAutoEnchantmentTable;
|
||||
import openblocks.common.tileentity.TileEntityBearTrap;
|
||||
import openblocks.common.tileentity.TileEntityBigButton;
|
||||
import openblocks.common.tileentity.TileEntityBlockBreaker;
|
||||
import openblocks.common.tileentity.TileEntityBlockPlacer;
|
||||
import openblocks.common.tileentity.TileEntityBuilderGuide;
|
||||
import openblocks.common.tileentity.TileEntityCannon;
|
||||
import openblocks.common.tileentity.TileEntityCanvas;
|
||||
import openblocks.common.tileentity.TileEntityDonationStation;
|
||||
import openblocks.common.tileentity.TileEntityDrawingTable;
|
||||
import openblocks.common.tileentity.TileEntityElevatorRotating;
|
||||
import openblocks.common.tileentity.TileEntityFan;
|
||||
import openblocks.common.tileentity.TileEntityFlag;
|
||||
import openblocks.common.tileentity.TileEntityGoldenEgg;
|
||||
import openblocks.common.tileentity.TileEntityGrave;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import openblocks.common.tileentity.TileEntityHealBlock;
|
||||
import openblocks.common.tileentity.TileEntityImaginary;
|
||||
import openblocks.common.tileentity.TileEntityItemDropper;
|
||||
import openblocks.common.tileentity.TileEntityPaintCan;
|
||||
import openblocks.common.tileentity.TileEntityPaintMixer;
|
||||
import openblocks.common.tileentity.TileEntityProjector;
|
||||
import openblocks.common.tileentity.TileEntitySky;
|
||||
import openblocks.common.tileentity.TileEntitySprinkler;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
import openblocks.common.tileentity.TileEntityTarget;
|
||||
import openblocks.common.tileentity.TileEntityTrophy;
|
||||
import openblocks.common.tileentity.TileEntityVacuumHopper;
|
||||
import openblocks.common.tileentity.TileEntityVillageHighlighter;
|
||||
import openblocks.common.tileentity.TileEntityXPBottler;
|
||||
import openblocks.common.tileentity.TileEntityXPDrain;
|
||||
import openblocks.common.tileentity.TileEntityXPShower;
|
||||
import openblocks.enchantments.flimflams.BaneFlimFlam;
|
||||
import openblocks.enchantments.flimflams.DummyCreepersFlimFlam;
|
||||
import openblocks.enchantments.flimflams.EffectFlimFlam;
|
||||
import openblocks.enchantments.flimflams.EncaseFlimFlam;
|
||||
import openblocks.enchantments.flimflams.FlimFlamRegistry;
|
||||
import openblocks.enchantments.flimflams.InventoryShuffleFlimFlam;
|
||||
import openblocks.enchantments.flimflams.InvisibleMobsFlimFlam;
|
||||
import openblocks.enchantments.flimflams.ItemDropFlimFlam;
|
||||
import openblocks.enchantments.flimflams.LoreFlimFlam;
|
||||
import openblocks.enchantments.flimflams.MountFlimFlam;
|
||||
import openblocks.enchantments.flimflams.RenameFlimFlam;
|
||||
import openblocks.enchantments.flimflams.SheepDyeFlimFlam;
|
||||
import openblocks.enchantments.flimflams.SkyblockFlimFlam;
|
||||
import openblocks.enchantments.flimflams.SnowballsFlimFlam;
|
||||
import openblocks.enchantments.flimflams.SoundFlimFlam;
|
||||
import openblocks.enchantments.flimflams.SquidFilmFlam;
|
||||
import openblocks.enchantments.flimflams.TeleportFlimFlam;
|
||||
import openblocks.enchantments.flimflams.UselessToolFlimFlam;
|
||||
import openblocks.events.ElevatorActionEvent;
|
||||
import openblocks.events.PlayerActionEvent;
|
||||
import openblocks.integration.ModuleAdapters;
|
||||
import openblocks.integration.ModuleTurtles;
|
||||
import openblocks.rpc.*;
|
||||
import openblocks.rpc.IColorChanger;
|
||||
import openblocks.rpc.IGuideAnimationTrigger;
|
||||
import openblocks.rpc.ILevelChanger;
|
||||
import openblocks.rpc.IRotatable;
|
||||
import openblocks.rpc.IStencilCrafter;
|
||||
import openblocks.rpc.ITriggerable;
|
||||
import openblocks.rubbish.BrickManager;
|
||||
import openblocks.rubbish.CommandFlimFlam;
|
||||
import openblocks.rubbish.CommandLuck;
|
||||
|
@ -48,7 +203,11 @@ import openmods.OpenMods;
|
|||
import openmods.colors.ColoredModelProvider;
|
||||
import openmods.config.BlockInstances;
|
||||
import openmods.config.ItemInstances;
|
||||
import openmods.config.game.*;
|
||||
import openmods.config.game.FactoryRegistry;
|
||||
import openmods.config.game.GameRegistryObjectsProvider;
|
||||
import openmods.config.game.ModStartupHelper;
|
||||
import openmods.config.game.RegisterBlock;
|
||||
import openmods.config.game.RegisterItem;
|
||||
import openmods.config.properties.ConfigProcessing;
|
||||
import openmods.integration.Integration;
|
||||
import openmods.liquids.BucketFillHandler;
|
||||
|
@ -56,8 +215,6 @@ import openmods.network.event.NetworkEventManager;
|
|||
import openmods.network.rpc.RpcCallDispatcher;
|
||||
import openmods.utils.EnchantmentUtils;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
|
||||
@Mod(modid = OpenBlocks.MODID, name = OpenBlocks.NAME, version = OpenBlocks.VERSION, dependencies = OpenBlocks.DEPENDENCIES, guiFactory = "openblocks.client.ModGuiFactory")
|
||||
public class OpenBlocks {
|
||||
public static final String MODID = "OpenBlocks";
|
||||
|
@ -87,214 +244,214 @@ public class OpenBlocks {
|
|||
private final ApiSetup apiSetup = new ApiSetup();
|
||||
|
||||
public static class Blocks implements BlockInstances {
|
||||
@RegisterBlock(name = "ladder")
|
||||
@RegisterBlock(id = "ladder")
|
||||
public static BlockLadder ladder;
|
||||
|
||||
@RegisterBlock(name = "guide", tileEntity = TileEntityGuide.class, itemBlock = ItemGuide.class)
|
||||
@RegisterBlock(id = "guide", tileEntity = TileEntityGuide.class, itemBlock = ItemGuide.class)
|
||||
public static BlockGuide guide;
|
||||
|
||||
@RegisterBlock(name = "builder_guide", tileEntity = TileEntityBuilderGuide.class, itemBlock = ItemGuide.class)
|
||||
@RegisterBlock(id = "builder_guide", tileEntity = TileEntityBuilderGuide.class, itemBlock = ItemGuide.class)
|
||||
public static BlockBuilderGuide builderGuide;
|
||||
|
||||
@RegisterBlock(name = "elevator", itemBlock = ItemElevator.class, registerDefaultItemModel = false, customItemModels = ColoredModelProvider.class)
|
||||
@RegisterBlock(id = "elevator", itemBlock = ItemElevator.class, registerDefaultItemModel = false, customItemModels = ColoredModelProvider.class)
|
||||
public static BlockElevator elevator;
|
||||
|
||||
@RegisterBlock(name = "elevator_rotating", tileEntity = TileEntityElevatorRotating.class, itemBlock = ItemElevator.class, registerDefaultItemModel = false, customItemModels = ColoredModelProvider.class)
|
||||
@RegisterBlock(id = "elevator_rotating", tileEntity = TileEntityElevatorRotating.class, itemBlock = ItemElevator.class, registerDefaultItemModel = false, customItemModels = ColoredModelProvider.class)
|
||||
public static BlockElevatorRotating elevatorRotating;
|
||||
|
||||
@RegisterBlock(name = "heal", tileEntity = TileEntityHealBlock.class)
|
||||
@RegisterBlock(id = "heal", tileEntity = TileEntityHealBlock.class)
|
||||
public static BlockHeal heal;
|
||||
|
||||
@RegisterBlock(name = "target", tileEntity = TileEntityTarget.class)
|
||||
@RegisterBlock(id = "target", tileEntity = TileEntityTarget.class)
|
||||
public static BlockTarget target;
|
||||
|
||||
@RegisterBlock(name = "grave", tileEntity = TileEntityGrave.class)
|
||||
@RegisterBlock(id = "grave", tileEntity = TileEntityGrave.class)
|
||||
public static BlockGrave grave;
|
||||
|
||||
@RegisterBlock(name = "flag", tileEntity = TileEntityFlag.class, itemBlock = ItemFlagBlock.class)
|
||||
@RegisterBlock(id = "flag", tileEntity = TileEntityFlag.class, itemBlock = ItemFlagBlock.class)
|
||||
public static BlockFlag flag;
|
||||
|
||||
@RegisterBlock(name = "tank", tileEntity = TileEntityTank.class, itemBlock = ItemTankBlock.class)
|
||||
@RegisterBlock(id = "tank", tileEntity = TileEntityTank.class, itemBlock = ItemTankBlock.class)
|
||||
public static BlockTank tank;
|
||||
|
||||
@RegisterBlock(name = "trophy", tileEntity = TileEntityTrophy.class, itemBlock = ItemTrophyBlock.class)
|
||||
@RegisterBlock(id = "trophy", tileEntity = TileEntityTrophy.class, itemBlock = ItemTrophyBlock.class)
|
||||
public static BlockTrophy trophy;
|
||||
|
||||
@RegisterBlock(name = "beartrap", tileEntity = TileEntityBearTrap.class)
|
||||
@RegisterBlock(id = "beartrap", tileEntity = TileEntityBearTrap.class)
|
||||
public static BlockBearTrap bearTrap;
|
||||
|
||||
@RegisterBlock(name = "sprinkler", tileEntity = TileEntitySprinkler.class)
|
||||
@RegisterBlock(id = "sprinkler", tileEntity = TileEntitySprinkler.class)
|
||||
public static BlockSprinkler sprinkler;
|
||||
|
||||
@RegisterBlock(name = "cannon", tileEntity = TileEntityCannon.class)
|
||||
@RegisterBlock(id = "cannon", tileEntity = TileEntityCannon.class)
|
||||
public static BlockCannon cannon;
|
||||
|
||||
@RegisterBlock(name = "vacuumhopper", tileEntity = TileEntityVacuumHopper.class)
|
||||
@RegisterBlock(id = "vacuumhopper", tileEntity = TileEntityVacuumHopper.class)
|
||||
public static BlockVacuumHopper vacuumHopper;
|
||||
|
||||
@RegisterBlock(name = "sponge")
|
||||
@RegisterBlock(id = "sponge")
|
||||
public static BlockSponge sponge;
|
||||
|
||||
@RegisterBlock(name = "bigbutton", tileEntity = TileEntityBigButton.class)
|
||||
@RegisterBlock(id = "bigbutton", tileEntity = TileEntityBigButton.class)
|
||||
public static BlockBigButton bigButton;
|
||||
|
||||
@RegisterBlock(name = "imaginary", tileEntity = TileEntityImaginary.class, itemBlock = ItemImaginary.class)
|
||||
@RegisterBlock(id = "imaginary", tileEntity = TileEntityImaginary.class, itemBlock = ItemImaginary.class)
|
||||
public static BlockImaginary imaginary;
|
||||
|
||||
@RegisterBlock(name = "fan", tileEntity = TileEntityFan.class)
|
||||
@RegisterBlock(id = "fan", tileEntity = TileEntityFan.class)
|
||||
public static BlockFan fan;
|
||||
|
||||
@RegisterBlock(name = "xpbottler", tileEntity = TileEntityXPBottler.class)
|
||||
@RegisterBlock(id = "xpbottler", tileEntity = TileEntityXPBottler.class)
|
||||
public static BlockXPBottler xpBottler;
|
||||
|
||||
@RegisterBlock(name = "village_highlighter", tileEntity = TileEntityVillageHighlighter.class)
|
||||
@RegisterBlock(id = "village_highlighter", tileEntity = TileEntityVillageHighlighter.class)
|
||||
public static BlockVillageHighlighter villageHighlighter;
|
||||
|
||||
@RegisterBlock(name = "path")
|
||||
@RegisterBlock(id = "path")
|
||||
public static BlockPath path;
|
||||
|
||||
@RegisterBlock(name = "autoanvil", tileEntity = TileEntityAutoAnvil.class)
|
||||
@RegisterBlock(id = "autoanvil", tileEntity = TileEntityAutoAnvil.class)
|
||||
public static BlockAutoAnvil autoAnvil;
|
||||
|
||||
@RegisterBlock(name = "autoenchantmenttable", tileEntity = TileEntityAutoEnchantmentTable.class)
|
||||
@RegisterBlock(id = "autoenchantmenttable", tileEntity = TileEntityAutoEnchantmentTable.class)
|
||||
public static BlockAutoEnchantmentTable autoEnchantmentTable;
|
||||
|
||||
@RegisterBlock(name = "xpdrain", tileEntity = TileEntityXPDrain.class)
|
||||
@RegisterBlock(id = "xpdrain", tileEntity = TileEntityXPDrain.class)
|
||||
public static BlockXPDrain xpDrain;
|
||||
|
||||
@RegisterBlock(name = "blockbreaker", tileEntity = TileEntityBlockBreaker.class)
|
||||
@RegisterBlock(id = "blockbreaker", tileEntity = TileEntityBlockBreaker.class)
|
||||
public static BlockBlockBreaker blockBreaker;
|
||||
|
||||
@RegisterBlock(name = "blockPlacer", tileEntity = TileEntityBlockPlacer.class)
|
||||
@RegisterBlock(id = "blockPlacer", tileEntity = TileEntityBlockPlacer.class)
|
||||
public static BlockBlockPlacer blockPlacer;
|
||||
|
||||
@RegisterBlock(name = "itemDropper", tileEntity = TileEntityItemDropper.class)
|
||||
@RegisterBlock(id = "itemDropper", tileEntity = TileEntityItemDropper.class)
|
||||
public static BlockItemDropper itemDropper;
|
||||
|
||||
@RegisterBlock(name = "ropeladder")
|
||||
@RegisterBlock(id = "ropeladder")
|
||||
public static BlockRopeLadder ropeLadder;
|
||||
|
||||
@RegisterBlock(name = "donationStation", tileEntity = TileEntityDonationStation.class)
|
||||
@RegisterBlock(id = "donationStation", tileEntity = TileEntityDonationStation.class)
|
||||
public static BlockDonationStation donationStation;
|
||||
|
||||
@RegisterBlock(name = "paintmixer", tileEntity = TileEntityPaintMixer.class)
|
||||
@RegisterBlock(id = "paintmixer", tileEntity = TileEntityPaintMixer.class)
|
||||
public static BlockPaintMixer paintMixer;
|
||||
|
||||
@RegisterBlock(name = "canvas", tileEntity = TileEntityCanvas.class)
|
||||
@RegisterBlock(id = "canvas", tileEntity = TileEntityCanvas.class)
|
||||
public static BlockCanvas canvas;
|
||||
|
||||
@RegisterBlock(name = "paintcan", tileEntity = TileEntityPaintCan.class, itemBlock = ItemPaintCan.class)
|
||||
@RegisterBlock(id = "paintcan", tileEntity = TileEntityPaintCan.class, itemBlock = ItemPaintCan.class)
|
||||
public static BlockPaintCan paintCan;
|
||||
|
||||
@RegisterBlock(name = "canvasglass", tileEntity = TileEntityCanvas.class)
|
||||
@RegisterBlock(id = "canvasglass", tileEntity = TileEntityCanvas.class)
|
||||
public static BlockCanvasGlass canvasGlass;
|
||||
|
||||
@RegisterBlock(name = "projector", tileEntity = TileEntityProjector.class)
|
||||
@RegisterBlock(id = "projector", tileEntity = TileEntityProjector.class)
|
||||
public static BlockProjector projector;
|
||||
|
||||
@RegisterBlock(name = "drawingtable", tileEntity = TileEntityDrawingTable.class)
|
||||
@RegisterBlock(id = "drawingtable", tileEntity = TileEntityDrawingTable.class)
|
||||
public static BlockDrawingTable drawingTable;
|
||||
|
||||
@RegisterBlock(name = "sky", tileEntity = TileEntitySky.class, itemBlock = ItemSkyBlock.class, unlocalizedName = "sky.normal")
|
||||
@RegisterBlock(id = "sky", tileEntity = TileEntitySky.class, itemBlock = ItemSkyBlock.class, unlocalizedName = "sky.normal")
|
||||
public static BlockSky sky;
|
||||
|
||||
@RegisterBlock(name = "xpshower", tileEntity = TileEntityXPShower.class)
|
||||
@RegisterBlock(id = "xpshower", tileEntity = TileEntityXPShower.class)
|
||||
public static BlockXPShower xpShower;
|
||||
|
||||
@RegisterBlock(name = "goldenegg", tileEntity = TileEntityGoldenEgg.class)
|
||||
@RegisterBlock(id = "goldenegg", tileEntity = TileEntityGoldenEgg.class)
|
||||
public static BlockGoldenEgg goldenEgg;
|
||||
|
||||
@RegisterBlock(name = "scaffolding")
|
||||
@RegisterBlock(id = "scaffolding")
|
||||
public static BlockScaffolding scaffolding;
|
||||
}
|
||||
|
||||
public static class Items implements ItemInstances {
|
||||
|
||||
@RegisterItem(name = "hangglider")
|
||||
@RegisterItem(id = "hangglider")
|
||||
public static ItemHangGlider hangGlider;
|
||||
|
||||
@RegisterItem(name = "generic", isConfigurable = false, registerDefaultModel = false)
|
||||
@RegisterItem(id = "generic", isConfigurable = false, registerDefaultModel = false)
|
||||
public static ItemOBGeneric generic;
|
||||
|
||||
@RegisterItem(name = "luggage")
|
||||
@RegisterItem(id = "luggage")
|
||||
public static ItemLuggage luggage;
|
||||
|
||||
@RegisterItem(name = "sonicglasses")
|
||||
@RegisterItem(id = "sonicglasses")
|
||||
public static ItemSonicGlasses sonicGlasses;
|
||||
|
||||
@RegisterItem(name = "pencilGlasses", unlocalizedName = "glasses.pencil")
|
||||
@RegisterItem(id = "pencilGlasses", unlocalizedName = "glasses.pencil")
|
||||
public static ItemImaginationGlasses pencilGlasses;
|
||||
|
||||
@RegisterItem(name = "crayonGlasses", unlocalizedName = "glasses.crayon")
|
||||
@RegisterItem(id = "crayonGlasses", unlocalizedName = "glasses.crayon")
|
||||
public static ItemCrayonGlasses crayonGlasses;
|
||||
|
||||
@RegisterItem(name = "technicolorGlasses", unlocalizedName = "glasses.technicolor")
|
||||
@RegisterItem(id = "technicolorGlasses", unlocalizedName = "glasses.technicolor")
|
||||
public static ItemImaginationGlasses technicolorGlasses;
|
||||
|
||||
@RegisterItem(name = "seriousGlasses", unlocalizedName = "glasses.admin")
|
||||
@RegisterItem(id = "seriousGlasses", unlocalizedName = "glasses.admin")
|
||||
public static ItemImaginationGlasses seriousGlasses;
|
||||
|
||||
@RegisterItem(name = "craneControl", unlocalizedName = "crane_control")
|
||||
@RegisterItem(id = "craneControl", unlocalizedName = "crane_control")
|
||||
public static ItemCraneControl craneControl;
|
||||
|
||||
@RegisterItem(name = "craneBackpack", unlocalizedName = "crane_backpack")
|
||||
@RegisterItem(id = "craneBackpack", unlocalizedName = "crane_backpack")
|
||||
public static ItemCraneBackpack craneBackpack;
|
||||
|
||||
@RegisterItem(name = "slimalyzer")
|
||||
@RegisterItem(id = "slimalyzer")
|
||||
public static ItemSlimalyzer slimalyzer;
|
||||
|
||||
@RegisterItem(name = "filledbucket", registerDefaultModel = false)
|
||||
@RegisterItem(id = "filledbucket", registerDefaultModel = false)
|
||||
public static ItemFilledBucket filledBucket;
|
||||
|
||||
@RegisterItem(name = "sleepingBag", unlocalizedName = "sleepingbag")
|
||||
@RegisterItem(id = "sleepingBag", unlocalizedName = "sleepingbag")
|
||||
public static ItemSleepingBag sleepingBag;
|
||||
|
||||
@RegisterItem(name = "paintBrush", unlocalizedName = "paintbrush")
|
||||
@RegisterItem(id = "paintBrush", unlocalizedName = "paintbrush")
|
||||
public static ItemPaintBrush paintBrush;
|
||||
|
||||
@RegisterItem(name = "stencil", registerDefaultModel = false)
|
||||
@RegisterItem(id = "stencil", registerDefaultModel = false)
|
||||
public static ItemOBGeneric stencil;
|
||||
|
||||
@RegisterItem(name = "squeegee")
|
||||
@RegisterItem(id = "squeegee")
|
||||
public static ItemSqueegee squeegee;
|
||||
|
||||
@RegisterItem(name = "heightMap", unlocalizedName = "height_map")
|
||||
@RegisterItem(id = "heightMap", unlocalizedName = "height_map")
|
||||
public static ItemHeightMap heightMap;
|
||||
|
||||
@RegisterItem(name = "emptyMap", unlocalizedName = "empty_map")
|
||||
@RegisterItem(id = "emptyMap", unlocalizedName = "empty_map")
|
||||
public static ItemEmptyMap emptyMap;
|
||||
|
||||
@RegisterItem(name = "cartographer")
|
||||
@RegisterItem(id = "cartographer")
|
||||
public static ItemCartographer cartographer;
|
||||
|
||||
@RegisterItem(name = "tastyClay", unlocalizedName = "tasty_clay")
|
||||
@RegisterItem(id = "tastyClay", unlocalizedName = "tasty_clay")
|
||||
public static ItemTastyClay tastyClay;
|
||||
|
||||
@RegisterItem(name = "goldenEye", unlocalizedName = "golden_eye")
|
||||
@RegisterItem(id = "goldenEye", unlocalizedName = "golden_eye")
|
||||
public static ItemGoldenEye goldenEye;
|
||||
|
||||
@RegisterItem(name = "genericUnstackable", isConfigurable = false, registerDefaultModel = false)
|
||||
@RegisterItem(id = "genericUnstackable", isConfigurable = false, registerDefaultModel = false)
|
||||
public static ItemOBGenericUnstackable genericUnstackable;
|
||||
|
||||
@RegisterItem(name = "cursor")
|
||||
@RegisterItem(id = "cursor")
|
||||
public static ItemCursor cursor;
|
||||
|
||||
@RegisterItem(name = "infoBook", unlocalizedName = "info_book")
|
||||
@RegisterItem(id = "infoBook", unlocalizedName = "info_book")
|
||||
public static ItemInfoBook infoBook;
|
||||
|
||||
@RegisterItem(name = "devnull")
|
||||
@RegisterItem(id = "devnull")
|
||||
public static ItemDevNull devNull;
|
||||
|
||||
@RegisterItem(name = "spongeonastick")
|
||||
@RegisterItem(id = "spongeonastick")
|
||||
public static ItemSpongeOnAStick spongeonastick;
|
||||
|
||||
@RegisterItem(name = "pedometer")
|
||||
@RegisterItem(id = "pedometer")
|
||||
public static ItemPedometer pedometer;
|
||||
|
||||
@RegisterItem(name = "epicEraser", unlocalizedName = "epic_eraser")
|
||||
@RegisterItem(id = "epicEraser", unlocalizedName = "epic_eraser")
|
||||
public static ItemEpicEraser epicEraser;
|
||||
|
||||
@RegisterItem(name = "wrench")
|
||||
@RegisterItem(id = "wrench")
|
||||
public static ItemWrench wrench;
|
||||
}
|
||||
|
||||
|
@ -311,23 +468,118 @@ public class OpenBlocks {
|
|||
public static final Fluid xpJuice = new Fluid("xpjuice", location("xpjuicestill"), location("xpjuiceflowing")).setLuminosity(10).setDensity(800).setViscosity(1500).setUnlocalizedName("OpenBlocks.xpjuice");
|
||||
}
|
||||
|
||||
@ObjectHolder(MODID)
|
||||
public static class Sounds {
|
||||
// TODO subtitles where sensible
|
||||
// TODO remove categories from sounds.json
|
||||
@ObjectHolder("elevator.activate")
|
||||
public static final SoundEvent BLOCK_ELEVATOR_ACTIVATE = null;
|
||||
|
||||
@ObjectHolder("grave.rob")
|
||||
public static final SoundEvent BLOCK_GRAVE_ROB = null;
|
||||
|
||||
@ObjectHolder("beartrap.open")
|
||||
public static final SoundEvent BLOCK_BEARTRAP_OPEN = null;
|
||||
|
||||
@ObjectHolder("beartrap.close")
|
||||
public static final SoundEvent BLOCK_BEARTRAP_CLOSE = null;
|
||||
|
||||
@ObjectHolder("cannon.activate")
|
||||
public static final SoundEvent BLOCK_CANNON_ACTIVATE = null;
|
||||
|
||||
@ObjectHolder("target.open")
|
||||
public static final SoundEvent BLOCK_TARGET_OPEN = null;
|
||||
|
||||
@ObjectHolder("target.close")
|
||||
public static final SoundEvent BLOCK_TARGET_CLOSE = null;
|
||||
|
||||
@ObjectHolder("bottler.signal")
|
||||
public static final SoundEvent BLOCK_XPBOTTLER_DONE = null;
|
||||
|
||||
@ObjectHolder("crayon.place")
|
||||
public static final SoundEvent ITEM_CRAYON_PLACE = null;
|
||||
|
||||
@ObjectHolder("luggage.walk")
|
||||
public static final SoundEvent ENTITY_LUGGAGE_WALK = null;
|
||||
|
||||
@ObjectHolder("luggage.eat.food")
|
||||
public static final SoundEvent ENTITY_LUGGAGE_EAT_FOOD = null;
|
||||
|
||||
@ObjectHolder("luggage.eat.item")
|
||||
public static final SoundEvent ENTITY_LUGGAGE_EAT_ITEM = null;
|
||||
|
||||
@ObjectHolder("pedometer.use")
|
||||
public static final SoundEvent ITEM_PEDOMETER_USE = null;
|
||||
|
||||
@ObjectHolder("slimalyzer.signal")
|
||||
public static final SoundEvent ITEM_SLIMALYZER_PING = null;
|
||||
|
||||
@ObjectHolder("squeegee.use")
|
||||
public static final SoundEvent ITEM_SQUEEGEE_ACTION = null;
|
||||
|
||||
@ObjectHolder("best.feature.ever.fart")
|
||||
public static final SoundEvent PLAYER_WHOOPS = null;
|
||||
|
||||
@ObjectHolder("annoying.mosquito")
|
||||
public static final SoundEvent MISC_MOSQUITO = null;
|
||||
|
||||
@ObjectHolder("annoying.alarmclock")
|
||||
public static final SoundEvent MISC_ALARM_CLOCK = null;
|
||||
|
||||
@ObjectHolder("annoying.vibrate")
|
||||
public static final SoundEvent MISC_VIBRATE = null;
|
||||
|
||||
public static void registerSounds() {
|
||||
registerSound("elevator.activate");
|
||||
registerSound("grave.rob");
|
||||
registerSound("crayon.place");
|
||||
registerSound("luggage.walk");
|
||||
registerSound("luggage.eat.food");
|
||||
registerSound("luggage.eat.item");
|
||||
registerSound("pedometer.use");
|
||||
registerSound("slimalyzer.signal");
|
||||
registerSound("squeegee.use");
|
||||
registerSound("best.feature.ever.fart");
|
||||
registerSound("annoying.mosquito");
|
||||
registerSound("annoying.alarmclock");
|
||||
registerSound("annoying.vibrate");
|
||||
registerSound("beartrap.open");
|
||||
registerSound("beartrap.close");
|
||||
registerSound("cannon.activate");
|
||||
registerSound("target.open");
|
||||
registerSound("target.close");
|
||||
registerSound("bottler.signal");
|
||||
}
|
||||
|
||||
private static void registerSound(String id) {
|
||||
final ResourceLocation resourceLocation = location(id);
|
||||
GameRegistry.register(new SoundEvent(resourceLocation).setRegistryName(resourceLocation));
|
||||
}
|
||||
}
|
||||
|
||||
@ObjectHolder(MODID)
|
||||
public static class Enchantments {
|
||||
public static Enchantment explosive;
|
||||
public static Enchantment lastStand;
|
||||
public static Enchantment flimFlam;
|
||||
@ObjectHolder("explosive")
|
||||
public static final Enchantment explosive = null;
|
||||
|
||||
@ObjectHolder("last_stand")
|
||||
public static final Enchantment lastStand = null;
|
||||
|
||||
@ObjectHolder("flim_flam")
|
||||
public static final Enchantment flimFlam = null;
|
||||
}
|
||||
|
||||
public static CreativeTabs tabOpenBlocks = new CreativeTabs("tabOpenBlocks") {
|
||||
@Override
|
||||
public Item getTabIconItem() {
|
||||
Block block = Objects.firstNonNull(OpenBlocks.Blocks.flag, net.minecraft.init.Blocks.sponge);
|
||||
Block block = Objects.firstNonNull(OpenBlocks.Blocks.flag, net.minecraft.init.Blocks.SPONGE);
|
||||
return Item.getItemFromBlock(block);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void displayAllReleventItems(List<ItemStack> result) {
|
||||
super.displayAllReleventItems(result);
|
||||
public void displayAllRelevantItems(List<ItemStack> result) {
|
||||
super.displayAllRelevantItems(result);
|
||||
if (Enchantments.explosive != null) EnchantmentUtils.addAllBooks(Enchantments.explosive, result);
|
||||
if (Enchantments.lastStand != null) EnchantmentUtils.addAllBooks(Enchantments.lastStand, result);
|
||||
if (Enchantments.flimFlam != null) EnchantmentUtils.addAllBooks(Enchantments.flimFlam, result);
|
||||
|
@ -335,12 +587,12 @@ public class OpenBlocks {
|
|||
|
||||
};
|
||||
|
||||
public static final Achievement brickAchievement = new Achievement("openblocks.oops", "openblocks.droppedBrick", 13, 13, net.minecraft.init.Items.brick, null).registerStat();
|
||||
public static final Achievement brickAchievement = new Achievement("openblocks.oops", "openblocks.droppedBrick", 13, 13, net.minecraft.init.Items.BRICK, null).registerStat();
|
||||
|
||||
public static final Achievement stackAchievement = new Achievement("openblocks.tma2", "openblocks.stackOverflow", -13, 13, net.minecraft.init.Items.nether_star, null).registerStat();
|
||||
public static final Achievement stackAchievement = new Achievement("openblocks.tma2", "openblocks.stackOverflow", -13, 13, net.minecraft.init.Items.NETHER_STAR, null).registerStat();
|
||||
|
||||
public static final StatBase brickStat = new StatBasic("openblocks.dropped",
|
||||
new ChatComponentTranslation("stat.openblocks.bricksDropped"),
|
||||
new TextComponentTranslation("stat.openblocks.bricksDropped"),
|
||||
StatBase.simpleStatType).registerStat();
|
||||
|
||||
private final ModStartupHelper startupHelper = new ModStartupHelper("openblocks") {
|
||||
|
@ -351,7 +603,7 @@ public class OpenBlocks {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfigPre(GameConfigProvider gameConfig) {
|
||||
protected void setupConfigPre(GameRegistryObjectsProvider gameConfig) {
|
||||
gameConfig.setCreativeTab(tabOpenBlocks);
|
||||
}
|
||||
|
||||
|
@ -415,6 +667,8 @@ public class OpenBlocks {
|
|||
|
||||
Config.register();
|
||||
|
||||
Sounds.registerSounds();
|
||||
|
||||
apiSetup.setupApis();
|
||||
apiSetup.installHolderAccess(evt.getAsmData());
|
||||
|
||||
|
@ -423,7 +677,8 @@ public class OpenBlocks {
|
|||
MinecraftForge.EVENT_BUS.register(new PlayerDeathHandler());
|
||||
|
||||
if (OpenBlocks.Items.cursor != null) {
|
||||
MinecraftForge.EVENT_BUS.register(new GuiOpenHandler());
|
||||
// TODO maybe figure way to validate GUIs over distance?
|
||||
// was: GuiOpenHandler: handler for PlayerOpenContainerEvent
|
||||
}
|
||||
|
||||
EntityRegistry.registerModEntity(EntityLuggage.class, "Luggage", ENTITY_LUGGAGE_ID, OpenBlocks.instance, 64, 1, true);
|
||||
|
@ -445,6 +700,7 @@ public class OpenBlocks {
|
|||
Integration.addModule(new ModuleTurtles());
|
||||
|
||||
if (!Config.soSerious) {
|
||||
BrickManager.registerCapability();
|
||||
MinecraftForge.EVENT_BUS.register(new BrickManager());
|
||||
}
|
||||
|
||||
|
@ -457,7 +713,8 @@ public class OpenBlocks {
|
|||
}
|
||||
|
||||
{
|
||||
String luggageName = EntityList.classToStringMapping.get(EntityLuggage.class);
|
||||
String luggageName = EntityList.getEntityStringFromClass(EntityLuggage.class);
|
||||
// TODO 1.10 verify if it still works
|
||||
FMLInterModComms.sendMessage(Mods.MFR, "registerAutoSpawnerBlacklist", luggageName);
|
||||
}
|
||||
|
||||
|
@ -473,6 +730,10 @@ public class OpenBlocks {
|
|||
BucketFillHandler.instance.addToWhitelist(TileEntityTank.class);
|
||||
}
|
||||
|
||||
if (Items.pedometer != null) {
|
||||
PedometerHandler.registerCapability();
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(PlayerInventoryStore.instance);
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new EntityEventHandler());
|
||||
|
@ -482,14 +743,14 @@ public class OpenBlocks {
|
|||
proxy.preInit();
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "deprecation", "unused" })
|
||||
@SuppressWarnings({ "unused" })
|
||||
protected void registerUselessVillager() {
|
||||
VillagerRegistry.instance().registerVillagerId(Config.radioVillagerId);
|
||||
final VillagerProfession prof = new VillagerProfession(
|
||||
"openblocks:radio",
|
||||
"openblocks:textures/models/king-ish.png");
|
||||
VillagerRegistry.instance().register(prof);
|
||||
new VillagerCareer(prof, "basic"); // TODO?
|
||||
final VillagerProfession prof = GameRegistry.register(new VillagerProfession(
|
||||
"radio",
|
||||
"openblocks:textures/models/king-ish.png",
|
||||
"openblocks:textures/models/king-ish.png")); // TODO: zombie texture?
|
||||
|
||||
new VillagerCareer(prof, "basic"); // TODO re-add trades
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -556,7 +817,7 @@ public class OpenBlocks {
|
|||
}
|
||||
|
||||
private static void registerOreDictionary() {
|
||||
OreDictionary.registerOre("craftingTableWood", new ItemStack(net.minecraft.init.Blocks.crafting_table));
|
||||
OreDictionary.registerOre("chestWood", new ItemStack(net.minecraft.init.Blocks.chest));
|
||||
OreDictionary.registerOre("craftingTableWood", new ItemStack(net.minecraft.init.Blocks.CRAFTING_TABLE));
|
||||
OreDictionary.registerOre("chestWood", new ItemStack(net.minecraft.init.Blocks.CHEST));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package openblocks;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.launchwrapper.Launch;
|
||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
|
||||
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin.SortingIndex;
|
||||
|
|
|
@ -21,8 +21,8 @@ public class OpenBlocksGuiHandler implements IGuiHandler {
|
|||
public static final GuiId[] VALUES = GuiId.values();
|
||||
}
|
||||
|
||||
private static ContainerDevNull createDevNullContainer(EntityPlayer player) {
|
||||
return new ContainerDevNull(player.inventory, new ItemDevNull.DevNullInventory(player));
|
||||
private static ContainerDevNull createDevNullContainer(EntityPlayer player, int protectedSlot) {
|
||||
return new ContainerDevNull(player.inventory, new ItemDevNull.DevNullInventory(player, protectedSlot), protectedSlot);
|
||||
}
|
||||
|
||||
private static ContainerLuggage createLuggageContainer(EntityPlayer player, World world, int entityId) {
|
||||
|
@ -43,7 +43,7 @@ public class OpenBlocksGuiHandler implements IGuiHandler {
|
|||
return createLuggageContainer(player, world, x);
|
||||
case devNull:
|
||||
if (player.inventory.getCurrentItem() == null) return null;
|
||||
return createDevNullContainer(player);
|
||||
return createDevNullContainer(player, x);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ public class OpenBlocksGuiHandler implements IGuiHandler {
|
|||
return container != null? new GuiLuggage(container) : null;
|
||||
}
|
||||
case devNull:
|
||||
return new GuiDevNull(createDevNullContainer(player));
|
||||
return new GuiDevNull(createDevNullContainer(player, x));
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package openblocks.api;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Static variables marked with this annotation will be filled with instance
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package openblocks.api;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
@Cancelable
|
||||
public class GraveDropsEvent extends Event {
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package openblocks.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
|
||||
|
@ -14,13 +13,13 @@ public class GraveSpawnEvent extends PlayerEvent {
|
|||
|
||||
public List<EntityItem> loot;
|
||||
|
||||
public IChatComponent clickText;
|
||||
public ITextComponent clickText;
|
||||
|
||||
public String gravestoneText;
|
||||
|
||||
public BlockPos location;
|
||||
|
||||
public GraveSpawnEvent(EntityPlayer player, BlockPos pos, List<EntityItem> loot, String gravestoneText, IChatComponent clickText) {
|
||||
public GraveSpawnEvent(EntityPlayer player, BlockPos pos, List<EntityItem> loot, String gravestoneText, ITextComponent clickText) {
|
||||
super(player);
|
||||
this.loot = loot;
|
||||
this.gravestoneText = gravestoneText;
|
||||
|
|
|
@ -2,7 +2,7 @@ package openblocks.api;
|
|||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IElevatorBlock {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.api;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public interface IPaintableBlock {
|
||||
|
|
|
@ -2,7 +2,7 @@ package openblocks.api;
|
|||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public interface IPointable {
|
||||
void onPointingStart(ItemStack itemStack, EntityPlayer player);
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package openblocks.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
|
||||
public class InventoryEvent extends PlayerEvent {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
||||
|
@ -11,24 +11,25 @@ import net.minecraftforge.fml.common.eventhandler.Event.HasResult;
|
|||
* Use {@link Event#setResult(Result)} to override: {@link Event.Result.ALLOW} to allow even if original algorithm forbids it, {@link Event.Result.DENY} to block normally allowed action.
|
||||
*/
|
||||
@HasResult
|
||||
@Deprecated // TODO switch to forge
|
||||
public class SleepingBagUseEvent extends PlayerEvent {
|
||||
|
||||
/**
|
||||
* Text displayed to player if action was denied
|
||||
*/
|
||||
public IChatComponent playerChat;
|
||||
public ITextComponent playerChat;
|
||||
|
||||
/**
|
||||
* Status determined by original algorithm
|
||||
*/
|
||||
public final EntityPlayer.EnumStatus status;
|
||||
public final EntityPlayer.SleepResult status;
|
||||
|
||||
public SleepingBagUseEvent(EntityPlayer player, EntityPlayer.EnumStatus cause) {
|
||||
public SleepingBagUseEvent(EntityPlayer player, EntityPlayer.SleepResult cause) {
|
||||
super(player);
|
||||
this.status = cause;
|
||||
}
|
||||
|
||||
public boolean defaultCanSleep() {
|
||||
return status == EntityPlayer.EnumStatus.OK;
|
||||
return status == EntityPlayer.SleepResult.OK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,3 @@
|
|||
package openblocks.api;
|
||||
|
||||
import net.minecraftforge.fml.common.API;
|
||||
|
||||
|
|
|
@ -2,8 +2,10 @@ package openblocks.asm;
|
|||
|
||||
import openmods.Log;
|
||||
import openmods.asm.MethodMatcher;
|
||||
|
||||
import org.objectweb.asm.*;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
|
||||
public class EntityPlayerVisitor extends ClassVisitor {
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.launchwrapper.IClassTransformer;
|
|||
import openmods.Log;
|
||||
import openmods.asm.VisitorHelper;
|
||||
import openmods.asm.VisitorHelper.TransformProvider;
|
||||
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package openblocks.client;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.IResource;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import openmods.Log;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
public class ChangelogBuilder {
|
||||
|
||||
private static final ResourceLocation CHANGELOG = new ResourceLocation("openblocks", "changelog.json");
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package openblocks.client;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderSnowball;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.ForgeHooksClient;
|
||||
import net.minecraftforge.client.model.ModelLoader;
|
||||
|
@ -24,12 +25,64 @@ import openblocks.IOpenBlocksProxy;
|
|||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.bindings.KeyInputHandler;
|
||||
import openblocks.client.fx.FXLiquidSpray;
|
||||
import openblocks.client.model.*;
|
||||
import openblocks.client.renderer.entity.*;
|
||||
import openblocks.client.renderer.tileentity.*;
|
||||
import openblocks.client.model.ModelAutoAnvil;
|
||||
import openblocks.client.model.ModelBearTrap;
|
||||
import openblocks.client.model.ModelCraneBackpack;
|
||||
import openblocks.client.model.ModelPiggy;
|
||||
import openblocks.client.model.ModelSprinkler;
|
||||
import openblocks.client.model.ModelTarget;
|
||||
import openblocks.client.model.ModelVacuumHopper;
|
||||
import openblocks.client.model.ModelXPShower;
|
||||
import openblocks.client.renderer.entity.EntityCartographerRenderer;
|
||||
import openblocks.client.renderer.entity.EntityHangGliderRenderer;
|
||||
import openblocks.client.renderer.entity.EntityLuggageRenderer;
|
||||
import openblocks.client.renderer.entity.EntityMagnetRenderer;
|
||||
import openblocks.client.renderer.entity.EntityMiniMeRenderer;
|
||||
import openblocks.client.renderer.entity.EntitySelectionHandler;
|
||||
import openblocks.client.renderer.tileentity.TileEntityAutoEnchantmentTableRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityCannonRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityFanRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityFlagRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityGoldenEggRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityGraveRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityImaginaryRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityPaintMixerRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityProjectorRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntitySkyRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityTankRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityTrophyRenderer;
|
||||
import openblocks.client.renderer.tileentity.TileEntityVillageHighlighterRenderer;
|
||||
import openblocks.client.renderer.tileentity.guide.TileEntityBuilderGuideRenderer;
|
||||
import openblocks.client.renderer.tileentity.guide.TileEntityGuideRenderer;
|
||||
import openblocks.common.TrophyHandler.Trophy;
|
||||
import openblocks.common.entity.*;
|
||||
import openblocks.common.tileentity.*;
|
||||
import openblocks.common.entity.EntityCartographer;
|
||||
import openblocks.common.entity.EntityGoldenEye;
|
||||
import openblocks.common.entity.EntityHangGlider;
|
||||
import openblocks.common.entity.EntityLuggage;
|
||||
import openblocks.common.entity.EntityMagnet;
|
||||
import openblocks.common.entity.EntityMiniMe;
|
||||
import openblocks.common.tileentity.TileEntityAutoAnvil;
|
||||
import openblocks.common.tileentity.TileEntityAutoEnchantmentTable;
|
||||
import openblocks.common.tileentity.TileEntityBearTrap;
|
||||
import openblocks.common.tileentity.TileEntityBuilderGuide;
|
||||
import openblocks.common.tileentity.TileEntityCannon;
|
||||
import openblocks.common.tileentity.TileEntityDonationStation;
|
||||
import openblocks.common.tileentity.TileEntityFan;
|
||||
import openblocks.common.tileentity.TileEntityFlag;
|
||||
import openblocks.common.tileentity.TileEntityGoldenEgg;
|
||||
import openblocks.common.tileentity.TileEntityGrave;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import openblocks.common.tileentity.TileEntityImaginary;
|
||||
import openblocks.common.tileentity.TileEntityPaintMixer;
|
||||
import openblocks.common.tileentity.TileEntityProjector;
|
||||
import openblocks.common.tileentity.TileEntitySky;
|
||||
import openblocks.common.tileentity.TileEntitySprinkler;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
import openblocks.common.tileentity.TileEntityTarget;
|
||||
import openblocks.common.tileentity.TileEntityTrophy;
|
||||
import openblocks.common.tileentity.TileEntityVacuumHopper;
|
||||
import openblocks.common.tileentity.TileEntityVillageHighlighter;
|
||||
import openblocks.common.tileentity.TileEntityXPShower;
|
||||
import openblocks.enchantments.flimflams.LoreFlimFlam;
|
||||
import openmods.config.game.RegisterBlock;
|
||||
import openmods.entity.EntityBlock;
|
||||
|
@ -37,8 +90,6 @@ import openmods.entity.renderer.EntityBlockRenderer;
|
|||
import openmods.renderer.SimpleModelTileEntityRenderer;
|
||||
import openmods.utils.render.MarkerClassGenerator;
|
||||
|
||||
import com.google.common.base.Throwables;
|
||||
|
||||
public class ClientProxy implements IOpenBlocksProxy {
|
||||
|
||||
public ClientProxy() {}
|
||||
|
@ -47,7 +98,7 @@ public class ClientProxy implements IOpenBlocksProxy {
|
|||
public void preInit() {
|
||||
new KeyInputHandler().setup();
|
||||
|
||||
if (Config.flimFlamEnchantmentId > 0) {
|
||||
if (Config.flimFlamEnchantmentEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new LoreFlimFlam.DisplayHandler());
|
||||
}
|
||||
|
||||
|
@ -195,12 +246,13 @@ public class ClientProxy implements IOpenBlocksProxy {
|
|||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static void tempHackRegisterTesrItemRenderers() {
|
||||
// TODO kill it with fire!
|
||||
for (Field f : OpenBlocks.Blocks.class.getFields()) {
|
||||
RegisterBlock ann = f.getAnnotation(RegisterBlock.class);
|
||||
if (ann.tileEntity() != null) {
|
||||
try {
|
||||
Block block = (Block)f.get(null);
|
||||
if (block.getRenderType() == 2) {
|
||||
if (block.getDefaultState().getRenderType() == EnumBlockRenderType.ENTITYBLOCK_ANIMATED) {
|
||||
Item item = Item.getItemFromBlock(block);
|
||||
ForgeHooksClient.registerTESRItemStack(item, 0, ann.tileEntity());
|
||||
}
|
||||
|
@ -211,12 +263,17 @@ public class ClientProxy implements IOpenBlocksProxy {
|
|||
}
|
||||
}
|
||||
|
||||
private static void spawnParticle(EntityFX spray) {
|
||||
@Override
|
||||
public int getParticleSettings() {
|
||||
return Minecraft.getMinecraft().gameSettings.particleSetting;
|
||||
}
|
||||
|
||||
private static void spawnParticle(Particle spray) {
|
||||
Minecraft.getMinecraft().effectRenderer.addEffect(spray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnLiquidSpray(World worldObj, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3 velocity) {
|
||||
public void spawnLiquidSpray(World worldObj, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3d velocity) {
|
||||
spawnParticle(new FXLiquidSpray(worldObj, fluid, x, y, z, scale, gravity, velocity));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.client.entity.AbstractClientPlayer;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import openblocks.common.entity.EntityHangGlider;
|
||||
import openmods.renderer.PlayerBodyRenderEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GliderPlayerRenderHandler {
|
||||
|
@ -12,7 +11,7 @@ public class GliderPlayerRenderHandler {
|
|||
@SubscribeEvent
|
||||
public void onPlayerBodyRender(PlayerBodyRenderEvent evt) {
|
||||
final AbstractClientPlayer player = evt.player;
|
||||
if (!EntityHangGlider.isGliderDeployed(player)) {
|
||||
if (EntityHangGlider.isGliderDeployed(player)) {
|
||||
player.limbSwing = 0f;
|
||||
player.prevLimbSwingAmount = 0f;
|
||||
player.limbSwingAmount = 0f;
|
||||
|
|
|
@ -1,22 +1,20 @@
|
|||
package openblocks.client;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import openmods.colors.RGB;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
public class Icons {
|
||||
|
||||
private static void addVertexWithUV(WorldRenderer wr, double x, double y, double u, double v) {
|
||||
private static void addVertexWithUV(VertexBuffer wr, double x, double y, double u, double v) {
|
||||
wr.pos(x, y, 0).tex(u, v).endVertex();
|
||||
}
|
||||
|
||||
|
@ -49,7 +47,7 @@ public class Icons {
|
|||
Preconditions.checkNotNull(icon);
|
||||
GlStateManager.color(r, g, b, MathHelper.floor_double(255 * alpha));
|
||||
final Tessellator tes = Tessellator.getInstance();
|
||||
final WorldRenderer wr = tes.getWorldRenderer();
|
||||
final VertexBuffer wr = tes.getBuffer();
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
addVertexWithUV(wr, scale, scale, icon.getMinU(), icon.getMinV());
|
||||
addVertexWithUV(wr, scale, -scale, icon.getMinU(), icon.getMaxV());
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
package openblocks.client;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraftforge.fml.client.IModGuiFactory;
|
||||
import openblocks.OpenBlocks;
|
||||
import openmods.config.gui.OpenModsConfigScreen;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
public class ModGuiFactory implements IModGuiFactory {
|
||||
|
||||
public static class ConfigScreen extends OpenModsConfigScreen {
|
||||
|
@ -32,6 +30,7 @@ public class ModGuiFactory implements IModGuiFactory {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@ public class SleepingBagRenderHandler {
|
|||
|
||||
@SubscribeEvent
|
||||
public void onPrePlayerRender(RenderPlayerEvent.Pre event) {
|
||||
final EntityPlayer entityPlayer = event.entityPlayer;
|
||||
final EntityPlayer entityPlayer = event.getEntityPlayer();
|
||||
if (entityPlayer instanceof EntityOtherPlayerMP) {
|
||||
if (entityPlayer.isPlayerSleeping() && ItemSleepingBag.isWearingSleepingBag(entityPlayer)) {
|
||||
event.entityPlayer.renderOffsetY = 1.7f;
|
||||
entityPlayer.renderOffsetY = 1.7f;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package openblocks.client;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
|
@ -11,11 +11,12 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
|||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.client.event.sound.PlaySoundEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import openblocks.Config;
|
||||
import openblocks.client.Icons.IDrawableIcon;
|
||||
|
@ -24,11 +25,8 @@ import openmods.config.properties.ConfigurationChange;
|
|||
import openmods.renderer.ManualDisplayList;
|
||||
import openmods.renderer.ManualDisplayList.Renderer;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class SoundEventsManager {
|
||||
|
||||
private SoundEventsManager() {}
|
||||
|
@ -94,10 +92,10 @@ public class SoundEventsManager {
|
|||
return isEntityWearingGlasses(e);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||
public void onSoundEvent(PlaySoundEvent evt) {
|
||||
if (SoundEventsManager.isPlayerWearingGlasses()) {
|
||||
final ISound sound = evt.sound;
|
||||
final ISound sound = evt.getResultSound();
|
||||
final IDrawableIcon icon = icons.getIcon(sound.getSoundLocation());
|
||||
|
||||
synchronized (events) {
|
||||
|
@ -217,9 +215,10 @@ public class SoundEventsManager {
|
|||
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
||||
dimWorld(tex, mc);
|
||||
|
||||
final double interpX = rve.prevPosX + (rve.posX - rve.prevPosX) * evt.partialTicks;
|
||||
final double interpY = rve.prevPosY + (rve.posY - rve.prevPosY) * evt.partialTicks;
|
||||
final double interpZ = rve.prevPosZ + (rve.posZ - rve.prevPosZ) * evt.partialTicks;
|
||||
final float partialTicks = evt.getPartialTicks();
|
||||
final double interpX = rve.prevPosX + (rve.posX - rve.prevPosX) * partialTicks;
|
||||
final double interpY = rve.prevPosY + (rve.posY - rve.prevPosY) * partialTicks;
|
||||
final double interpZ = rve.prevPosZ + (rve.posZ - rve.prevPosZ) * partialTicks;
|
||||
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.enableBlend();
|
||||
|
@ -233,7 +232,7 @@ public class SoundEventsManager {
|
|||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(px, py, pz);
|
||||
RenderUtils.setupBillboard(rve);
|
||||
snd.icon.draw(snd.getAlpha(evt.partialTicks), snd.size);
|
||||
snd.icon.draw(snd.getAlpha(partialTicks), snd.size);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,10 +2,12 @@ package openblocks.client;
|
|||
|
||||
import static openblocks.client.Icons.createIcon;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.EntityList.EntityEggInfo;
|
||||
|
@ -17,10 +19,6 @@ import openblocks.client.Icons.ComposedIcon;
|
|||
import openblocks.client.Icons.IDrawableIcon;
|
||||
import openmods.Log;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class SoundIconRegistry {
|
||||
|
||||
private static ResourceLocation ob(String id) {
|
||||
|
@ -160,7 +158,7 @@ public class SoundIconRegistry {
|
|||
}
|
||||
|
||||
public void addMob(String soundId, int mobId, boolean isHostile) {
|
||||
EntityEggInfo mobInfo = EntityList.entityEggs.get(mobId);
|
||||
EntityEggInfo mobInfo = EntityList.ENTITY_EGGS.get(mobId);
|
||||
|
||||
if (mobInfo != null) mobs.put(soundId, createMobIcons(isHostile? "mob_hostile" : "mob_friendly", mobInfo.primaryColor, mobInfo.secondaryColor));
|
||||
else mobs.put(soundId, unknownMob);
|
||||
|
@ -201,12 +199,13 @@ public class SoundIconRegistry {
|
|||
|
||||
@SubscribeEvent
|
||||
public void registerIcons(TextureStitchEvent evt) {
|
||||
genericIcon.registerIcons(evt.map);
|
||||
unknownIcon.registerIcons(evt.map);
|
||||
defaultRoot.registerIcons(evt.map);
|
||||
final TextureMap map = evt.getMap();
|
||||
genericIcon.registerIcons(map);
|
||||
unknownIcon.registerIcons(map);
|
||||
defaultRoot.registerIcons(map);
|
||||
|
||||
for (MappedCategory category : roots.values())
|
||||
category.registerIcons(evt.map);
|
||||
category.registerIcons(map);
|
||||
}
|
||||
|
||||
private IDrawableIcon findIcon(ResourceLocation sound) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package openblocks.client;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
@ -9,7 +8,6 @@ import net.minecraft.client.renderer.RenderGlobal;
|
|||
import net.minecraftforge.fml.relauncher.ReflectionHelper;
|
||||
import openmods.Log;
|
||||
import openmods.renderer.StencilRendererHandler;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
|
|
@ -7,21 +7,37 @@ import net.minecraftforge.fml.client.registry.ClientRegistry;
|
|||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.gameevent.InputEvent;
|
||||
import openblocks.Config;
|
||||
import openblocks.common.Vario;
|
||||
import openblocks.events.PlayerActionEvent;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
public class KeyInputHandler {
|
||||
|
||||
private KeyBinding brickBinding;
|
||||
private KeyBinding varioSwitchBinding;
|
||||
private KeyBinding varioVolUpBinding;
|
||||
private KeyBinding varioVolDownBinding;
|
||||
|
||||
private boolean brickKeyPressed;
|
||||
private boolean varioSwitchKeyPressed;
|
||||
private boolean varioVolUpKeyPressed;
|
||||
private boolean varioVolDownKeyPressed;
|
||||
|
||||
public void setup() {
|
||||
if (!Config.soSerious) {
|
||||
brickBinding = new KeyBinding("openblocks.keybind.drop_brick", Keyboard.KEY_B, "openblocks.keybind.category");
|
||||
ClientRegistry.registerKeyBinding(brickBinding);
|
||||
}
|
||||
|
||||
if (Config.hanggliderEnableThermal) {
|
||||
varioSwitchBinding = new KeyBinding("openblocks.keybind.vario_switch", Keyboard.KEY_V, "openblocks.keybind.category");
|
||||
varioVolUpBinding = new KeyBinding("openblocks.keybind.vario_vol_up", Keyboard.KEY_NONE, "openblocks.keybind.category");
|
||||
varioVolDownBinding = new KeyBinding("openblocks.keybind.vario_vol_down", Keyboard.KEY_NONE, "openblocks.keybind.category");
|
||||
ClientRegistry.registerKeyBinding(varioSwitchBinding);
|
||||
ClientRegistry.registerKeyBinding(varioVolUpBinding);
|
||||
ClientRegistry.registerKeyBinding(varioVolDownBinding);
|
||||
}
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
|
@ -37,6 +53,24 @@ public class KeyInputHandler {
|
|||
brickKeyPressed = true;
|
||||
}
|
||||
} else brickKeyPressed = false;
|
||||
if (varioSwitchBinding != null && varioSwitchBinding.isPressed()) {
|
||||
if (!varioSwitchKeyPressed) {
|
||||
Vario.instance.toggle();
|
||||
varioSwitchKeyPressed = true;
|
||||
}
|
||||
} else varioSwitchKeyPressed = false;
|
||||
if (varioVolUpBinding != null && varioVolUpBinding.isPressed()) {
|
||||
if (!varioVolUpKeyPressed) {
|
||||
Vario.instance.incVolume();
|
||||
varioVolUpKeyPressed = true;
|
||||
}
|
||||
} else varioVolUpKeyPressed = false;
|
||||
if (varioVolDownBinding != null && varioVolDownBinding.isPressed()) {
|
||||
if (!varioVolDownKeyPressed) {
|
||||
Vario.instance.decVolume();
|
||||
varioVolDownKeyPressed = true;
|
||||
}
|
||||
} else varioVolDownKeyPressed = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,40 +1,36 @@
|
|||
package openblocks.client.fx;
|
||||
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.client.particle.Particle;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openmods.utils.TextureUtils;
|
||||
|
||||
public class FXLiquidSpray extends EntityFX {
|
||||
public class FXLiquidSpray extends Particle {
|
||||
|
||||
public FXLiquidSpray(World world, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3 velocity) {
|
||||
public FXLiquidSpray(World world, FluidStack fluid, double x, double y, double z, float scale, float gravity, Vec3d velocity) {
|
||||
this(world, TextureUtils.getFluidTexture(fluid), x, y, z, scale, gravity, velocity);
|
||||
}
|
||||
|
||||
public FXLiquidSpray(World world, Fluid fluid, double x, double y, double z, float scale, float gravity, Vec3 velocity) {
|
||||
public FXLiquidSpray(World world, Fluid fluid, double x, double y, double z, float scale, float gravity, Vec3d velocity) {
|
||||
this(world, TextureUtils.getFluidTexture(fluid), x, y, z, scale, gravity, velocity);
|
||||
}
|
||||
|
||||
public FXLiquidSpray(World world, TextureAtlasSprite icon, double x, double y, double z, float scale, float gravity, Vec3 velocity) {
|
||||
super(world, x, y, z, 0, 0, 0);
|
||||
|
||||
this.lastTickPosX = this.prevPosX = this.posX = x;
|
||||
this.lastTickPosY = this.prevPosY = this.posY = y;
|
||||
this.lastTickPosZ = this.prevPosZ = this.posZ = z;
|
||||
public FXLiquidSpray(World world, TextureAtlasSprite icon, double x, double y, double z, float scale, float gravity, Vec3d velocity) {
|
||||
super(world, x, y, z, velocity.xCoord, velocity.yCoord, velocity.zCoord);
|
||||
|
||||
particleGravity = gravity;
|
||||
this.particleMaxAge = 50;
|
||||
setSize(0.2f, 0.2f);
|
||||
this.particleScale = scale;
|
||||
this.noClip = false;
|
||||
this.canCollide = true;
|
||||
motionX = velocity.xCoord;
|
||||
motionY = velocity.yCoord;
|
||||
motionZ = velocity.zCoord;
|
||||
|
||||
setParticleIcon(icon);
|
||||
setParticleTexture(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.page.BookScaleConfig;
|
||||
import openmods.gui.component.page.PageBase;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.Iterables;
|
||||
import java.util.List;
|
||||
import openmods.gui.component.EmptyComposite;
|
||||
import openmods.gui.component.GuiComponentBook;
|
||||
import openmods.gui.component.GuiComponentHBox;
|
||||
import openmods.gui.component.GuiComponentHCenter;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.page.BookScaleConfig;
|
||||
import openmods.gui.component.page.PageBase;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class ChangelogPage extends PageBase {
|
||||
|
||||
|
@ -29,7 +31,7 @@ public class ChangelogPage extends PageBase {
|
|||
final float scaleContent = BookScaleConfig.getPageContentScale();
|
||||
final int lineSpace = BookScaleConfig.getTitlePageSeparator();
|
||||
|
||||
section = StatCollector.translateToLocal(section);
|
||||
section = TranslationUtils.translateToLocal(section);
|
||||
|
||||
final GuiComponentLabel currentVersionLabel = new GuiComponentLabel(0, 0, section).setScale(scaleTitle);
|
||||
addComponent(new GuiComponentHCenter(0, 24, getWidth()).addComponent(currentVersionLabel));
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openblocks.common.container.ContainerAutoAnvil;
|
||||
import openblocks.common.tileentity.TileEntityAutoAnvil;
|
||||
import openblocks.common.tileentity.TileEntityAutoAnvil.AutoSlots;
|
||||
import openmods.gui.GuiConfigurableSlots;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.GuiComponentSprite;
|
||||
import openmods.gui.component.GuiComponentTab;
|
||||
import openmods.gui.component.GuiComponentTankLevel;
|
||||
import openmods.gui.logic.ValueCopyAction;
|
||||
import openmods.utils.MiscUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class GuiAutoAnvil extends GuiConfigurableSlots<TileEntityAutoAnvil, ContainerAutoAnvil, TileEntityAutoAnvil.AutoSlots> {
|
||||
|
||||
|
@ -41,16 +44,16 @@ public class GuiAutoAnvil extends GuiConfigurableSlots<TileEntityAutoAnvil, Cont
|
|||
protected GuiComponentTab createTab(AutoSlots slot) {
|
||||
switch (slot) {
|
||||
case modifier:
|
||||
return new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Items.enchanted_book, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Items.ENCHANTED_BOOK, 1), 100, 100);
|
||||
case output: {
|
||||
ItemStack enchantedAxe = new ItemStack(Items.diamond_pickaxe, 1);
|
||||
enchantedAxe.addEnchantment(Enchantment.fortune, 1);
|
||||
ItemStack enchantedAxe = new ItemStack(Items.DIAMOND_PICKAXE, 1);
|
||||
enchantedAxe.addEnchantment(Enchantments.FORTUNE, 1);
|
||||
return new GuiComponentTab(StandardPalette.green.getColor(), enchantedAxe, 100, 100);
|
||||
}
|
||||
case tool:
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.diamond_pickaxe, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.DIAMOND_PICKAXE, 1), 100, 100);
|
||||
case xp:
|
||||
return new GuiComponentTab(StandardPalette.yellow.getColor(), new ItemStack(Items.bucket, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.yellow.getColor(), new ItemStack(Items.BUCKET, 1), 100, 100);
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
}
|
||||
|
@ -61,11 +64,11 @@ public class GuiAutoAnvil extends GuiConfigurableSlots<TileEntityAutoAnvil, Cont
|
|||
switch (slot) {
|
||||
case modifier:
|
||||
case tool:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoextract"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
|
||||
case output:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoeject"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
|
||||
case xp:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autodrink"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.init.Enchantments;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openblocks.common.container.ContainerAutoEnchantmentTable;
|
||||
import openblocks.common.tileentity.TileEntityAutoEnchantmentTable;
|
||||
import openblocks.common.tileentity.TileEntityAutoEnchantmentTable.AutoSlots;
|
||||
import openblocks.rpc.ILevelChanger;
|
||||
import openmods.api.IValueReceiver;
|
||||
import openmods.gui.GuiConfigurableSlots;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.GuiComponentSlider;
|
||||
import openmods.gui.component.GuiComponentTab;
|
||||
import openmods.gui.component.GuiComponentTankLevel;
|
||||
import openmods.gui.listener.IValueChangedListener;
|
||||
import openmods.gui.logic.ValueCopyAction;
|
||||
import openmods.utils.MiscUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class GuiAutoEnchantmentTable extends GuiConfigurableSlots<TileEntityAutoEnchantmentTable, ContainerAutoEnchantmentTable, TileEntityAutoEnchantmentTable.AutoSlots> {
|
||||
|
||||
|
@ -49,7 +52,7 @@ public class GuiAutoEnchantmentTable extends GuiConfigurableSlots<TileEntityAuto
|
|||
addSyncUpdateListener(ValueCopyAction.create(te.getMaxLevelProvider(), new IValueReceiver<Integer>() {
|
||||
@Override
|
||||
public void setValue(Integer value) {
|
||||
maxLevel.setText(StatCollector.translateToLocalFormatted("openblocks.gui.max_level", value));
|
||||
maxLevel.setText(TranslationUtils.translateToLocalFormatted("openblocks.gui.max_level", value));
|
||||
}
|
||||
}));
|
||||
root.addComponent(maxLevel);
|
||||
|
@ -63,14 +66,14 @@ public class GuiAutoEnchantmentTable extends GuiConfigurableSlots<TileEntityAuto
|
|||
protected GuiComponentTab createTab(AutoSlots slot) {
|
||||
switch (slot) {
|
||||
case input:
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.diamond_pickaxe, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.DIAMOND_PICKAXE, 1), 100, 100);
|
||||
case output: {
|
||||
ItemStack enchantedAxe = new ItemStack(Items.diamond_pickaxe, 1);
|
||||
enchantedAxe.addEnchantment(Enchantment.fortune, 1);
|
||||
ItemStack enchantedAxe = new ItemStack(Items.DIAMOND_PICKAXE, 1);
|
||||
enchantedAxe.addEnchantment(Enchantments.FORTUNE, 1);
|
||||
return new GuiComponentTab(StandardPalette.lightblue.getColor(), enchantedAxe, 100, 100);
|
||||
}
|
||||
case xp:
|
||||
return new GuiComponentTab(StandardPalette.green.getColor(), new ItemStack(Items.bucket, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.green.getColor(), new ItemStack(Items.BUCKET, 1), 100, 100);
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
}
|
||||
|
@ -80,11 +83,11 @@ public class GuiAutoEnchantmentTable extends GuiConfigurableSlots<TileEntityAuto
|
|||
protected GuiComponentLabel createLabel(AutoSlots slot) {
|
||||
switch (slot) {
|
||||
case input:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoextract"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
|
||||
case output:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoeject"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
|
||||
case xp:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autodrink"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiConfirmOpenLink;
|
||||
import openblocks.common.container.ContainerDonationStation;
|
||||
|
@ -16,9 +17,6 @@ import openmods.gui.component.GuiComponentLabel;
|
|||
import openmods.gui.component.GuiComponentTextButton;
|
||||
import openmods.gui.listener.IMouseDownListener;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class GuiDonationStation extends BaseGuiContainer<ContainerDonationStation> {
|
||||
|
||||
private final int PROMPT_REPLY_ACTION = 0;
|
||||
|
|
|
@ -9,7 +9,10 @@ import openblocks.common.container.ContainerDrawingTable;
|
|||
import openblocks.rpc.IStencilCrafter;
|
||||
import openmods.gui.BaseGuiContainer;
|
||||
import openmods.gui.Icon;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComponent;
|
||||
import openmods.gui.component.GuiComponentIconButton;
|
||||
import openmods.gui.component.GuiComponentSprite;
|
||||
import openmods.gui.component.GuiComponentTextButton;
|
||||
import openmods.gui.listener.IMouseDownListener;
|
||||
|
||||
public class GuiDrawingTable extends BaseGuiContainer<ContainerDrawingTable> {
|
||||
|
@ -58,10 +61,11 @@ public class GuiDrawingTable extends BaseGuiContainer<ContainerDrawingTable> {
|
|||
});
|
||||
|
||||
root.addComponent(buttonDraw);
|
||||
|
||||
(iconDisplay = new GuiComponentSprite(80, 34)
|
||||
.setColor(0f, 0f, 0f))
|
||||
.setOverlayMode(true)
|
||||
.setEnabled(inventorySlots.getSlot(0).getStack() != null);
|
||||
.setOverlayMode(true)
|
||||
.setEnabled(inventorySlots.getSlot(0).getStack() != null);
|
||||
root.addComponent(iconDisplay);
|
||||
root.addComponent(buttonLeft);
|
||||
root.addComponent(buttonRight);
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.FMLCommonHandler;
|
||||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.ChangelogBuilder;
|
||||
import openblocks.client.ChangelogBuilder.Changelog;
|
||||
|
@ -19,15 +19,13 @@ import openmods.gui.ComponentGui;
|
|||
import openmods.gui.DummyContainer;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.GuiComponentBook;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.page.*;
|
||||
import openmods.gui.component.page.PageBase;
|
||||
import openmods.gui.component.page.PageBase.ActionIcon;
|
||||
import openmods.gui.component.page.SectionPage;
|
||||
import openmods.gui.component.page.TitledPage;
|
||||
import openmods.infobook.PageBuilder;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class GuiInfoBook extends ComponentGui {
|
||||
|
||||
private GuiComponentBook book;
|
||||
|
@ -36,10 +34,6 @@ public class GuiInfoBook extends ComponentGui {
|
|||
super(new DummyContainer(), 0, 0);
|
||||
}
|
||||
|
||||
private static void setupBookmark(GuiComponentLabel label, GuiComponentBook book, int index) {
|
||||
label.setListener(book.createBookmarkListener(index));
|
||||
}
|
||||
|
||||
private static final PageBase blankPage = new PageBase() {};
|
||||
|
||||
@Override
|
||||
|
@ -60,12 +54,6 @@ public class GuiInfoBook extends ComponentGui {
|
|||
return index;
|
||||
}
|
||||
|
||||
private static int tocLine(int index) {
|
||||
final int tocStartHeight = 70;
|
||||
final int tocLineHeight = 15;
|
||||
return tocStartHeight + index * tocLineHeight;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleKeyboardInput() throws IOException {
|
||||
super.handleKeyboardInput();
|
||||
|
@ -92,30 +80,15 @@ public class GuiInfoBook extends ComponentGui {
|
|||
protected BaseComposite createRoot() {
|
||||
book = new GuiComponentBook();
|
||||
|
||||
PageBase contentsPage = new TitledPage("openblocks.gui.welcome.title", "openblocks.gui.welcome.content");
|
||||
|
||||
GuiComponentLabel lblBlocks = new GuiComponentLabel(27, tocLine(0), "- " + StatCollector.translateToLocal("openblocks.gui.blocks"));
|
||||
contentsPage.addComponent(lblBlocks);
|
||||
|
||||
GuiComponentLabel lblItems = new GuiComponentLabel(27, tocLine(1), "- " + StatCollector.translateToLocal("openblocks.gui.items"));
|
||||
contentsPage.addComponent(lblItems);
|
||||
|
||||
GuiComponentLabel lblMisc = new GuiComponentLabel(27, tocLine(2), "- " + StatCollector.translateToLocal("openblocks.gui.misc"));
|
||||
contentsPage.addComponent(lblMisc);
|
||||
|
||||
GuiComponentLabel lblChangelogs = new GuiComponentLabel(27, tocLine(3), "- " + StatCollector.translateToLocal("openblocks.gui.changelogs"));
|
||||
contentsPage.addComponent(lblChangelogs);
|
||||
|
||||
book.addPage(blankPage);
|
||||
book.addPage(new IntroPage());
|
||||
book.addPage(new TitledPage("openblocks.gui.credits.title", "openblocks.gui.credits.content"));
|
||||
|
||||
final TocPage contentsPage = new TocPage(book, Minecraft.getMinecraft().fontRendererObj);
|
||||
book.addPage(contentsPage);
|
||||
|
||||
{
|
||||
int blocksIndex = alignToEven(book);
|
||||
setupBookmark(lblBlocks, book, blocksIndex);
|
||||
book.addPage(blankPage);
|
||||
book.addPage(new SectionPage("openblocks.gui.blocks"));
|
||||
addSectionPage(book, contentsPage, "openblocks.gui.blocks");
|
||||
|
||||
PageBuilder builder = new PageBuilder();
|
||||
builder.includeModId(OpenBlocks.MODID);
|
||||
|
@ -126,10 +99,7 @@ public class GuiInfoBook extends ComponentGui {
|
|||
}
|
||||
|
||||
{
|
||||
int itemsIndex = alignToEven(book);
|
||||
setupBookmark(lblItems, book, itemsIndex);
|
||||
book.addPage(blankPage);
|
||||
book.addPage(new SectionPage("openblocks.gui.items"));
|
||||
addSectionPage(book, contentsPage, "openblocks.gui.items");
|
||||
|
||||
PageBuilder builder = new PageBuilder();
|
||||
builder.includeModId(OpenBlocks.MODID);
|
||||
|
@ -140,10 +110,8 @@ public class GuiInfoBook extends ComponentGui {
|
|||
}
|
||||
|
||||
{
|
||||
int miscIndex = alignToEven(book);
|
||||
setupBookmark(lblMisc, book, miscIndex);
|
||||
book.addPage(blankPage);
|
||||
book.addPage(new SectionPage("openblocks.gui.misc"));
|
||||
addSectionPage(book, contentsPage, "openblocks.gui.misc");
|
||||
|
||||
book.addPage(new TitledPage("openblocks.gui.config.title", "openblocks.gui.config.content"));
|
||||
book.addPage(new TitledPage("openblocks.gui.restore_inv.title", "openblocks.gui.restore_inv.content")
|
||||
.addActionButton(10, 133, getSavePath(), ActionIcon.FOLDER.icon, "openblocks.gui.save_folder"));
|
||||
|
@ -155,12 +123,10 @@ public class GuiInfoBook extends ComponentGui {
|
|||
|
||||
}
|
||||
|
||||
int changelogsIndex = alignToEven(book);
|
||||
book.addPage(blankPage);
|
||||
setupBookmark(lblChangelogs, book, changelogsIndex);
|
||||
book.addPage(new SectionPage("openblocks.gui.changelogs"));
|
||||
|
||||
createChangelogPages(book);
|
||||
{
|
||||
addSectionPage(book, contentsPage, "openblocks.gui.changelogs");
|
||||
createChangelogPages(book);
|
||||
}
|
||||
|
||||
book.enablePages();
|
||||
|
||||
|
@ -170,9 +136,17 @@ public class GuiInfoBook extends ComponentGui {
|
|||
return book;
|
||||
}
|
||||
|
||||
private static void addSectionPage(GuiComponentBook book, TocPage contentsPage, String sectionLabel) {
|
||||
final int startIndex = alignToEven(book);
|
||||
|
||||
book.addPage(blankPage);
|
||||
book.addPage(new SectionPage(sectionLabel));
|
||||
contentsPage.addTocEntry(sectionLabel, startIndex, startIndex + 2);
|
||||
}
|
||||
|
||||
private static File getSavePath() {
|
||||
try {
|
||||
MinecraftServer server = MinecraftServer.getServer();
|
||||
MinecraftServer server = FMLCommonHandler.instance().getMinecraftServerInstance();
|
||||
|
||||
if (server != null) {
|
||||
World world = server.worldServerForDimension(0);
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import openblocks.common.container.ContainerLuggage;
|
||||
import openblocks.common.entity.EntityLuggage;
|
||||
import openmods.gui.BaseGuiContainer;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
|
||||
public class GuiLuggage extends BaseGuiContainer<ContainerLuggage> {
|
||||
|
||||
private static String getInventoryName(EntityLuggage owner) {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openblocks.common.container.ContainerPaintMixer;
|
||||
import openblocks.common.tileentity.TileEntityPaintMixer;
|
||||
import openblocks.common.tileentity.TileEntityPaintMixer.DyeSlot;
|
||||
|
@ -10,15 +10,21 @@ import openblocks.rpc.IColorChanger;
|
|||
import openmods.api.IValueProvider;
|
||||
import openmods.colors.ColorMeta;
|
||||
import openmods.gui.SyncedGuiContainer;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComponent;
|
||||
import openmods.gui.component.GuiComponentColorPicker;
|
||||
import openmods.gui.component.GuiComponentLevel;
|
||||
import openmods.gui.component.GuiComponentPalettePicker;
|
||||
import openmods.gui.component.GuiComponentPalettePicker.PaletteEntry;
|
||||
import openmods.gui.component.GuiComponentProgress;
|
||||
import openmods.gui.component.GuiComponentRect;
|
||||
import openmods.gui.component.GuiComponentSlider;
|
||||
import openmods.gui.component.GuiComponentTextButton;
|
||||
import openmods.gui.component.GuiComponentTextbox;
|
||||
import openmods.gui.listener.IMouseDownListener;
|
||||
import openmods.gui.listener.IValueChangedListener;
|
||||
import openmods.gui.logic.IValueUpdateAction;
|
||||
import openmods.gui.logic.ValueCopyAction;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class GuiPaintMixer extends SyncedGuiContainer<ContainerPaintMixer> {
|
||||
|
||||
|
@ -102,7 +108,7 @@ public class GuiPaintMixer extends SyncedGuiContainer<ContainerPaintMixer> {
|
|||
{
|
||||
final List<PaletteEntry> vanillaPalette = Lists.newArrayList();
|
||||
for (ColorMeta color : ColorMeta.getAllColors()) {
|
||||
vanillaPalette.add(new PaletteEntry(color.vanillaBlockId, color.rgb, StatCollector.translateToLocal(color.unlocalizedName)));
|
||||
vanillaPalette.add(new PaletteEntry(color.vanillaBlockId, color.rgb, TranslationUtils.translateToLocal(color.unlocalizedName)));
|
||||
}
|
||||
palettePicker.setPalette(vanillaPalette);
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@ import openblocks.common.container.ContainerProjector;
|
|||
import openblocks.rpc.IRotatable;
|
||||
import openmods.gui.BaseGuiContainer;
|
||||
import openmods.gui.Icon;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComponent;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.EmptyComposite;
|
||||
import openmods.gui.component.GuiComponentIconButton;
|
||||
import openmods.gui.listener.IMouseDownListener;
|
||||
import openmods.gui.misc.Trackball.TrackballWrapper;
|
||||
import openmods.utils.MathUtils;
|
||||
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -61,7 +63,7 @@ public class GuiProjector extends BaseGuiContainer<ContainerProjector> {
|
|||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTickTime, int mouseX, int mouseY) {
|
||||
if (isInitialized == false || Mouse.isButtonDown(2)) {
|
||||
if (!isInitialized || Mouse.isButtonDown(2)) {
|
||||
trackball.setTransform(MathUtils.createEntityRotateMatrix(Minecraft.getMinecraft().getRenderViewEntity()));
|
||||
isInitialized = true;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,18 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openblocks.common.container.ContainerVacuumHopper;
|
||||
import openblocks.common.tileentity.TileEntityVacuumHopper;
|
||||
import openmods.gui.SyncedGuiContainer;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.GuiComponentSideSelector;
|
||||
import openmods.gui.component.GuiComponentSideSelector.ISideSelectedListener;
|
||||
import openmods.gui.component.GuiComponentTab;
|
||||
import openmods.gui.component.GuiComponentTabWrapper;
|
||||
import openmods.gui.component.GuiComponentTankLevel;
|
||||
import openmods.gui.logic.ValueCopyAction;
|
||||
import openmods.utils.TranslationUtils;
|
||||
import openmods.utils.bitmap.IReadableBitMap;
|
||||
import openmods.utils.bitmap.IWriteableBitMap;
|
||||
|
||||
|
@ -33,21 +38,21 @@ public class GuiVacuumHopper extends SyncedGuiContainer<ContainerVacuumHopper> {
|
|||
|
||||
final IBlockState state = te.getWorld().getBlockState(te.getPos());
|
||||
{
|
||||
GuiComponentTab itemTab = new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Blocks.chest), 100, 100);
|
||||
GuiComponentTab itemTab = new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Blocks.CHEST), 100, 100);
|
||||
final GuiComponentSideSelector sideSelector = new GuiComponentSideSelector(15, 15, 40.0, state, te, false);
|
||||
wireSideSelector(sideSelector, te.getReadableItemOutputs(), te.getWriteableItemOutputs());
|
||||
|
||||
itemTab.addComponent(new GuiComponentLabel(24, 10, StatCollector.translateToLocal("openblocks.gui.item_outputs")));
|
||||
itemTab.addComponent(new GuiComponentLabel(24, 10, TranslationUtils.translateToLocal("openblocks.gui.item_outputs")));
|
||||
itemTab.addComponent(sideSelector);
|
||||
tabs.addComponent(itemTab);
|
||||
}
|
||||
|
||||
{
|
||||
GuiComponentTab xpTab = new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.experience_bottle, 1), 100, 100);
|
||||
GuiComponentTab xpTab = new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.EXPERIENCE_BOTTLE, 1), 100, 100);
|
||||
GuiComponentSideSelector sideSelector = new GuiComponentSideSelector(15, 15, 40.0, state, te, false);
|
||||
wireSideSelector(sideSelector, te.getReadableXpOutputs(), te.getWriteableXpOutputs());
|
||||
xpTab.addComponent(sideSelector);
|
||||
xpTab.addComponent(new GuiComponentLabel(24, 10, StatCollector.translateToLocal("openblocks.gui.xp_outputs")));
|
||||
xpTab.addComponent(new GuiComponentLabel(24, 10, TranslationUtils.translateToLocal("openblocks.gui.xp_outputs")));
|
||||
tabs.addComponent(xpTab);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import openblocks.common.container.ContainerXPBottler;
|
||||
import openblocks.common.tileentity.TileEntityXPBottler;
|
||||
import openblocks.common.tileentity.TileEntityXPBottler.AutoSlots;
|
||||
import openmods.gui.GuiConfigurableSlots;
|
||||
import openmods.gui.component.*;
|
||||
import openmods.gui.component.BaseComposite;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.GuiComponentProgress;
|
||||
import openmods.gui.component.GuiComponentTab;
|
||||
import openmods.gui.component.GuiComponentTankLevel;
|
||||
import openmods.gui.logic.ValueCopyAction;
|
||||
import openmods.utils.MiscUtils;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class GuiXPBottler extends GuiConfigurableSlots<TileEntityXPBottler, ContainerXPBottler, TileEntityXPBottler.AutoSlots> {
|
||||
|
||||
|
@ -40,11 +43,11 @@ public class GuiXPBottler extends GuiConfigurableSlots<TileEntityXPBottler, Cont
|
|||
protected GuiComponentTab createTab(AutoSlots slot) {
|
||||
switch (slot) {
|
||||
case input:
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.glass_bottle, 1), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.blue.getColor(), new ItemStack(Items.GLASS_BOTTLE, 1), 100, 100);
|
||||
case output:
|
||||
return new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Items.experience_bottle), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.lightblue.getColor(), new ItemStack(Items.EXPERIENCE_BOTTLE), 100, 100);
|
||||
case xp:
|
||||
return new GuiComponentTab(StandardPalette.green.getColor(), new ItemStack(Items.bucket), 100, 100);
|
||||
return new GuiComponentTab(StandardPalette.green.getColor(), new ItemStack(Items.BUCKET), 100, 100);
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
}
|
||||
|
@ -54,11 +57,11 @@ public class GuiXPBottler extends GuiConfigurableSlots<TileEntityXPBottler, Cont
|
|||
protected GuiComponentLabel createLabel(AutoSlots slot) {
|
||||
switch (slot) {
|
||||
case input:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoextract"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoextract"));
|
||||
case output:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autoeject"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autoeject"));
|
||||
case xp:
|
||||
return new GuiComponentLabel(22, 82, StatCollector.translateToLocal("openblocks.gui.autodrink"));
|
||||
return new GuiComponentLabel(22, 82, TranslationUtils.translateToLocal("openblocks.gui.autodrink"));
|
||||
default:
|
||||
throw MiscUtils.unhandledEnum(slot);
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
package openblocks.client.gui;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import openmods.gui.component.GuiComponentBook;
|
||||
import openmods.gui.component.GuiComponentLabel;
|
||||
import openmods.gui.component.page.TitledPage;
|
||||
import openmods.gui.listener.IMouseDownListener;
|
||||
import openmods.utils.TranslationUtils;
|
||||
|
||||
public class TocPage extends TitledPage {
|
||||
|
||||
private static final int TOC_LINE_LEFT_MARGIN = 20;
|
||||
private static final int TOC_TOTAL_LINE_WIDTH = 140;
|
||||
private static final int TOC_START_HEIGHT = 70;
|
||||
private static final int TOC_LINE_HEIGHT = 15;
|
||||
|
||||
private final GuiComponentBook book;
|
||||
|
||||
private final FontRenderer fontRenderer;
|
||||
|
||||
private int nextTocEntry;
|
||||
|
||||
public TocPage(GuiComponentBook book, FontRenderer fontRenderer) {
|
||||
super("openblocks.gui.welcome.title", "openblocks.gui.welcome.content");
|
||||
this.book = book;
|
||||
this.fontRenderer = fontRenderer;
|
||||
}
|
||||
|
||||
private static int tocLine(int index) {
|
||||
return TOC_START_HEIGHT + index * TOC_LINE_HEIGHT;
|
||||
}
|
||||
|
||||
public void addTocEntry(String untranslatedLabel, int pageIndex, int displayedPage) {
|
||||
int lineWidthBudget = TOC_TOTAL_LINE_WIDTH;
|
||||
|
||||
final String translatedLabel = TranslationUtils.translateToLocal(untranslatedLabel);
|
||||
|
||||
final String pageNumber = Integer.toString(displayedPage);
|
||||
|
||||
final int labelWidth = fontRenderer.getStringWidth(translatedLabel);
|
||||
lineWidthBudget -= labelWidth;
|
||||
|
||||
final int pageNumberWidth = fontRenderer.getStringWidth(pageNumber);
|
||||
lineWidthBudget -= pageNumberWidth;
|
||||
|
||||
final int spaceWidth = fontRenderer.getCharWidth(' ');
|
||||
lineWidthBudget -= 2 * spaceWidth;
|
||||
|
||||
final int dotWidth = fontRenderer.getCharWidth('.');
|
||||
final StringBuilder paddedPageNumberBuilder = new StringBuilder();
|
||||
|
||||
while (lineWidthBudget - dotWidth > 0) {
|
||||
paddedPageNumberBuilder.append('.');
|
||||
lineWidthBudget -= dotWidth;
|
||||
}
|
||||
|
||||
paddedPageNumberBuilder.append(' ');
|
||||
paddedPageNumberBuilder.append(pageNumber);
|
||||
|
||||
String paddedPageNumber = paddedPageNumberBuilder.toString();
|
||||
|
||||
final IMouseDownListener pageJumpListener = book.createBookmarkListener(pageIndex);
|
||||
|
||||
{
|
||||
final GuiComponentLabel label = new GuiComponentLabel(TOC_LINE_LEFT_MARGIN, tocLine(nextTocEntry), translatedLabel);
|
||||
label.setListener(pageJumpListener);
|
||||
addComponent(label);
|
||||
}
|
||||
|
||||
{
|
||||
final int pos = TOC_LINE_LEFT_MARGIN + labelWidth + lineWidthBudget;
|
||||
final GuiComponentLabel label = new GuiComponentLabel(pos, tocLine(nextTocEntry), paddedPageNumber);
|
||||
label.setListener(pageJumpListener);
|
||||
addComponent(label);
|
||||
}
|
||||
|
||||
nextTocEntry++;
|
||||
}
|
||||
}
|
|
@ -4,7 +4,6 @@ import net.minecraft.client.model.ModelBase;
|
|||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelCartographer extends ModelBase {
|
||||
|
|
|
@ -9,8 +9,8 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
|||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
@ -18,7 +18,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
|||
import openblocks.common.CraneRegistry;
|
||||
import openblocks.common.entity.EntityMagnet;
|
||||
import openblocks.common.item.ItemCraneBackpack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelCraneBackpack extends ModelBiped {
|
||||
|
@ -87,7 +86,7 @@ public class ModelCraneBackpack extends ModelBiped {
|
|||
|
||||
@SubscribeEvent
|
||||
public void renderLines(RenderPlayerEvent.Pre evt) {
|
||||
final EntityPlayer player = evt.entityPlayer;
|
||||
final EntityPlayer player = evt.getEntityPlayer();
|
||||
|
||||
if (!ItemCraneBackpack.isWearingCrane(player)) return;
|
||||
|
||||
|
@ -96,18 +95,19 @@ public class ModelCraneBackpack extends ModelBiped {
|
|||
if (magnet == null) return;
|
||||
|
||||
// TODO 1.8.9 check values (maybe 0?)
|
||||
double playerX = interpolatePos(player.posX, player.lastTickPosX, evt.partialRenderTick)
|
||||
final float partialRenderTick = evt.getPartialRenderTick();
|
||||
double playerX = interpolatePos(player.posX, player.lastTickPosX, partialRenderTick)
|
||||
- TileEntityRendererDispatcher.staticPlayerX;
|
||||
double playerY = interpolatePos(player.posY, player.lastTickPosY, evt.partialRenderTick)
|
||||
double playerY = interpolatePos(player.posY, player.lastTickPosY, partialRenderTick)
|
||||
- TileEntityRendererDispatcher.staticPlayerY;
|
||||
double playerZ = interpolatePos(player.posZ, player.lastTickPosZ, evt.partialRenderTick)
|
||||
double playerZ = interpolatePos(player.posZ, player.lastTickPosZ, partialRenderTick)
|
||||
- TileEntityRendererDispatcher.staticPlayerZ;
|
||||
|
||||
// TODO 1.8.9 check eye height
|
||||
if (player instanceof EntityOtherPlayerMP) playerY += 1.62;
|
||||
|
||||
final float offset = interpolateAngle(player.renderYawOffset, player.prevRenderYawOffset, evt.partialRenderTick);
|
||||
final float head = interpolateAngle(player.rotationYawHead, player.prevRotationYawHead, evt.partialRenderTick);
|
||||
final float offset = interpolateAngle(player.renderYawOffset, player.prevRenderYawOffset, partialRenderTick);
|
||||
final float head = interpolateAngle(player.rotationYawHead, player.prevRotationYawHead, partialRenderTick);
|
||||
|
||||
double armX = playerX;
|
||||
double armY = playerY;
|
||||
|
@ -128,9 +128,9 @@ public class ModelCraneBackpack extends ModelBiped {
|
|||
armX += armLength * MathHelper.cos(head);
|
||||
armZ += armLength * MathHelper.sin(head);
|
||||
|
||||
final double magnetX = interpolatePos(magnet.posX, magnet.lastTickPosX, evt.partialRenderTick) - TileEntityRendererDispatcher.staticPlayerX;
|
||||
final double magnetY = interpolatePos(magnet.posY, magnet.lastTickPosY, evt.partialRenderTick) - TileEntityRendererDispatcher.staticPlayerY + magnet.height - 0.1;
|
||||
final double magnetZ = interpolatePos(magnet.posZ, magnet.lastTickPosZ, evt.partialRenderTick) - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
final double magnetX = interpolatePos(magnet.posX, magnet.lastTickPosX, partialRenderTick) - TileEntityRendererDispatcher.staticPlayerX;
|
||||
final double magnetY = interpolatePos(magnet.posY, magnet.lastTickPosY, partialRenderTick) - TileEntityRendererDispatcher.staticPlayerY + magnet.height - 0.1;
|
||||
final double magnetZ = interpolatePos(magnet.posZ, magnet.lastTickPosZ, partialRenderTick) - TileEntityRendererDispatcher.staticPlayerZ;
|
||||
|
||||
GL11.glLineWidth(2);
|
||||
GlStateManager.disableTexture2D();
|
||||
|
@ -226,7 +226,7 @@ public class ModelCraneBackpack extends ModelBiped {
|
|||
if (!ItemCraneBackpack.isWearingCrane(player)) return;
|
||||
|
||||
drawArm(evt, player);
|
||||
drawLineFPP(player, evt.partialTicks);
|
||||
drawLineFPP(player, evt.getPartialTicks());
|
||||
}
|
||||
|
||||
public void init() {
|
||||
|
|
|
@ -3,7 +3,7 @@ package openblocks.client.model;
|
|||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class ModelLuggage extends ModelBase {
|
||||
// fields
|
||||
|
|
|
@ -14,7 +14,7 @@ public class ModelMiniMe extends ModelBiped {
|
|||
public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity entity) {
|
||||
super.setRotationAngles(par1, par2, par3, par4, par5, par6, entity);
|
||||
EntityMiniMe minime = (EntityMiniMe)entity;
|
||||
if (minime.riddenByEntity != null) {
|
||||
if (minime.isBeingRidden()) {
|
||||
this.bipedLeftArm.rotateAngleX = -3f;
|
||||
this.bipedRightArm.rotateAngleX = -3f;
|
||||
this.bipedLeftArm.rotateAngleZ = 0.3f;
|
||||
|
|
|
@ -7,6 +7,7 @@ import openmods.renderer.ITileEntityModel;
|
|||
|
||||
public class ModelPaintMixer extends ModelBase implements ITileEntityModel<TileEntityPaintMixer> {
|
||||
|
||||
// fields
|
||||
ModelRenderer controls;
|
||||
ModelRenderer right;
|
||||
ModelRenderer left;
|
||||
|
@ -15,8 +16,7 @@ public class ModelPaintMixer extends ModelBase implements ITileEntityModel<TileE
|
|||
ModelRenderer bottom;
|
||||
ModelRenderer bottom2;
|
||||
|
||||
public ModelPaintMixer()
|
||||
{
|
||||
public ModelPaintMixer() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class ModelPaintMixer extends ModelBase implements ITileEntityModel<TileE
|
|||
right.setRotationPoint(0F, 0F, 0F);
|
||||
right.setTextureSize(64, 64);
|
||||
right.mirror = true;
|
||||
setRotation(right, 0F, 3.141593F, 0F);
|
||||
setRotation(right, 0F, (float)Math.PI, 0F);
|
||||
left = new ModelRenderer(this, 0, 36);
|
||||
left.addBox(-6F, 0F, -6F, 1, 16, 12);
|
||||
left.setRotationPoint(0F, 0F, 0F);
|
||||
|
|
|
@ -18,8 +18,7 @@ public class ModelPiggy extends ModelBase implements ITileEntityModel<TileEntity
|
|||
ModelRenderer leg3;
|
||||
ModelRenderer tail;
|
||||
|
||||
public ModelPiggy()
|
||||
{
|
||||
public ModelPiggy() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class ModelSleepingBag extends ModelBiped {
|
|||
pillow.setRotationPoint(0F, 0F, 3F);
|
||||
pillow.setTextureSize(128, 64);
|
||||
pillow.mirror = true;
|
||||
setRotation(pillow, 0F, 0F, 1.570796F);
|
||||
setRotation(pillow, 0F, 0F, (float)(Math.PI / 2));
|
||||
}
|
||||
|
||||
private static void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package openblocks.client.model;
|
|||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class ModelSonicGlasses extends ModelBiped {
|
||||
|
|
|
@ -20,7 +20,7 @@ public class ModelTarget extends ModelBase implements ITileEntityModel<TileEntit
|
|||
stand1.setRotationPoint(0F, 15F, 0F);
|
||||
stand1.setTextureSize(64, 32);
|
||||
stand1.mirror = true;
|
||||
setRotation(stand1, 0F, 1.570796F, 0F);
|
||||
setRotation(stand1, 0F, (float)(Math.PI / 2), 0F);
|
||||
target = new ModelRenderer(this, 0, 0);
|
||||
target.addBox(-8F, -15F, -1F, 16, 15, 1);
|
||||
target.setRotationPoint(0F, 15F, -7F);
|
||||
|
@ -32,7 +32,7 @@ public class ModelTarget extends ModelBase implements ITileEntityModel<TileEntit
|
|||
stand2.setRotationPoint(0F, 15F, 0F);
|
||||
stand2.setTextureSize(64, 32);
|
||||
stand2.mirror = true;
|
||||
setRotation(stand2, 0F, 1.570796F, 0F);
|
||||
setRotation(stand2, 0F, (float)(Math.PI / 2), 0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,8 @@ import net.minecraft.client.model.ModelRenderer;
|
|||
import openblocks.common.tileentity.TileEntityXPShower;
|
||||
import openmods.renderer.ITileEntityModel;
|
||||
|
||||
public class ModelXPShower extends ModelBase implements ITileEntityModel<TileEntityXPShower>
|
||||
{
|
||||
public class ModelXPShower extends ModelBase implements ITileEntityModel<TileEntityXPShower> {
|
||||
|
||||
ModelRenderer end;
|
||||
ModelRenderer main;
|
||||
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
package openblocks.client.renderer;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.material.MapColor;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import openblocks.common.HeightMapData;
|
||||
import openmods.renderer.DynamicTextureAtlas;
|
||||
import openmods.renderer.DynamicTextureAtlas.AtlasCell;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class HeightMapRenderer {
|
||||
public static final HeightMapRenderer instance = new HeightMapRenderer();
|
||||
|
||||
|
@ -76,7 +73,7 @@ public class HeightMapRenderer {
|
|||
// stupid singed bytes
|
||||
int height = layer.heightMap[index] & 0xFF;
|
||||
|
||||
int fullColor = MapColor.mapColorArray[color].colorValue;
|
||||
int fullColor = MapColor.COLORS[color].colorValue;
|
||||
int[] plane = getPlane(levels, height);
|
||||
plane[index] = fullColor | (layer.alpha << 24);
|
||||
}
|
||||
|
@ -119,7 +116,7 @@ public class HeightMapRenderer {
|
|||
GlStateManager.enableBlend();
|
||||
|
||||
final Tessellator tes = new Tessellator(4 * (3 + 2) * 4 * 2);
|
||||
WorldRenderer wr = tes.getWorldRenderer();
|
||||
VertexBuffer wr = tes.getBuffer();
|
||||
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
|
||||
for (PlaneData plane : planes) {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package openblocks.client.renderer.entity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
|
@ -21,7 +20,6 @@ import openblocks.common.entity.EntityCartographer;
|
|||
import openblocks.common.entity.EntityCartographer.MapJobs;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityCartographerRenderer extends Render<EntityCartographer> {
|
||||
|
@ -210,7 +208,7 @@ public class EntityCartographerRenderer extends Render<EntityCartographer> {
|
|||
bindTexture(TEXTURE);
|
||||
MODEL.renderBase(cartographer.eyeYaw);
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
MODEL.renderEye(cartographer.eyeYaw, cartographer.eyePitch);
|
||||
cartographer.updateEye();
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
import openblocks.OpenBlocks;
|
||||
import openblocks.common.entity.EntityHangGlider;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityHangGliderRenderer extends Render<EntityHangGlider> {
|
||||
|
@ -58,7 +57,7 @@ public class EntityHangGliderRenderer extends Render<EntityHangGlider> {
|
|||
final boolean isFpp = minecraft.gameSettings.thirdPersonView == 0;
|
||||
final boolean isDeployed = glider.isDeployed();
|
||||
|
||||
if (isLocalPlayer && isFpp && isDeployed) return;
|
||||
if (isLocalPlayer && isFpp && !isDeployed) return;
|
||||
|
||||
final float rotation = interpolateRotation(glider.prevRotationYaw, glider.rotationYaw, f1);
|
||||
|
||||
|
@ -68,7 +67,7 @@ public class EntityHangGliderRenderer extends Render<EntityHangGlider> {
|
|||
GL11.glRotatef(180.0F - rotation, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (isLocalPlayer) {
|
||||
if (isDeployed) {
|
||||
if (!isDeployed) {
|
||||
// move up and closer to back
|
||||
GL11.glTranslated(0, -0.2, +0.3);
|
||||
} else {
|
||||
|
@ -81,7 +80,7 @@ public class EntityHangGliderRenderer extends Render<EntityHangGlider> {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (isDeployed) {
|
||||
if (!isDeployed) {
|
||||
// move up little bit (other player center is lower)
|
||||
GL11.glTranslated(0, +0.2, +0.3);
|
||||
} else {
|
||||
|
@ -90,7 +89,7 @@ public class EntityHangGliderRenderer extends Render<EntityHangGlider> {
|
|||
}
|
||||
}
|
||||
|
||||
if (isDeployed) {
|
||||
if (!isDeployed) {
|
||||
GL11.glRotatef(ONGROUND_ROTATION, 1, 0, 0);
|
||||
GL11.glScalef(0.4f, 1f, 0.4f);
|
||||
}
|
||||
|
|
10
src/main/java/openblocks/client/renderer/entity/EntityLuggageRenderer.java
Normal file → Executable file
10
src/main/java/openblocks/client/renderer/entity/EntityLuggageRenderer.java
Normal file → Executable file
|
@ -9,7 +9,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.model.ModelLuggage;
|
||||
import openblocks.common.entity.EntityLuggage;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityLuggageRenderer extends RenderLiving<EntityLuggage> {
|
||||
|
@ -20,15 +19,12 @@ public class EntityLuggageRenderer extends RenderLiving<EntityLuggage> {
|
|||
private static final ResourceLocation textureSpecial = OpenBlocks.location("textures/models/luggage_special.png");
|
||||
private static final ResourceLocation creeperEffect = new ResourceLocation("textures/entity/creeper/creeper_armor.png");
|
||||
|
||||
private class LayerCharge implements LayerRenderer<EntityLuggage>
|
||||
{
|
||||
private class LayerCharge implements LayerRenderer<EntityLuggage> {
|
||||
|
||||
// TODO 1.8.9 verify if it works
|
||||
@Override
|
||||
public void doRenderLayer(EntityLuggage luggage, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
|
||||
{
|
||||
if (luggage.isSpecial())
|
||||
{
|
||||
public void doRenderLayer(EntityLuggage luggage, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale) {
|
||||
if (luggage.isSpecial()) {
|
||||
bindTexture(creeperEffect);
|
||||
GlStateManager.matrixMode(GL11.GL_TEXTURE);
|
||||
GlStateManager.loadIdentity();
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.util.ResourceLocation;
|
||||
import openblocks.OpenBlocks;
|
||||
import openblocks.common.entity.EntityMagnet;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class EntityMagnetRenderer extends Render<EntityMagnet> {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.client.renderer.entity;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
@ -11,8 +11,6 @@ import net.minecraftforge.common.MinecraftForge;
|
|||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
public class EntitySelectionHandler {
|
||||
|
||||
public interface ISelectAware {}
|
||||
|
@ -43,7 +41,7 @@ public class EntitySelectionHandler {
|
|||
final Entity target = mc.objectMouseOver.entityHit;
|
||||
if (target instanceof ISelectAware) {
|
||||
ISelectionRenderer<Entity> renderer = registry.get(mc.objectMouseOver.entityHit.getClass());
|
||||
if (renderer != null) renderer.render(target, mc.thePlayer, evt.context, evt.partialTicks);
|
||||
if (renderer != null) renderer.render(target, mc.thePlayer, evt.getContext(), evt.getPartialTicks());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,9 @@ import net.minecraft.client.model.ModelBook;
|
|||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import openblocks.common.tileentity.TileEntityAutoEnchantmentTable;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityAutoEnchantmentTableRenderer extends TileEntitySpecialRenderer<TileEntityAutoEnchantmentTable> {
|
||||
|
|
|
@ -5,13 +5,12 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.model.ModelCannon;
|
||||
import openblocks.common.item.MetasGenericUnstackable;
|
||||
import openblocks.common.tileentity.TileEntityCannon;
|
||||
import openmods.OpenMods;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityCannonRenderer extends TileEntitySpecialRenderer<TileEntityCannon> {
|
||||
|
@ -40,7 +39,7 @@ public class TileEntityCannonRenderer extends TileEntitySpecialRenderer<TileEnti
|
|||
GlStateManager.color(0, 0, 0);
|
||||
GL11.glBegin(GL11.GL_LINE_STRIP);
|
||||
|
||||
final Vec3 motion = cannon.getMotion();
|
||||
final Vec3d motion = cannon.getMotion();
|
||||
double motionX = motion.xCoord;
|
||||
double motionY = motion.yCoord;
|
||||
double motionZ = motion.zCoord;
|
||||
|
@ -68,7 +67,7 @@ public class TileEntityCannonRenderer extends TileEntitySpecialRenderer<TileEnti
|
|||
private static boolean playerHasCursor() {
|
||||
EntityPlayer player = OpenMods.proxy.getThePlayer();
|
||||
if (player == null) return false;
|
||||
ItemStack held = player.getHeldItem();
|
||||
ItemStack held = player.getHeldItemMainhand();
|
||||
return held != null && MetasGenericUnstackable.pointer.isA(held);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.util.ResourceLocation;
|
|||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.model.ModelFan;
|
||||
import openblocks.common.tileentity.TileEntityFan;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityFanRenderer extends TileEntitySpecialRenderer<TileEntityFan> {
|
||||
|
|
|
@ -2,7 +2,7 @@ package openblocks.client.renderer.tileentity;
|
|||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
@ -12,7 +12,6 @@ import openblocks.common.block.BlockFlag;
|
|||
import openblocks.common.tileentity.TileEntityFlag;
|
||||
import openmods.colors.RGB;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityFlagRenderer extends TileEntitySpecialRenderer<TileEntityFlag> {
|
||||
|
@ -23,7 +22,7 @@ public class TileEntityFlagRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
@Override
|
||||
public void compile() {
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
VertexBuffer wr = tessellator.getBuffer();
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
|
||||
|
||||
wr.pos(0, 0, 0).tex(0, 1).normal(0, 0, 1);
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package openblocks.client.renderer.tileentity;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
@ -10,7 +12,6 @@ import openblocks.OpenBlocks;
|
|||
import openblocks.client.model.ModelEgg;
|
||||
import openblocks.common.tileentity.TileEntityGoldenEgg;
|
||||
import openblocks.common.tileentity.TileEntityGoldenEgg.State;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityGoldenEggRenderer extends TileEntitySpecialRenderer<TileEntityGoldenEgg> {
|
||||
|
@ -94,7 +95,7 @@ public class TileEntityGoldenEggRenderer extends TileEntitySpecialRenderer<TileE
|
|||
RANDOM.setSeed(432L);
|
||||
|
||||
// TODO 1.8.9 verify
|
||||
WorldRenderer wr = tes.getWorldRenderer();
|
||||
VertexBuffer wr = tes.getBuffer();
|
||||
wr.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||
|
||||
final int alpha = (int)(MAX_OPACITY * (1.0F - f2));
|
||||
|
|
|
@ -8,7 +8,6 @@ import openblocks.OpenBlocks;
|
|||
import openblocks.client.model.ModelGrave;
|
||||
import openblocks.common.tileentity.TileEntityGrave;
|
||||
import openmods.utils.BlockUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityGraveRenderer extends TileEntitySpecialRenderer<TileEntityGrave> {
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
package openblocks.client.renderer.tileentity;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityGuideRenderer<T extends TileEntityGuide> extends TileEntitySpecialRenderer<T> {
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(T guide, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
float scaleDelta = guide.getTimeSinceChange();
|
||||
renderShape(guide.getShape(), guide.getColor(), scaleDelta);
|
||||
if (scaleDelta < 1.0) {
|
||||
renderShape(guide.getPreviousShape(), guide.getColor(), 1.0f - scaleDelta);
|
||||
}
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void renderShape(Collection<BlockPos> shape, int color, float scale) {
|
||||
if (shape == null) return;
|
||||
|
||||
RenderUtils.setColor(color);
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
for (BlockPos coord : shape)
|
||||
renderMarkerAt(coord, scale);
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
private void renderMarkerAt(BlockPos pos, float scale) {
|
||||
// TODO 1.8.9 use actual models
|
||||
}
|
||||
}
|
|
@ -4,13 +4,12 @@ import net.minecraft.client.renderer.GlStateManager;
|
|||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import openblocks.Config;
|
||||
import openblocks.common.tileentity.*;
|
||||
import openblocks.common.tileentity.TileEntityImaginary;
|
||||
import openblocks.common.tileentity.TileEntityImaginary.ICollisionData;
|
||||
import openblocks.common.tileentity.TileEntityImaginary.PanelData;
|
||||
import openblocks.common.tileentity.TileEntityImaginary.Property;
|
||||
import openblocks.common.tileentity.TileEntityImaginary.StairsData;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityImaginaryRenderer extends TileEntitySpecialRenderer<TileEntityImaginary> {
|
||||
|
@ -26,7 +25,7 @@ public class TileEntityImaginaryRenderer extends TileEntitySpecialRenderer<TileE
|
|||
|
||||
if (te.visibility <= 0) return;
|
||||
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if (!te.isPencil()) {
|
||||
RenderUtils.setColor(te.color, te.visibility);
|
||||
|
|
|
@ -8,7 +8,6 @@ import openblocks.client.model.ModelPaintMixer;
|
|||
import openblocks.common.tileentity.TileEntityPaintMixer;
|
||||
import openmods.colors.RGB;
|
||||
import openmods.utils.BlockUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityPaintMixerRenderer extends TileEntitySpecialRenderer<TileEntityPaintMixer> {
|
||||
|
@ -32,7 +31,7 @@ public class TileEntityPaintMixerRenderer extends TileEntitySpecialRenderer<Tile
|
|||
GL11.glRotated(150, 0, 0, -1);
|
||||
GL11.glRotated(90, 0, 1, 0);
|
||||
GL11.glScaled(0.8, 0.8, 0.8);
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
if (mixer.hasPaint()) {
|
||||
if (mixer.isEnabled()) {
|
||||
GL11.glTranslated(0, Math.random() * 0.2, 0);
|
||||
|
|
|
@ -2,8 +2,8 @@ package openblocks.client.renderer.tileentity;
|
|||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import openblocks.OpenBlocks;
|
||||
|
@ -13,31 +13,33 @@ import openblocks.common.HeightMapData;
|
|||
import openblocks.common.MapDataManager;
|
||||
import openblocks.common.tileentity.TileEntityProjector;
|
||||
import openmods.OpenMods;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityProjectorRenderer extends TileEntitySpecialRenderer<TileEntityProjector> {
|
||||
|
||||
private final static ResourceLocation texture = OpenBlocks.location("textures/models/projector.png");
|
||||
|
||||
private static ModelProjector model = new ModelProjector();
|
||||
private static final float BLOCK_CENTRE_TRANSLATION = 0.5F;
|
||||
|
||||
public static void reload() {
|
||||
model = new ModelProjector();
|
||||
}
|
||||
private static ModelProjector model = new ModelProjector();
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntityProjector projector, double x, double y, double z, float partialTickTime, int destroyProgess) {
|
||||
int pass = MinecraftForgeClient.getRenderPass();
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5, y, z + 0.5);
|
||||
GL11.glTranslated(x + BLOCK_CENTRE_TRANSLATION, y, z + BLOCK_CENTRE_TRANSLATION);
|
||||
GL11.glRotated(90 * projector.rotation(), 0, 1, 0);
|
||||
GL11.glTranslated(-0.5, 0, -0.5);
|
||||
|
||||
GL11.glTranslated(-BLOCK_CENTRE_TRANSLATION, 0, -BLOCK_CENTRE_TRANSLATION);
|
||||
GlStateManager.color(1, 1, 1);
|
||||
|
||||
int mapId = projector.mapId();
|
||||
if (pass <= 0) renderProjector(projector, partialTickTime, mapId >= 0);
|
||||
else renderMap(projector, mapId);
|
||||
if (pass <= 0) {
|
||||
renderProjector(projector, partialTickTime, mapId >= 0);
|
||||
} else {
|
||||
renderMap(projector, mapId);
|
||||
}
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
@ -53,8 +55,8 @@ public class TileEntityProjectorRenderer extends TileEntitySpecialRenderer<TileE
|
|||
}
|
||||
}
|
||||
|
||||
private void renderProjector(TileEntityProjector projector, float partialTickTime, boolean active) {
|
||||
GL11.glTranslated(0.25, 0.5, 0.25);
|
||||
private void renderProjector(final TileEntityProjector projector, final float partialTickTime, final boolean active) {
|
||||
GL11.glTranslated(BLOCK_CENTRE_TRANSLATION / 2, BLOCK_CENTRE_TRANSLATION, BLOCK_CENTRE_TRANSLATION / 2);
|
||||
bindTexture(texture);
|
||||
if (active) {
|
||||
long ticks = OpenMods.proxy.getTicks(projector.getWorld());
|
||||
|
@ -63,5 +65,4 @@ public class TileEntityProjectorRenderer extends TileEntitySpecialRenderer<TileE
|
|||
model.render(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ package openblocks.client.renderer.tileentity;
|
|||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
|
@ -13,7 +13,6 @@ import openmods.Log;
|
|||
import openmods.colors.RGB;
|
||||
import openmods.renderer.StencilRendererHandler;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntitySkyRenderer extends TileEntitySpecialRenderer<TileEntitySky> {
|
||||
|
@ -66,12 +65,12 @@ public class TileEntitySkyRenderer extends TileEntitySpecialRenderer<TileEntityS
|
|||
handler = stencilBit >= 0? new StencilSkyRenderer(1 << stencilBit) : StencilRendererHandler.DUMMY;
|
||||
}
|
||||
|
||||
private static void addVertex(WorldRenderer wr, double x, double y, double z) {
|
||||
private static void addVertex(VertexBuffer wr, double x, double y, double z) {
|
||||
wr.pos(x, y, z).endVertex();
|
||||
}
|
||||
|
||||
private static void renderCube(Tessellator tes) {
|
||||
final WorldRenderer wr = tes.getWorldRenderer();
|
||||
final VertexBuffer wr = tes.getBuffer();
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION);
|
||||
|
||||
addVertex(wr, 0, 0, 0);
|
||||
|
|
|
@ -6,7 +6,6 @@ import openblocks.OpenBlocks;
|
|||
import openblocks.client.model.ModelSprinkler;
|
||||
import openblocks.common.tileentity.TileEntitySprinkler;
|
||||
import openmods.utils.BlockUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntitySprinklerRenderer extends TileEntitySpecialRenderer<TileEntitySprinkler> {
|
||||
|
|
|
@ -2,7 +2,7 @@ package openblocks.client.renderer.tileentity;
|
|||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
@ -18,7 +18,6 @@ import openmods.renderer.TessellatorPool.WorldRendererUser;
|
|||
import openmods.utils.Diagonal;
|
||||
import openmods.utils.TextureUtils;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntityTank> {
|
||||
|
@ -28,8 +27,9 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
if (tankTile.isInvalid()) return;
|
||||
|
||||
final ITankRenderFluidData data = tankTile.getRenderFluidData();
|
||||
if (data.hasFluid()) {
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
|
||||
if (data != null && data.hasFluid()) {
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
// it just looks broken with blending
|
||||
|
@ -44,7 +44,7 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
}
|
||||
}
|
||||
|
||||
private static void addVertexWithUV(WorldRenderer wr, double x, double y, double z, double u, double v) {
|
||||
private static void addVertexWithUV(VertexBuffer wr, double x, double y, double z, double u, double v) {
|
||||
wr.pos(x, y, z).tex(u, v).endVertex();
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
TextureAtlasSprite texture = TextureUtils.getFluidTexture(fluidStack);
|
||||
final int color;
|
||||
|
||||
TextureUtils.bindTextureToClient(TextureMap.locationBlocksTexture);
|
||||
TextureUtils.bindTextureToClient(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
if (texture != null) {
|
||||
color = fluid.getColor(fluidStack);
|
||||
|
@ -85,7 +85,7 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
TessellatorPool.instance.startDrawing(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX, new WorldRendererUser() {
|
||||
|
||||
@Override
|
||||
public void execute(WorldRenderer wr) {
|
||||
public void execute(VertexBuffer wr) {
|
||||
|
||||
if (data.shouldRenderFluidWall(EnumFacing.NORTH) && (nw > 0 || ne > 0)) {
|
||||
addVertexWithUV(wr, 1, 0, 0, uMax, vMin);
|
||||
|
@ -143,7 +143,7 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
}
|
||||
|
||||
public static ResourceLocation getFluidSheet(FluidStack liquid) {
|
||||
if (liquid == null) return TextureMap.locationBlocksTexture;
|
||||
if (liquid == null) return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
return getFluidSheet(liquid.getFluid());
|
||||
}
|
||||
|
||||
|
@ -151,6 +151,6 @@ public class TileEntityTankRenderer extends TileEntitySpecialRenderer<TileEntity
|
|||
* @param liquid
|
||||
*/
|
||||
public static ResourceLocation getFluidSheet(Fluid liquid) {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
package openblocks.client.renderer.tileentity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.*;
|
||||
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.block.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
@ -20,7 +23,6 @@ import openblocks.common.TrophyHandler.Trophy;
|
|||
import openblocks.common.tileentity.TileEntityTrophy;
|
||||
import openmods.utils.BlockUtils;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityTrophyRenderer extends TileEntitySpecialRenderer<TileEntityTrophy> {
|
||||
|
@ -56,22 +58,22 @@ public class TileEntityTrophyRenderer extends TileEntitySpecialRenderer<TileEnti
|
|||
IBakedModel model = blockRenderer.getBlockModelShapes().getModelForState(state);
|
||||
|
||||
Tessellator tessellator = Tessellator.getInstance();
|
||||
WorldRenderer wr = tessellator.getWorldRenderer();
|
||||
bindTexture(TextureMap.locationBlocksTexture);
|
||||
final VertexBuffer wr = tessellator.getBuffer();
|
||||
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
wr.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
|
||||
wr.setTranslation(x, y, z);
|
||||
|
||||
for (EnumFacing face : EnumFacing.values())
|
||||
renderQuads(wr, model.getFaceQuads(face));
|
||||
renderQuads(wr, model.getQuads(state, face, 0));
|
||||
|
||||
renderQuads(wr, model.getGeneralQuads());
|
||||
renderQuads(wr, model.getQuads(state, null, 0));
|
||||
tessellator.draw();
|
||||
|
||||
wr.setTranslation(0, 0, 0);
|
||||
}
|
||||
|
||||
private static void renderQuads(WorldRenderer wr, List<BakedQuad> quads) {
|
||||
private static void renderQuads(VertexBuffer wr, List<BakedQuad> quads) {
|
||||
for (BakedQuad quad : quads)
|
||||
LightUtil.renderQuadColor(wr, quad, 0xFFFFFFFF);
|
||||
}
|
||||
|
|
|
@ -2,18 +2,17 @@ package openblocks.client.renderer.tileentity;
|
|||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import openblocks.OpenBlocks;
|
||||
import openblocks.client.model.ModelVillage;
|
||||
import openblocks.common.tileentity.TileEntityVillageHighlighter;
|
||||
import openmods.sync.SyncableIntArray;
|
||||
import openmods.utils.BlockUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityVillageHighlighterRenderer extends TileEntitySpecialRenderer<TileEntityVillageHighlighter> {
|
||||
|
@ -31,7 +30,7 @@ public class TileEntityVillageHighlighterRenderer extends TileEntitySpecialRende
|
|||
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.0f, (float)z + 0.5F);
|
||||
if (vh != null && vh.isPowered()) {
|
||||
Tessellator t = Tessellator.getInstance();
|
||||
WorldRenderer wr = t.getWorldRenderer();
|
||||
VertexBuffer wr = t.getBuffer();
|
||||
|
||||
SyncableIntArray villages = vh.getVillageData();
|
||||
int[] data = villages.getValue();
|
||||
|
@ -93,11 +92,11 @@ public class TileEntityVillageHighlighterRenderer extends TileEntitySpecialRende
|
|||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private static void addVertex(WorldRenderer wr, double x, double y, double z) {
|
||||
private static void addVertex(VertexBuffer wr, double x, double y, double z) {
|
||||
wr.pos(x, y, z).endVertex();
|
||||
}
|
||||
|
||||
public void drawBox(WorldRenderer wr, AxisAlignedBB bb) {
|
||||
public void drawBox(VertexBuffer wr, AxisAlignedBB bb) {
|
||||
// bottom
|
||||
addVertex(wr, bb.minX, bb.minY, bb.minZ);
|
||||
addVertex(wr, bb.maxX, bb.minY, bb.minZ);
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import openblocks.shapes.CoordShape;
|
||||
import openmods.utils.TextureUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuideAdvancedRenderer implements IGuideRenderer {
|
||||
|
||||
private final MarkerRenderer mr;
|
||||
|
||||
public GuideAdvancedRenderer(Runnable marker) {
|
||||
this.mr = new MarkerRenderer(marker);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderShape(TileEntityGuide guide) {
|
||||
float scaleDelta = guide.getTimeSinceChange();
|
||||
renderShape(guide.getShape(), guide.getColor(), scaleDelta);
|
||||
if (scaleDelta < 1.0) renderShape(guide.getPreviousShape(), guide.getColor(), 1.0f - scaleDelta);
|
||||
CoordShape toDelete = guide.getAndDeleteShape();
|
||||
if (toDelete != null && mr != null) mr.deleteShape(toDelete);
|
||||
}
|
||||
|
||||
private void renderShape(CoordShape shape, int color, float scale) {
|
||||
if (shape == null) return;
|
||||
|
||||
TextureUtils.bindTextureToClient(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
|
||||
GlStateManager.enableBlend();
|
||||
|
||||
GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GlStateManager.disableLighting();
|
||||
|
||||
mr.drawInstanced(shape, color, scale);
|
||||
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.disableBlend();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextureChange() {
|
||||
mr.reset();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import openblocks.shapes.CoordShape;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
import openmods.utils.TextureUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuideLegacyRenderer implements IGuideRenderer {
|
||||
|
||||
private DisplayListWrapper wrapper;
|
||||
|
||||
public GuideLegacyRenderer(final Runnable model) {
|
||||
wrapper = new DisplayListWrapper() {
|
||||
@Override
|
||||
public void compile() {
|
||||
// model.run();
|
||||
// Tessellator.getInstance().draw();
|
||||
// TODO 1.10 models TBD
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextureChange() {
|
||||
wrapper.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderShape(TileEntityGuide guide) {
|
||||
float scaleDelta = guide.getTimeSinceChange();
|
||||
renderShape(guide.getShape(), guide.getColor(), scaleDelta);
|
||||
if (scaleDelta < 1.0) {
|
||||
renderShape(guide.getPreviousShape(), guide.getColor(), 1.0f - scaleDelta);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderShape(CoordShape shape, int color, float scale) {
|
||||
if (shape == null) return;
|
||||
|
||||
TextureUtils.bindTextureToClient(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
||||
// TODO 1.8 GlStateManager
|
||||
GL11.glColor3ub((byte)(color >> 16), (byte)(color >> 8), (byte)(color >> 0));
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (BlockPos coord : shape.getCoords())
|
||||
renderMarkerAt(coord.getX(), coord.getY(), coord.getZ(), scale);
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
}
|
||||
|
||||
private void renderMarkerAt(double x, double y, double z, float scale) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5F, y, z + 0.5F);
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
wrapper.render();
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import openblocks.Config;
|
||||
import openmods.Log;
|
||||
import openmods.renderer.shaders.ArraysHelper;
|
||||
import openmods.renderer.shaders.BufferHelper;
|
||||
import openmods.renderer.shaders.ShaderHelper;
|
||||
|
||||
public class GuideRendererSelector {
|
||||
|
||||
private static Runnable createMarkerRenderer() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO 1.8.9 use actual models
|
||||
// well, as long as array allows...
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static IGuideRenderer createRenderer() {
|
||||
final Runnable marker = createMarkerRenderer();
|
||||
if (!ShaderHelper.isSupported() || !BufferHelper.isSupported() || !ArraysHelper.isSupported()) {
|
||||
Log.debug("Advanced guide renderer not supported, falling back to legacy renderer.");
|
||||
return new GuideLegacyRenderer(marker); // advanced renderer not supported :(
|
||||
} else if (Config.useAdvancedRenderer == false) {
|
||||
Log.debug("Advanced guide renderer disabled, falling back to legacy renderer.");
|
||||
return new GuideLegacyRenderer(marker);
|
||||
} else {
|
||||
try {
|
||||
return new GuideAdvancedRenderer(marker); // try to use the advanced renderer
|
||||
} catch (Throwable e) {
|
||||
Log.warn(e, "Error trying to create advanced renderer, falling back to legacy renderer");
|
||||
return new GuideLegacyRenderer(marker); // fall back to the old renderer.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IGuideRenderer renderer;
|
||||
|
||||
public IGuideRenderer getRenderer() {
|
||||
if (renderer == null) renderer = createRenderer();
|
||||
return renderer;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
|
||||
public interface IGuideRenderer {
|
||||
void renderShape(TileEntityGuide guide);
|
||||
|
||||
void onTextureChange();
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import net.minecraft.client.renderer.GLAllocation;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.VertexBuffer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import openblocks.shapes.CoordShape;
|
||||
import openmods.renderer.shaders.ArraysHelper;
|
||||
import openmods.renderer.shaders.BufferHelper;
|
||||
import openmods.renderer.shaders.ShaderProgram;
|
||||
import openmods.renderer.shaders.ShaderProgramBuilder;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL15;
|
||||
import org.lwjgl.opengl.GL20;
|
||||
|
||||
public class MarkerRenderer {
|
||||
|
||||
private static final ResourceLocation vertexSource = new ResourceLocation("openblocks:shaders/shader.vert");
|
||||
private static final ResourceLocation fragmentSource = new ResourceLocation("openblocks:shaders/shader.frag");
|
||||
private final ShaderProgram shader;
|
||||
|
||||
private static final int nativeBufferSize = 0x200000;
|
||||
private final ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
|
||||
private final IntBuffer intBuffer = byteBuffer.asIntBuffer();
|
||||
|
||||
private final Runnable model;
|
||||
|
||||
private boolean initialized;
|
||||
private boolean hasTexture;
|
||||
private boolean hasColor;
|
||||
|
||||
private boolean shouldRefresh = true;
|
||||
|
||||
private int vertexCount;
|
||||
|
||||
private int vao;
|
||||
private int vbo;
|
||||
|
||||
public MarkerRenderer(Runnable model) {
|
||||
this.model = model;
|
||||
|
||||
final ShaderProgramBuilder shaderProgramBuilder = new ShaderProgramBuilder();
|
||||
shaderProgramBuilder.addShader(vertexSource, GL20.GL_VERTEX_SHADER);
|
||||
shaderProgramBuilder.addShader(fragmentSource, GL20.GL_FRAGMENT_SHADER);
|
||||
this.shader = shaderProgramBuilder.build();
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
shouldRefresh = true;
|
||||
}
|
||||
|
||||
private void createModel() {
|
||||
model.run();
|
||||
VertexBuffer.State state = Tessellator.getInstance().getBuffer().getVertexState();
|
||||
Tessellator.getInstance().draw(); // just discard the state this way.
|
||||
|
||||
if (state.getRawBuffer().length > nativeBufferSize) throw new UnsupportedOperationException("Big buffers not supported!");
|
||||
|
||||
vertexCount = state.getVertexCount();
|
||||
|
||||
byteBuffer.position(0);
|
||||
intBuffer.clear();
|
||||
intBuffer.put(state.getRawBuffer(), 0, vertexCount * 8);
|
||||
byteBuffer.position(0);
|
||||
byteBuffer.limit(vertexCount * 32);
|
||||
|
||||
hasTexture = state.getVertexFormat().hasUvOffset(0);
|
||||
hasColor = state.getVertexFormat().hasColor();
|
||||
}
|
||||
|
||||
private void createVAO() {
|
||||
if (initialized) {
|
||||
createModel();
|
||||
|
||||
if (vao == 0) vao = ArraysHelper.methods().glGenVertexArrays();
|
||||
ArraysHelper.methods().glBindVertexArray(vao);
|
||||
|
||||
if (vbo == 0) vbo = BufferHelper.methods().glGenBuffers();
|
||||
BufferHelper.methods().glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
|
||||
BufferHelper.methods().glBufferData(GL15.GL_ARRAY_BUFFER, byteBuffer, GL15.GL_STATIC_DRAW);
|
||||
|
||||
shader.attributePointer("aVertex", 3, GL11.GL_FLOAT, false, 32, 0);
|
||||
shader.attributePointer("aTexCoord", 2, GL11.GL_FLOAT, false, 32, 12);
|
||||
shader.attributePointer("aColor", 4, GL11.GL_UNSIGNED_BYTE, false, 32, 20);
|
||||
|
||||
BufferHelper.methods().glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
|
||||
shader.uniform1f("uHasTexture", hasTexture? 1f : 0f);
|
||||
shader.uniform1f("uHasColor", hasColor? 1f : 0f);
|
||||
shader.uniform1i("uDefaultTexture", 0);
|
||||
|
||||
ArraysHelper.methods().glBindVertexArray(0);
|
||||
shouldRefresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void drawInstanced(CoordShape shape, int color, float scale) {
|
||||
shader.bind();
|
||||
initialized = true;
|
||||
if (shouldRefresh) createVAO();
|
||||
ArraysHelper.methods().glBindVertexArray(vao);
|
||||
shape.bindVBO();
|
||||
shader.instanceAttributePointer("aPosition", 3, GL11.GL_INT, false, 0, 0);
|
||||
BufferHelper.methods().glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
|
||||
shader.uniform3f("uColor", ((color >> 16) & 0xFF) / 255f, ((color >> 8) & 0xFF) / 255f, (color & 0xFF) / 255f);
|
||||
shader.uniform1f("uScale", scale);
|
||||
ArraysHelper.methods().glDrawArraysInstanced(GL11.GL_QUADS, 0, vertexCount, shape.size());
|
||||
|
||||
ArraysHelper.methods().glBindVertexArray(0);
|
||||
shader.release();
|
||||
}
|
||||
|
||||
public void deleteShape(CoordShape shape) {
|
||||
if (initialized) {
|
||||
ArraysHelper.methods().glBindVertexArray(vao);
|
||||
shape.destroy();
|
||||
ArraysHelper.methods().glBindVertexArray(0);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
package openblocks.client.renderer.tileentity;
|
||||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.client.MinecraftForgeClient;
|
||||
import openblocks.common.tileentity.TileEntityBuilderGuide;
|
||||
import openmods.renderer.DisplayListWrapper;
|
||||
import openmods.utils.render.RenderUtils;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityBuilderGuideRenderer extends TileEntityGuideRenderer<TileEntityBuilderGuide> {
|
|
@ -0,0 +1,31 @@
|
|||
package openblocks.client.renderer.tileentity.guide;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import openblocks.common.tileentity.TileEntityGuide;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class TileEntityGuideRenderer<T extends TileEntityGuide> extends TileEntitySpecialRenderer<T> {
|
||||
|
||||
private final IGuideRenderer renderer;
|
||||
|
||||
public TileEntityGuideRenderer() {
|
||||
this.renderer = new GuideRendererSelector().getRenderer();
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onTextureChange(TextureStitchEvent evt) {
|
||||
renderer.onTextureChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(T tileentity, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
renderer.renderShape(tileentity);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
|
@ -1,13 +1,14 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
import openmods.utils.Diagonal;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
import openmods.utils.Diagonal;
|
||||
|
||||
public class DiagonalConnection extends RenderConnection {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import openmods.utils.Diagonal;
|
||||
|
||||
public class DoubledCoords {
|
||||
|
@ -31,23 +31,23 @@ public class DoubledCoords {
|
|||
this(pos.getX(), pos.getY(), pos.getZ(), dir);
|
||||
}
|
||||
|
||||
public boolean check(int baseX, int baseY, int baseZ, EnumFacing dir) {
|
||||
public boolean isSameAs(int baseX, int baseY, int baseZ, EnumFacing dir) {
|
||||
return (x == 2 * baseX + dir.getFrontOffsetX()) &&
|
||||
(y == 2 * baseY + dir.getFrontOffsetY()) &&
|
||||
(z == 2 * baseZ + dir.getFrontOffsetZ());
|
||||
}
|
||||
|
||||
public boolean check(BlockPos pos, EnumFacing dir) {
|
||||
return check(pos.getX(), pos.getY(), pos.getZ(), dir);
|
||||
public boolean isSameAs(BlockPos pos, EnumFacing dir) {
|
||||
return isSameAs(pos.getX(), pos.getY(), pos.getZ(), dir);
|
||||
}
|
||||
|
||||
public boolean check(int baseX, int baseY, int baseZ, Diagonal dir) {
|
||||
public boolean isSameAs(int baseX, int baseY, int baseZ, Diagonal dir) {
|
||||
return (x == 2 * baseX + dir.offsetX) &&
|
||||
(y == 2 * baseY + dir.offsetY) &&
|
||||
(z == 2 * baseZ + dir.offsetZ);
|
||||
}
|
||||
|
||||
public boolean check(BlockPos pos, Diagonal dir) {
|
||||
return check(pos.getX(), pos.getY(), pos.getZ(), dir);
|
||||
public boolean isSameAs(BlockPos pos, Diagonal dir) {
|
||||
return isSameAs(pos.getX(), pos.getY(), pos.getZ(), dir);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import openmods.utils.Diagonal;
|
||||
|
||||
public class RenderConnection {
|
||||
|
@ -11,11 +11,19 @@ public class RenderConnection {
|
|||
this.coords = coords;
|
||||
}
|
||||
|
||||
public boolean check(BlockPos pos, EnumFacing dir) {
|
||||
return coords.check(pos, dir);
|
||||
public boolean isPositionEqualTo(int x, int y, int z, EnumFacing dir) {
|
||||
return coords.isSameAs(x, y, z, dir);
|
||||
}
|
||||
|
||||
public boolean check(BlockPos pos, Diagonal dir) {
|
||||
return coords.check(pos, dir);
|
||||
public boolean isPositionEqualTo(BlockPos pos, EnumFacing dir) {
|
||||
return coords.isSameAs(pos, dir);
|
||||
}
|
||||
|
||||
public boolean isPositionEqualTo(int x, int y, int z, Diagonal dir) {
|
||||
return coords.isSameAs(x, y, z, dir);
|
||||
}
|
||||
|
||||
public boolean isPositionEqualTo(BlockPos pos, Diagonal dir) {
|
||||
return coords.isSameAs(pos, dir);
|
||||
}
|
||||
}
|
|
@ -1,44 +1,190 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import openblocks.common.tileentity.TileEntityTank;
|
||||
import openmods.liquids.GenericTank;
|
||||
import openmods.utils.Diagonal;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
public class TankRenderLogic {
|
||||
|
||||
public class TankRenderLogic implements ITankConnections, ITankRenderFluidData {
|
||||
private static class TankConnections implements ITankConnections {
|
||||
|
||||
private final GenericTank tank;
|
||||
|
||||
private final Map<Diagonal, DiagonalConnection> diagonalConnections;
|
||||
|
||||
private final Map<EnumFacing, HorizontalConnection> horizontalConnections;
|
||||
|
||||
private final VerticalConnection topConnection;
|
||||
|
||||
private final VerticalConnection bottomConnection;
|
||||
|
||||
public TankConnections(GenericTank tank, Map<Diagonal, DiagonalConnection> diagonalConnections, Map<EnumFacing, HorizontalConnection> horizontalConnections, VerticalConnection topConnection, VerticalConnection bottomConnection) {
|
||||
this.tank = tank;
|
||||
this.diagonalConnections = diagonalConnections;
|
||||
this.horizontalConnections = horizontalConnections;
|
||||
this.topConnection = topConnection;
|
||||
this.bottomConnection = bottomConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalConnection getTopConnection() {
|
||||
return topConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalConnection getBottomConnection() {
|
||||
return bottomConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HorizontalConnection getHorizontalConnection(EnumFacing dir) {
|
||||
return horizontalConnections.get(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagonalConnection getDiagonalConnection(Diagonal dir) {
|
||||
return diagonalConnections.get(dir);
|
||||
}
|
||||
|
||||
public void updateFluid(FluidStack fluidStack) {
|
||||
for (Map.Entry<Diagonal, DiagonalConnection> e : diagonalConnections.entrySet())
|
||||
e.getValue().updateFluid(e.getKey().getOpposite(), fluidStack);
|
||||
|
||||
for (Map.Entry<EnumFacing, HorizontalConnection> e : horizontalConnections.entrySet())
|
||||
e.getValue().updateFluid(e.getKey().getOpposite(), fluidStack);
|
||||
|
||||
topConnection.updateBottomFluid(fluidStack, tank.getSpace() == 0);
|
||||
bottomConnection.updateTopFluid(fluidStack);
|
||||
}
|
||||
|
||||
private static boolean checkConsistency(RenderConnection connection, BlockPos pos, EnumFacing dir) {
|
||||
return connection != null && connection.isPositionEqualTo(pos, dir);
|
||||
}
|
||||
|
||||
private static boolean checkConsistency(RenderConnection connection, BlockPos pos, Diagonal dir) {
|
||||
return connection != null && connection.isPositionEqualTo(pos, dir);
|
||||
}
|
||||
|
||||
private boolean checkHorizontalConsistency(BlockPos pos, EnumFacing dir) {
|
||||
return checkConsistency(horizontalConnections.get(dir), pos, dir);
|
||||
}
|
||||
|
||||
private boolean checkDiagonalConsistency(BlockPos pos, Diagonal dir) {
|
||||
return checkConsistency(diagonalConnections.get(dir), pos, dir);
|
||||
}
|
||||
|
||||
public boolean checkConsistency(BlockPos pos) {
|
||||
return checkConsistency(topConnection, pos, EnumFacing.UP) &&
|
||||
checkConsistency(bottomConnection, pos, EnumFacing.DOWN) &&
|
||||
checkHorizontalConsistency(pos, EnumFacing.NORTH) &&
|
||||
checkHorizontalConsistency(pos, EnumFacing.SOUTH) &&
|
||||
checkHorizontalConsistency(pos, EnumFacing.EAST) &&
|
||||
checkHorizontalConsistency(pos, EnumFacing.WEST) &&
|
||||
checkDiagonalConsistency(pos, Diagonal.NE) &&
|
||||
checkDiagonalConsistency(pos, Diagonal.NW) &&
|
||||
checkDiagonalConsistency(pos, Diagonal.SE) &&
|
||||
checkDiagonalConsistency(pos, Diagonal.SW);
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
for (Map.Entry<Diagonal, DiagonalConnection> e : diagonalConnections.entrySet())
|
||||
e.getValue().clearFluid(e.getKey().getOpposite());
|
||||
|
||||
for (Map.Entry<EnumFacing, HorizontalConnection> e : horizontalConnections.entrySet())
|
||||
e.getValue().clearFluid(e.getKey().getOpposite());
|
||||
|
||||
if (topConnection != null) {
|
||||
topConnection.clearBottomFluid();
|
||||
}
|
||||
|
||||
if (bottomConnection != null) {
|
||||
bottomConnection.clearTopFluid();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static class TankRenderFluidData implements ITankRenderFluidData {
|
||||
|
||||
private final TankConnections connections;
|
||||
|
||||
private final GenericTank tank;
|
||||
|
||||
private final float phase;
|
||||
|
||||
public TankRenderFluidData(TankConnections connections, GenericTank tank, float phase) {
|
||||
this.connections = connections;
|
||||
this.tank = tank;
|
||||
this.phase = phase;
|
||||
}
|
||||
|
||||
private static boolean isConnected(GridConnection connection) {
|
||||
return connection != null? connection.isConnected() : false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderFluidWall(EnumFacing side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return !isConnected(connections.getBottomConnection());
|
||||
case UP:
|
||||
return !isConnected(connections.getTopConnection());
|
||||
case EAST:
|
||||
case WEST:
|
||||
case NORTH:
|
||||
case SOUTH: {
|
||||
return !isConnected(connections.getHorizontalConnection(side));
|
||||
}
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFluid() {
|
||||
return tank.getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid() {
|
||||
return tank.getFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCenterFluidLevel(float time) {
|
||||
final float raw = (float)tank.getFluidAmount() / tank.getCapacity();
|
||||
final float waving = TankRenderUtils.calculateWaveAmplitude(time, phase) + raw;
|
||||
return TankRenderUtils.clampLevel(waving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCornerFluidLevel(Diagonal corner, float time) {
|
||||
final DiagonalConnection diagonal = connections.getDiagonalConnection(corner);
|
||||
return diagonal != null? diagonal.getRenderHeight(corner.getOpposite(), time) : getCenterFluidLevel(time);
|
||||
}
|
||||
}
|
||||
|
||||
private final GenericTank tank;
|
||||
|
||||
private BlockPos pos;
|
||||
|
||||
private World world;
|
||||
|
||||
private final GenericTank tank;
|
||||
private TankConnections connections;
|
||||
|
||||
private final Map<Diagonal, DiagonalConnection> diagonalConnections = Maps.newEnumMap(Diagonal.class);
|
||||
|
||||
private final Map<EnumFacing, HorizontalConnection> horizontalConnections = Maps.newEnumMap(EnumFacing.class);
|
||||
|
||||
private VerticalConnection topConnection;
|
||||
|
||||
private VerticalConnection bottomConnection;
|
||||
|
||||
private float phase;
|
||||
private TankRenderFluidData renderData;
|
||||
|
||||
public TankRenderLogic(GenericTank tank) {
|
||||
this.tank = tank;
|
||||
}
|
||||
|
||||
private static boolean isConnected(GridConnection connection) {
|
||||
return connection != null? connection.isConnected() : false;
|
||||
}
|
||||
|
||||
private DoubledCoords createCoords(EnumFacing dir) {
|
||||
return new DoubledCoords(pos, dir);
|
||||
}
|
||||
|
@ -49,7 +195,7 @@ public class TankRenderLogic implements ITankConnections, ITankRenderFluidData {
|
|||
|
||||
private ITankConnections getNeighbourTank(BlockPos pos) {
|
||||
TileEntity te = TankRenderUtils.getTileEntitySafe(world, pos);
|
||||
return (te instanceof TileEntityTank)? ((TileEntityTank)te).getRenderConnectionsData() : null;
|
||||
return (te instanceof TileEntityTank)? ((TileEntityTank)te).getTankConnections() : null;
|
||||
}
|
||||
|
||||
private ITankConnections getNeighbourTank(EnumFacing dir) {
|
||||
|
@ -75,25 +221,25 @@ public class TankRenderLogic implements ITankConnections, ITankRenderFluidData {
|
|||
return new DiagonalConnection(TankRenderUtils.calculatePhase(pos.getX(), pos.getY(), pos.getZ(), start), createCoords(start));
|
||||
}
|
||||
|
||||
private void tryCornerConnection(ITankConnections tankCW, ITankConnections tankD, ITankConnections tankCCW, Diagonal dir) {
|
||||
private void tryCornerConnection(Map<Diagonal, DiagonalConnection> diagonalConnections, ITankConnections tankCW, ITankConnections tankD, ITankConnections tankCCW, Diagonal dir) {
|
||||
final DiagonalConnection connection = selectDiagonalConnection(tankCW, tankD, tankCCW, dir);
|
||||
diagonalConnections.put(dir, connection);
|
||||
}
|
||||
|
||||
private void tryHorizontalConnection(ITankConnections neighbour, EnumFacing dir) {
|
||||
private void tryHorizontalConnection(Map<EnumFacing, HorizontalConnection> horizontalConnections, ITankConnections neighbour, EnumFacing dir) {
|
||||
final HorizontalConnection connection = (neighbour != null)? neighbour.getHorizontalConnection(dir.getOpposite()) : new HorizontalConnection(createCoords(dir));
|
||||
horizontalConnections.put(dir, connection);
|
||||
}
|
||||
|
||||
private void tryBottomConnection(ITankConnections neighbour) {
|
||||
bottomConnection = neighbour != null? neighbour.getTopConnection() : new VerticalConnection(createCoords(EnumFacing.DOWN));
|
||||
private VerticalConnection tryBottomConnection(ITankConnections neighbour) {
|
||||
return neighbour != null? neighbour.getTopConnection() : new VerticalConnection(createCoords(EnumFacing.DOWN));
|
||||
}
|
||||
|
||||
private void tryTopConnection(ITankConnections neighbour) {
|
||||
topConnection = neighbour != null? neighbour.getBottomConnection() : new VerticalConnection(createCoords(EnumFacing.UP));
|
||||
private VerticalConnection tryTopConnection(ITankConnections neighbour) {
|
||||
return neighbour != null? neighbour.getBottomConnection() : new VerticalConnection(createCoords(EnumFacing.UP));
|
||||
}
|
||||
|
||||
public void updateConnections() {
|
||||
private TankConnections updateConnections() {
|
||||
final ITankConnections tankN = getNeighbourTank(EnumFacing.NORTH);
|
||||
final ITankConnections tankS = getNeighbourTank(EnumFacing.SOUTH);
|
||||
final ITankConnections tankW = getNeighbourTank(EnumFacing.WEST);
|
||||
|
@ -107,159 +253,63 @@ public class TankRenderLogic implements ITankConnections, ITankRenderFluidData {
|
|||
final ITankConnections tankT = getNeighbourTank(EnumFacing.UP);
|
||||
final ITankConnections tankB = getNeighbourTank(EnumFacing.DOWN);
|
||||
|
||||
tryTopConnection(tankT);
|
||||
tryBottomConnection(tankB);
|
||||
final VerticalConnection topConnection = tryTopConnection(tankT);
|
||||
final VerticalConnection bottomConnection = tryBottomConnection(tankB);
|
||||
|
||||
tryHorizontalConnection(tankN, EnumFacing.NORTH);
|
||||
tryHorizontalConnection(tankS, EnumFacing.SOUTH);
|
||||
tryHorizontalConnection(tankW, EnumFacing.WEST);
|
||||
tryHorizontalConnection(tankE, EnumFacing.EAST);
|
||||
final Map<Diagonal, DiagonalConnection> diagonalConnections = Maps.newEnumMap(Diagonal.class);
|
||||
|
||||
tryCornerConnection(tankN, tankNW, tankW, Diagonal.NW);
|
||||
tryCornerConnection(tankW, tankSW, tankS, Diagonal.SW);
|
||||
tryCornerConnection(tankE, tankNE, tankN, Diagonal.NE);
|
||||
tryCornerConnection(tankS, tankSE, tankE, Diagonal.SE);
|
||||
final Map<EnumFacing, HorizontalConnection> horizontalConnections = Maps.newEnumMap(EnumFacing.class);
|
||||
|
||||
tryHorizontalConnection(horizontalConnections, tankN, EnumFacing.NORTH);
|
||||
tryHorizontalConnection(horizontalConnections, tankS, EnumFacing.SOUTH);
|
||||
tryHorizontalConnection(horizontalConnections, tankW, EnumFacing.WEST);
|
||||
tryHorizontalConnection(horizontalConnections, tankE, EnumFacing.EAST);
|
||||
|
||||
tryCornerConnection(diagonalConnections, tankN, tankNW, tankW, Diagonal.NW);
|
||||
tryCornerConnection(diagonalConnections, tankW, tankSW, tankS, Diagonal.SW);
|
||||
tryCornerConnection(diagonalConnections, tankE, tankNE, tankN, Diagonal.NE);
|
||||
tryCornerConnection(diagonalConnections, tankS, tankSE, tankE, Diagonal.SE);
|
||||
|
||||
return new TankConnections(tank, diagonalConnections, horizontalConnections, topConnection, bottomConnection);
|
||||
}
|
||||
|
||||
public void initialize(World world, BlockPos pos) {
|
||||
this.phase = TankRenderUtils.calculatePhase(pos.getX(), pos.getY(), pos.getZ());
|
||||
|
||||
this.world = world;
|
||||
this.pos = pos;
|
||||
|
||||
updateConnections();
|
||||
}
|
||||
if (this.connections != null) connections.detach();
|
||||
|
||||
public void clearConnections() {
|
||||
for (Map.Entry<Diagonal, DiagonalConnection> e : diagonalConnections.entrySet())
|
||||
e.getValue().clearFluid(e.getKey().getOpposite());
|
||||
|
||||
diagonalConnections.clear();
|
||||
|
||||
for (Map.Entry<EnumFacing, HorizontalConnection> e : horizontalConnections.entrySet())
|
||||
e.getValue().clearFluid(e.getKey().getOpposite());
|
||||
|
||||
horizontalConnections.clear();
|
||||
|
||||
if (topConnection != null) {
|
||||
topConnection.clearBottomFluid();
|
||||
topConnection = null;
|
||||
}
|
||||
|
||||
if (bottomConnection != null) {
|
||||
bottomConnection.clearTopFluid();
|
||||
bottomConnection = null;
|
||||
if (world == null) {
|
||||
this.connections = null;
|
||||
this.renderData = null;
|
||||
} else {
|
||||
float phase = TankRenderUtils.calculatePhase(pos.getX(), pos.getY(), pos.getZ());
|
||||
this.connections = updateConnections();
|
||||
this.renderData = new TankRenderFluidData(connections, tank, phase);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkConnection(RenderConnection connection, EnumFacing dir) {
|
||||
return connection == null || !connection.check(pos, dir);
|
||||
public void validateConnections(World world, BlockPos pos) {
|
||||
if (world != this.world || connections == null || !connections.checkConsistency(pos))
|
||||
initialize(world, pos);
|
||||
}
|
||||
|
||||
private boolean checkConnection(RenderConnection connection, Diagonal dir) {
|
||||
return connection == null || !connection.check(pos, dir);
|
||||
public void invalidateConnections() {
|
||||
if (this.connections != null) connections.detach();
|
||||
this.connections = null;
|
||||
this.renderData = null;
|
||||
}
|
||||
|
||||
private boolean checkHorizontalConnection(EnumFacing dir) {
|
||||
return checkConnection(horizontalConnections.get(dir), dir);
|
||||
public void updateFluid(FluidStack stack) {
|
||||
if (connections != null) connections.updateFluid(stack);
|
||||
}
|
||||
|
||||
private boolean checkDiagonalConnection(Diagonal dir) {
|
||||
return checkConnection(diagonalConnections.get(dir), dir);
|
||||
public ITankRenderFluidData getTankRenderData() {
|
||||
return renderData;
|
||||
}
|
||||
|
||||
private boolean checkConnections() {
|
||||
return checkConnection(topConnection, EnumFacing.UP) ||
|
||||
checkConnection(bottomConnection, EnumFacing.DOWN) ||
|
||||
checkConnection(topConnection, EnumFacing.UP) ||
|
||||
checkHorizontalConnection(EnumFacing.NORTH) ||
|
||||
checkHorizontalConnection(EnumFacing.SOUTH) ||
|
||||
checkHorizontalConnection(EnumFacing.EAST) ||
|
||||
checkHorizontalConnection(EnumFacing.WEST) ||
|
||||
checkDiagonalConnection(Diagonal.NE) ||
|
||||
checkDiagonalConnection(Diagonal.NW) ||
|
||||
checkDiagonalConnection(Diagonal.SE) ||
|
||||
checkDiagonalConnection(Diagonal.SW);
|
||||
|
||||
}
|
||||
|
||||
public void validateConnections() {
|
||||
if (checkConnections()) {
|
||||
clearConnections();
|
||||
updateConnections();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateFluid(FluidStack fluidStack) {
|
||||
for (Map.Entry<Diagonal, DiagonalConnection> e : diagonalConnections.entrySet())
|
||||
e.getValue().updateFluid(e.getKey().getOpposite(), fluidStack);
|
||||
|
||||
for (Map.Entry<EnumFacing, HorizontalConnection> e : horizontalConnections.entrySet())
|
||||
e.getValue().updateFluid(e.getKey().getOpposite(), fluidStack);
|
||||
|
||||
topConnection.updateBottomFluid(fluidStack, tank.getSpace() == 0);
|
||||
bottomConnection.updateTopFluid(fluidStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRenderFluidWall(EnumFacing side) {
|
||||
switch (side) {
|
||||
case DOWN:
|
||||
return !isConnected(bottomConnection);
|
||||
case UP:
|
||||
return !isConnected(topConnection);
|
||||
case EAST:
|
||||
case WEST:
|
||||
case NORTH:
|
||||
case SOUTH: {
|
||||
return !isConnected(horizontalConnections.get(side));
|
||||
}
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFluid() {
|
||||
return tank.getFluidAmount() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack getFluid() {
|
||||
return tank.getFluid();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCenterFluidLevel(float time) {
|
||||
final float raw = (float)tank.getFluidAmount() / tank.getCapacity();
|
||||
final float waving = TankRenderUtils.calculateWaveAmplitude(time, phase) + raw;
|
||||
return TankRenderUtils.clampLevel(waving);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getCornerFluidLevel(Diagonal corner, float time) {
|
||||
final DiagonalConnection diagonal = diagonalConnections.get(corner);
|
||||
return diagonal != null? diagonal.getRenderHeight(corner.getOpposite(), time) : getCenterFluidLevel(time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalConnection getTopConnection() {
|
||||
return topConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VerticalConnection getBottomConnection() {
|
||||
return bottomConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HorizontalConnection getHorizontalConnection(EnumFacing dir) {
|
||||
return horizontalConnections.get(dir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DiagonalConnection getDiagonalConnection(Diagonal dir) {
|
||||
return diagonalConnections.get(dir);
|
||||
public ITankConnections getTankConnections() {
|
||||
return connections;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package openblocks.client.renderer.tileentity.tank;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraft.world.chunk.Chunk.EnumCreateEntityType;
|
||||
|
|
|
@ -0,0 +1,232 @@
|
|||
package openblocks.common;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.LineUnavailableException;
|
||||
import javax.sound.sampled.SourceDataLine;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import openmods.Log;
|
||||
|
||||
public class BeepGenerator {
|
||||
|
||||
private static final int SAMPLE_RATE = 44100;
|
||||
|
||||
private static final int SAMPLES_PER_BUFFER = SAMPLE_RATE / 8;
|
||||
|
||||
private static final int BYTES_PER_SAMPLE = 2;
|
||||
|
||||
private static final int BYTES_PER_BUFFER = BYTES_PER_SAMPLE * SAMPLES_PER_BUFFER;
|
||||
|
||||
private static final double BUFFER_DURATION = (double)SAMPLES_PER_BUFFER / SAMPLE_RATE;
|
||||
|
||||
private static final double FREQUENCY_MAX_CHANGE_PER_BUFFER_DURATION = 50.0;
|
||||
|
||||
private final byte[] scratchBuffer = new byte[BYTES_PER_BUFFER];
|
||||
|
||||
private static final byte[] ZERO_BUFFER = new byte[BYTES_PER_BUFFER];
|
||||
|
||||
private short volume = 2560;
|
||||
|
||||
private double wavePhase;
|
||||
private int beepPhase;
|
||||
|
||||
private double toneFrequency;
|
||||
private double targetToneFrequency;
|
||||
private double beepFrequency;
|
||||
private int samplesPerBeep;
|
||||
|
||||
private class WriterThread extends Thread {
|
||||
|
||||
private final SourceDataLine line;
|
||||
|
||||
private boolean running = true;
|
||||
|
||||
public WriterThread(SourceDataLine line) {
|
||||
this.line = line;
|
||||
setDaemon(true);
|
||||
setName("Beeper thread");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
line.start();
|
||||
|
||||
try {
|
||||
while (running) {
|
||||
final int available = line.available();
|
||||
|
||||
if (available >= SAMPLES_PER_BUFFER)
|
||||
writeSample(line);
|
||||
|
||||
try {
|
||||
Thread.sleep(100); // has to be lower than SAMPLES_PER_BUFFER / SAMPLE_RATE
|
||||
} catch (InterruptedException e) {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
running = false;
|
||||
line.close();
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isShuttingDown() {
|
||||
return !running;
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
running = false;
|
||||
}
|
||||
}
|
||||
|
||||
private WriterThread writerThread;
|
||||
|
||||
public synchronized void start() {
|
||||
wavePhase = 0;
|
||||
beepPhase = 0;
|
||||
|
||||
if (!isRunning()) {
|
||||
final AudioFormat af = new AudioFormat(SAMPLE_RATE, 8 * BYTES_PER_SAMPLE, 1, true, true);
|
||||
try {
|
||||
SourceDataLine line = AudioSystem.getSourceDataLine(af);
|
||||
line.open(af, SAMPLE_RATE);
|
||||
writerThread = new WriterThread(line);
|
||||
writerThread.start();
|
||||
} catch (LineUnavailableException e) {
|
||||
Log.warn(e, "Failed to initialize beeper");
|
||||
if (writerThread != null) writerThread.shutdown();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
if (writerThread != null) writerThread.shutdown();
|
||||
setTargetToneFrequency(0d);
|
||||
setBeepFrequency(0d);
|
||||
}
|
||||
|
||||
public synchronized boolean isRunning() {
|
||||
return writerThread != null && writerThread.isAlive() && !writerThread.isShuttingDown();
|
||||
}
|
||||
|
||||
private void writeSample(SourceDataLine line) {
|
||||
final double lastToneFrequency;
|
||||
|
||||
if (this.toneFrequency == 0d || this.targetToneFrequency == 0d) {
|
||||
lastToneFrequency = this.targetToneFrequency;
|
||||
this.toneFrequency = this.targetToneFrequency;
|
||||
} else {
|
||||
lastToneFrequency = this.toneFrequency;
|
||||
final double delta = this.targetToneFrequency - this.toneFrequency;
|
||||
this.toneFrequency += limit(delta, FREQUENCY_MAX_CHANGE_PER_BUFFER_DURATION);
|
||||
}
|
||||
|
||||
byte[] buffer = generateSamplesWithSweep(lastToneFrequency, this.toneFrequency);
|
||||
line.write(buffer, 0, buffer.length);
|
||||
}
|
||||
|
||||
private static double limit(double value, double limit) {
|
||||
if (value < 0)
|
||||
return Math.max(value, -limit);
|
||||
else
|
||||
return Math.min(value, limit);
|
||||
}
|
||||
|
||||
private byte[] generateSamplesWithSweep(double f0, double f1) {
|
||||
if (f0 == 0.0 && f1 == 0.0)
|
||||
return ZERO_BUFFER;
|
||||
|
||||
final float masterSoundLevel = Minecraft.getMinecraft().gameSettings.getSoundLevel(SoundCategory.MASTER);
|
||||
|
||||
if (masterSoundLevel == 0)
|
||||
return ZERO_BUFFER;
|
||||
|
||||
final float amplitude = Math.max(volume * masterSoundLevel, 2);
|
||||
|
||||
final double sweepDuration = BUFFER_DURATION;
|
||||
|
||||
// see 'chirp' on wiki for explanation of constants
|
||||
final double k = (f1 - f0) / sweepDuration;
|
||||
|
||||
int sampleCount = 0;
|
||||
|
||||
if (samplesPerBeep == 0) {
|
||||
for (int i = 0; i < BYTES_PER_BUFFER; i += BYTES_PER_SAMPLE, sampleCount++) {
|
||||
final short v = (short)calculateSample(amplitude, wavePhase, f0, k, sampleToRealTime(sampleCount));
|
||||
writeShortSample(scratchBuffer, i, v);
|
||||
}
|
||||
} else {
|
||||
int beepSample = beepPhase;
|
||||
for (int i = 0; i < BYTES_PER_BUFFER; i += BYTES_PER_SAMPLE, sampleCount++) {
|
||||
if (beepSample < samplesPerBeep) {
|
||||
final short v = (short)calculateSample(amplitude, wavePhase, f0, k, sampleToRealTime(sampleCount));
|
||||
writeShortSample(scratchBuffer, i, v);
|
||||
} else {
|
||||
scratchBuffer[i] = 0;
|
||||
scratchBuffer[i + 1] = 0;
|
||||
}
|
||||
|
||||
if (beepSample++ >= 2 * samplesPerBeep)
|
||||
beepSample = 0;
|
||||
}
|
||||
beepPhase = beepSample;
|
||||
}
|
||||
|
||||
wavePhase = phase(wavePhase, f0, k, sampleToRealTime(sampleCount)) % (2 * Math.PI);
|
||||
return scratchBuffer;
|
||||
|
||||
}
|
||||
|
||||
private static void writeShortSample(byte[] buf, int i, final short v) {
|
||||
buf[i] = (byte)(v >> 8);
|
||||
buf[i + 1] = (byte)(v);
|
||||
}
|
||||
|
||||
private static double sampleToRealTime(int sampleCount) {
|
||||
return (double)sampleCount / SAMPLE_RATE;
|
||||
}
|
||||
|
||||
private static double calculateSample(float amplitude, double phase0, double f0, double k, double t) {
|
||||
return (short)(amplitude * Math.sin(phase(phase0, f0, k, t)));
|
||||
}
|
||||
|
||||
private static double phase(double phase0, double f0, double k, double t) {
|
||||
return phase0 + 2.0 * Math.PI * (f0 + k / 2.0 * t) * t;
|
||||
}
|
||||
|
||||
public short getVolume() {
|
||||
return volume;
|
||||
}
|
||||
|
||||
public void setVolume(short volume) {
|
||||
this.volume = volume;
|
||||
}
|
||||
|
||||
public double getToneFrequency() {
|
||||
return toneFrequency;
|
||||
}
|
||||
|
||||
public double getTargetToneFrequency() {
|
||||
return this.targetToneFrequency;
|
||||
}
|
||||
|
||||
public void setTargetToneFrequency(double frequency) {
|
||||
this.targetToneFrequency = frequency;
|
||||
}
|
||||
|
||||
public double getBeepFrequency() {
|
||||
return beepFrequency;
|
||||
}
|
||||
|
||||
public void setBeepFrequency(double beepFrequency) {
|
||||
this.beepFrequency = beepFrequency;
|
||||
|
||||
if (beepFrequency == 0) {
|
||||
samplesPerBeep = 0;
|
||||
} else {
|
||||
samplesPerBeep = (int)(SAMPLE_RATE / beepFrequency);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -2,26 +2,28 @@ package openblocks.common;
|
|||
|
||||
import static openmods.utils.CommandUtils.filterPrefixes;
|
||||
import static openmods.utils.CommandUtils.fiterPlayerNames;
|
||||
import static openmods.utils.CommandUtils.getPlayer;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import java.io.File;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.command.*;
|
||||
import net.minecraft.command.CommandBase;
|
||||
import net.minecraft.command.CommandException;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.command.ICommandSender;
|
||||
import net.minecraft.command.SyntaxErrorException;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import openblocks.api.InventoryEvent.SubInventory;
|
||||
import openblocks.common.PlayerInventoryStore.LoadedInventories;
|
||||
import openmods.Log;
|
||||
import openmods.utils.BlockUtils;
|
||||
import openmods.utils.InventoryUtils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
public class CommandInventory implements ICommand {
|
||||
|
||||
private static final String COMMAND_RESTORE = "restore";
|
||||
|
@ -59,7 +61,7 @@ public class CommandInventory implements ICommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void processCommand(ICommandSender sender, String[] args) throws CommandException {
|
||||
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
|
||||
if (args.length < 1) throw new SyntaxErrorException();
|
||||
|
||||
String subCommand = args[0];
|
||||
|
@ -68,7 +70,7 @@ public class CommandInventory implements ICommand {
|
|||
if (args.length != 3) throw new SyntaxErrorException();
|
||||
String playerName = args[1];
|
||||
String id = args[2];
|
||||
EntityPlayerMP player = getPlayer(sender, playerName);
|
||||
EntityPlayerMP player = CommandBase.getPlayer(server, sender, playerName);
|
||||
|
||||
final boolean success;
|
||||
try {
|
||||
|
@ -78,16 +80,16 @@ public class CommandInventory implements ICommand {
|
|||
throw new CommandException("openblocks.misc.cant_restore_player", playerName);
|
||||
}
|
||||
|
||||
if (success) sender.addChatMessage(new ChatComponentTranslation("openblocks.misc.restored_inventory", playerName));
|
||||
if (success) sender.addChatMessage(new TextComponentTranslation("openblocks.misc.restored_inventory", playerName));
|
||||
else throw new CommandException("openblocks.misc.cant_restore_player", playerName);
|
||||
|
||||
} else if (subCommand.equalsIgnoreCase(COMMAND_STORE)) {
|
||||
if (args.length != 2) throw new SyntaxErrorException();
|
||||
String playerName = args[1];
|
||||
EntityPlayerMP player = getPlayer(sender, playerName);
|
||||
EntityPlayerMP player = CommandBase.getPlayer(server, sender, playerName);
|
||||
try {
|
||||
File result = PlayerInventoryStore.instance.storePlayerInventory(player, "command");
|
||||
sender.addChatMessage(new ChatComponentTranslation(
|
||||
sender.addChatMessage(new TextComponentTranslation(
|
||||
"openblocks.misc.stored_inventory",
|
||||
result.getAbsolutePath()));
|
||||
} catch (Exception e) {
|
||||
|
@ -98,7 +100,7 @@ public class CommandInventory implements ICommand {
|
|||
if (args.length != 2 && args.length != 3 && args.length != 4) throw new SyntaxErrorException();
|
||||
final String id = args[1];
|
||||
|
||||
final String target = (args.length > 1)? args[2] : ID_MAIN_INVENTORY;
|
||||
final String target = (args.length > 2)? args[2] : ID_MAIN_INVENTORY;
|
||||
|
||||
LoadedInventories loadedInventories = loadInventories(sender, id);
|
||||
if (loadedInventories == null) throw new CommandException("openblocks.misc.cant_restore_inventory");
|
||||
|
@ -156,12 +158,12 @@ public class CommandInventory implements ICommand {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean canCommandSenderUseCommand(ICommandSender sender) {
|
||||
public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
|
||||
return sender.canCommandSenderUseCommand(4, NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
|
||||
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, BlockPos pos) {
|
||||
if (args.length == 0) return null;
|
||||
if (args.length == 1) return filterPrefixes(args[0], SUB_COMMANDS);
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package openblocks.common;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import openblocks.common.entity.EntityMagnet;
|
||||
|
||||
import com.google.common.collect.MapMaker;
|
||||
|
||||
public class CraneRegistry {
|
||||
private static final double MIN_LENGTH = 0.25;
|
||||
private static final double MAX_LENGTH = 10;
|
||||
|
@ -23,7 +22,7 @@ public class CraneRegistry {
|
|||
public double prevPosY;
|
||||
public double prevPosZ;
|
||||
|
||||
private Data(EntityPlayer player) {
|
||||
private Data(EntityLivingBase player) {
|
||||
prevYaw = player.rotationYaw;
|
||||
prevPosX = player.posX;
|
||||
prevPosY = player.posY;
|
||||
|
@ -36,11 +35,12 @@ public class CraneRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
private Map<EntityPlayer, Data> itemData = new MapMaker().weakKeys().makeMap();
|
||||
private Map<EntityPlayer, EntityMagnet> playersMagnets = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
// TODO does it need two separate collections?
|
||||
private Map<EntityLivingBase, Data> itemData = new MapMaker().weakKeys().makeMap();
|
||||
private Map<EntityLivingBase, EntityMagnet> magnetOwners = new MapMaker().weakKeys().weakValues().makeMap();
|
||||
|
||||
public void ensureMagnetExists(EntityPlayer player) {
|
||||
EntityMagnet magnet = playersMagnets.get(player);
|
||||
public void ensureMagnetExists(EntityLivingBase player) {
|
||||
EntityMagnet magnet = magnetOwners.get(player);
|
||||
|
||||
if (magnet == null || magnet.isDead) {
|
||||
createMagnetForPlayer(player);
|
||||
|
@ -50,18 +50,18 @@ public class CraneRegistry {
|
|||
}
|
||||
}
|
||||
|
||||
private static EntityMagnet createMagnetForPlayer(EntityPlayer player) {
|
||||
private static EntityMagnet createMagnetForPlayer(EntityLivingBase player) {
|
||||
EntityMagnet result = new EntityMagnet.PlayerBound(player.worldObj, player);
|
||||
player.worldObj.spawnEntityInWorld(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
public EntityMagnet getMagnetForPlayer(EntityPlayer player) {
|
||||
return playersMagnets.get(player);
|
||||
public EntityMagnet getMagnetForPlayer(EntityLivingBase player) {
|
||||
return magnetOwners.get(player);
|
||||
}
|
||||
|
||||
public void bindMagnetToPlayer(Entity owner, EntityMagnet magnet) {
|
||||
if (owner instanceof EntityPlayer) playersMagnets.put((EntityPlayer)owner, magnet);
|
||||
if (owner instanceof EntityPlayer) magnetOwners.put((EntityPlayer)owner, magnet);
|
||||
}
|
||||
|
||||
public static final double ARM_RADIUS = 2.0;
|
||||
|
@ -70,7 +70,7 @@ public class CraneRegistry {
|
|||
|
||||
private CraneRegistry() {}
|
||||
|
||||
public Data getData(EntityPlayer player, boolean canCreate) {
|
||||
public Data getData(EntityLivingBase player, boolean canCreate) {
|
||||
Data result = itemData.get(player);
|
||||
|
||||
if (result == null && canCreate) {
|
||||
|
@ -81,7 +81,7 @@ public class CraneRegistry {
|
|||
return result;
|
||||
}
|
||||
|
||||
public double getCraneMagnetDistance(EntityPlayer player) {
|
||||
public double getCraneMagnetDistance(EntityLivingBase player) {
|
||||
Data data = getData(player, false);
|
||||
return data != null? data.length : MIN_LENGTH;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package openblocks.common;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import openmods.Mods;
|
||||
|
||||
public class DonationUrlManager {
|
||||
|
|
|
@ -1,23 +1,28 @@
|
|||
package openblocks.common;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.util.*;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import openblocks.Config;
|
||||
import openblocks.OpenBlocks;
|
||||
import openblocks.api.IElevatorBlock;
|
||||
import openblocks.api.IElevatorBlock.PlayerRotation;
|
||||
import openblocks.events.ElevatorActionEvent;
|
||||
import openmods.movement.PlayerMovementEvent;
|
||||
import openmods.utils.EnchantmentUtils;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
public class ElevatorActionHandler {
|
||||
|
||||
private static class SearchResult extends BlockPos {
|
||||
|
@ -34,9 +39,7 @@ public class ElevatorActionHandler {
|
|||
|
||||
if (!Config.irregularBlocksArePassable) return false;
|
||||
final IBlockState blockState = world.getBlockState(pos);
|
||||
final Block block = blockState.getBlock();
|
||||
|
||||
final AxisAlignedBB aabb = block.getCollisionBoundingBox(world, pos, blockState);
|
||||
final AxisAlignedBB aabb = blockState.getCollisionBoundingBox(world, pos);
|
||||
return aabb == null || aabb.getAverageEdgeLength() < 0.7;
|
||||
}
|
||||
|
||||
|
@ -78,7 +81,7 @@ public class ElevatorActionHandler {
|
|||
}
|
||||
|
||||
if (!Config.elevatorIgnoreBlocks) {
|
||||
ElevatorBlockRules.Action action = ElevatorBlockRules.instance.getActionForBlock(block);
|
||||
ElevatorBlockRules.Action action = ElevatorBlockRules.instance.getActionForBlock(blockState);
|
||||
switch (action) {
|
||||
case ABORT:
|
||||
return null;
|
||||
|
@ -105,7 +108,7 @@ public class ElevatorActionHandler {
|
|||
if (result.rotation != PlayerRotation.NONE) player.rotationYaw = getYaw(result.rotation);
|
||||
if (Config.elevatorCenter) player.setPositionAndUpdate(result.getX() + 0.5, result.getY() + 1.1, result.getZ() + 0.5);
|
||||
else player.setPositionAndUpdate(player.posX, result.getY() + 1.1, player.posZ);
|
||||
world.playSoundAtEntity(player, "openblocks:elevator.activate", 1, 1);
|
||||
world.playSound(null, player.getPosition(), OpenBlocks.Sounds.BLOCK_ELEVATOR_ACTIVATE, SoundCategory.BLOCKS, 1, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -147,7 +150,7 @@ public class ElevatorActionHandler {
|
|||
if (!(blockState.getBlock() instanceof IElevatorBlock)) return;
|
||||
|
||||
if (evt.sender != null) {
|
||||
if (evt.sender.ridingEntity != null) return;
|
||||
if (evt.sender.isRiding()) return;
|
||||
|
||||
switch (evt.type) {
|
||||
case JUMP:
|
||||
|
@ -163,7 +166,7 @@ public class ElevatorActionHandler {
|
|||
@SubscribeEvent
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onPlayerMovement(PlayerMovementEvent evt) {
|
||||
final EntityPlayer player = evt.entityPlayer;
|
||||
final EntityPlayer player = evt.getEntityPlayer();
|
||||
if (player == null) return;
|
||||
|
||||
final World world = player.worldObj;
|
||||
|
@ -175,7 +178,7 @@ public class ElevatorActionHandler {
|
|||
final BlockPos pos = new BlockPos(x, y, z);
|
||||
final Block block = world.getBlockState(pos).getBlock();
|
||||
|
||||
if (block instanceof IElevatorBlock) new ElevatorActionEvent(world.provider.getDimensionId(), pos, evt.type).sendToServer();
|
||||
if (block instanceof IElevatorBlock) new ElevatorActionEvent(world.provider.getDimension(), pos, evt.type).sendToServer();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package openblocks.common;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
import openblocks.Config;
|
||||
import openmods.Log;
|
||||
import openmods.config.properties.ConfigurationChange;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
import openblocks.Config;
|
||||
import openmods.Log;
|
||||
import openmods.config.properties.ConfigurationChange;
|
||||
|
||||
public class ElevatorBlockRules {
|
||||
|
||||
|
@ -63,9 +63,9 @@ public class ElevatorBlockRules {
|
|||
|
||||
Preconditions.checkNotNull(action, "Unknown action: %s", actionName);
|
||||
|
||||
Block block = GameRegistry.findBlock(modId, blockName);
|
||||
Block block = Block.REGISTRY.getObject(new ResourceLocation(modId, blockName));
|
||||
|
||||
if (block != null) rules.put(block, action);
|
||||
if (block != Blocks.AIR) rules.put(block, action);
|
||||
else Log.warn("Can't find block %s", entry);
|
||||
}
|
||||
|
||||
|
@ -74,16 +74,15 @@ public class ElevatorBlockRules {
|
|||
if (evt.check("dropblock", "specialBlockRules")) rules = null;
|
||||
}
|
||||
|
||||
private static boolean isPassable(Block block) {
|
||||
return Config.elevatorIgnoreHalfBlocks && !block.isNormalCube();
|
||||
private static boolean isPassable(IBlockState state) {
|
||||
return Config.elevatorIgnoreHalfBlocks && !state.isNormalCube();
|
||||
}
|
||||
|
||||
public Action getActionForBlock(Block block) {
|
||||
if (block == null) return Action.IGNORE;
|
||||
Action action = getRules().get(block);
|
||||
public Action getActionForBlock(IBlockState state) {
|
||||
Action action = getRules().get(state.getBlock());
|
||||
if (action != null) return action;
|
||||
|
||||
return isPassable(block)? Action.IGNORE : Action.INCREMENT;
|
||||
return isPassable(state)? Action.IGNORE : Action.INCREMENT;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package openblocks.common;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityList;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
@ -16,8 +16,6 @@ import openmods.config.properties.ConfigurationChange;
|
|||
import openmods.utils.BlockUtils;
|
||||
import openmods.utils.PlayerUtils;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
public class EntityEventHandler {
|
||||
|
||||
public static final String OPENBLOCKS_PERSIST_TAG = "OpenBlocks";
|
||||
|
@ -33,13 +31,13 @@ public class EntityEventHandler {
|
|||
Set<String> unknownNames = Sets.newHashSet();
|
||||
for (String name : Config.disableMobNames) {
|
||||
|
||||
Class<? extends Entity> cls = EntityList.stringToClassMapping.get(name);
|
||||
Class<? extends Entity> cls = EntityList.NAME_TO_CLASS.get(name);
|
||||
if (cls != null) entityBlacklist.add(cls);
|
||||
else unknownNames.add(name);
|
||||
}
|
||||
|
||||
// using Class.forName is unsafe
|
||||
for (Class<? extends Entity> cls : EntityList.classToStringMapping.keySet()) {
|
||||
for (Class<? extends Entity> cls : EntityList.CLASS_TO_NAME.keySet()) {
|
||||
if (unknownNames.isEmpty()) break;
|
||||
if (unknownNames.remove(cls.getName())) entityBlacklist.add(cls);
|
||||
}
|
||||
|
@ -58,7 +56,7 @@ public class EntityEventHandler {
|
|||
@SubscribeEvent
|
||||
public void onEntityJoinWorld(EntityJoinWorldEvent event) {
|
||||
|
||||
final Entity entity = event.entity;
|
||||
final Entity entity = event.getEntity();
|
||||
if (entity != null) {
|
||||
Set<Class<? extends Entity>> blacklist = getBlacklist();
|
||||
if (blacklist.contains(entity.getClass())) {
|
||||
|
@ -72,7 +70,7 @@ public class EntityEventHandler {
|
|||
* If the player hasn't been given a manual, we'll give him one! (or
|
||||
* throw it on the floor..)
|
||||
*/
|
||||
if (Config.spamInfoBook && !event.world.isRemote && entity instanceof EntityPlayer) {
|
||||
if (Config.spamInfoBook && !event.getWorld().isRemote && entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer)entity;
|
||||
NBTTagCompound persistTag = PlayerUtils.getModPlayerPersistTag(player, "OpenBlocks");
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue