Merge master

This commit is contained in:
Vincent Lee committed 2019-01-16 14:46:30 -06:00
commit eaaa55fdb0
254 files changed
+8593 -1893

No files matched your search

Vendored
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env groovy
pipeline {
agent any
stages {
stage('Clean') {
steps {
echo 'Cleaning Project'
sh 'chmod +x gradlew'
sh './gradlew clean'
}
}
stage('Setup') {
steps {
echo 'Setting up Workspace'
sh './gradlew setupCIWorkspace'
}
}
stage('Build and Deploy') {
steps {
echo 'Building and Deploying to Maven'
sh './gradlew build sort uploadArchives'
}
}
}
post {
always {
archive 'build/libs/**.jar'
}
}
}
+1 -1
View File
@@ -1,2 +1,2 @@
sh gradlew
gradlew.bat
pause
+98 -83
View File
@@ -1,6 +1,3 @@
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
buildscript {
repositories {
mavenCentral()
@@ -21,12 +18,19 @@ buildscript {
repositories {
mavenCentral()
maven {
name = "buildcraft"
url = "https://mod-buildcraft.com/maven"
}
maven {
name = "thiakil"
url = "http://maven.thiakil.com"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
url = "http://dvs1.progwml6.com/files/maven"
}
maven {
url = "http://minecraft.curseforge.com/api/maven/"
}
}
@@ -43,6 +47,11 @@ version = "${config.version}-${config.build_number}"
group = "vazkii.botania" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = config.mod_name
if (System.getenv().BUILD_NUMBER != null) {
//adds the build number to the end of the version string if on a build server
version += ".${System.getenv().BUILD_NUMBER}"
}
minecraft {
version = "${config.mc_version}-${config.forge_version}"
runDir = "eclipse/assets"
@@ -66,15 +75,23 @@ configurations {
//End of the SCP config
jar {
classifier = 'universal'
manifest {
attributes 'FMLAT': 'botania_at.cfg'
}
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName} ${version}.${extension}"
exclude "**/*.bat"
exclude "**/*.psd"
exclude "**/*.exe"
}
dependencies {
deobfCompile "com.mod-buildcraft:buildcraft-api:7.99.17"
deobfCompile "com.azanor.baubles:Baubles:1.12-1.5.2"
deobfCompile "mezz.jei:jei_1.12:4.7.0.67"
deobfCompile "mezz.jei:jei_1.12.2:4.13.1.220"
deobfCompile "thaumcraft:Thaumcraft:1.12.2:6.1.BETA26"
//and a bit more for SCP
sshAntTask "org.apache.ant:ant-jsch:1.7.1", "jsch:jsch:0.1.29"
@@ -103,89 +120,88 @@ processResources {
}
}
/**
* These, go outside of the processResources {}* Though, this was added with the NEI intergation commit (8bf4680)
*/
task deobfJar(type: Jar) {
from(sourceSets.main.output)
archiveName = "${baseName} ${version}-deobf.${extension}"
}
artifacts {
archives deobfJar
task srcJar(type: Jar) {
from(sourceSets.main.java)
classifier = 'sources'
archiveName = "${baseName} ${version}-sources.${extension}"
}
task apiJar(type: Jar) {
// Remove sources from the api jar when MinecraftForge/ForgeGradle#369 is fixed
from(sourceSets.main.allJava)
from(sourceSets.main.output)
include 'vazkii/botania/api/**'
classifier = 'api'
archiveName = "${baseName} ${version}-api.${extension}"
}
artifacts {
archives srcJar, apiJar
}
/**
* Increments the buildnumber in your config file, and saves it
* Note: The doFirst is important, without it the build number
* will be incremented every time tasks are configured, i.e every
* time gradle is run on this project.
*/
task incrementBuildNumber(dependsOn: 'reobfJar') << {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
task incrementBuildNumber {
doFirst {
config.build_number = (config.build_number.toString().toInteger()) + 1
configFile.withWriter {
config.toProperties().store(it, "")
}
// todo make this flexibile - collection of supported mc versions
file('web/versions.ini').append("\n${version}=${minecraft.version}")
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
}
// todo make this flexibile - collection of supported mc versions
file('web/versions.ini').append("\n${version}=${minecraft.version}")
file("${config.dir_repo}/version/${minecraft.version}.txt").write("${version}")
}
// I have no idea what I'm doing
task wtfGradle2(type: Copy) {
from(jar.destinationDir)
into file("${config.dir_output}/wtf")
}
// Seriously, I'm desperate to make this work
task wtfGradle1(type: Delete) {
dependsOn "wtfGradle2"
delete "${config.dir_output}/wtf/${deobfJar.archiveName}"
}
import java.util.regex.Pattern
task output(type: Copy) {
dependsOn "wtfGradle1"
from(jar.destinationDir)
into file(config.dir_output)
}
task outputDeobf(type: Copy) {
dependsOn "output"
from(config.dir_output) {
include deobfJar.archiveName
}
into file("${config.dir_output}/deobf")
}
task forgecraft(type: Copy) {
dependsOn "outputDeobf"
from "${config.dir_output}/wtf"
into file(priv.dir_forgecraft)
}
task sort(type: Delete) {
dependsOn "forgecraft"
delete "${config.dir_output}/${deobfJar.archiveName}", "${config.dir_output}/wtf"
task sortArtifacts(type: Copy) {
from jar.destinationDir
into config.dir_output
//Put each jar with a classifier in a subfolder with the classifier as its name
eachFile {
//This matcher is used to get the classifier of the jar
def matcher = Pattern.compile("$config.mod_name $version-(?<classifier>\\w+).jar").matcher(it.name)
//Only change the destination for full matches, i.e jars with classifiers
if (matcher.matches())
{
def classifier = matcher.group('classifier')
/* Set the relative path to change the destination, since
* Gradle doesn't seem to like the absolute path being set*/
it.relativePath = it.relativePath.parent.append(false, classifier, it.name)
}
}
}
// This is the upload task from the build.xml
task upload() << {
scp('/files') {
fileset(file: jar.archivePath)
}
scp('/files/deobf') {
fileset(file: deobfJar.archivePath)
}
scp('/') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
task upload {
doLast {
scp('/') {
fileset(file: 'web/changelog.txt')
fileset(file: 'web/versions.ini')
}
}
}
// This is deploy_web task
task deployWeb << {
scp('/') {
fileset(dir: 'web') //everything from the web directory
task deployWeb {
doLast {
scp('/') {
fileset(dir: 'web') //everything from the web directory
}
}
}
@@ -213,23 +229,21 @@ def scp(String dir, Closure antFileset = {}) {
def parseConfig(File config) {
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
}
jar {
//rename the default output, for some better... sanity with scipts
archiveName = "${baseName} ${version}.${extension}"
exclude "**/*.bat"
exclude "**/*.psd"
exclude "**/*.exe"
if(config.exists()){
config.withReader {
def prop = new Properties()
prop.load(it)
return (new ConfigSlurper().parse(prop))
}
} else {
return null
}
}
curseforge {
if(priv == null){
return
}
apiKey = priv.cfkey
project {
id = "225643"
@@ -253,5 +267,6 @@ uploadArchives {
}
}
}
tasks.uploadArchives.dependsOn reobfJar
defaultTasks 'clean', 'build', 'sort', 'forgecraft', 'incrementBuildNumber', 'curseforge', 'upload'
defaultTasks 'clean', 'build', 'sortArtifacts', 'incrementBuildNumber', 'upload'
+4 -4
View File
@@ -1,11 +1,11 @@
#
#Fri Jan 26 22:35:53 GMT 2018
#Fri Nov 30 05:12:11 GMT 2018
mod_name=Botania
cf_meta_version=1.12.2
forge_version=14.23.1.2555
forge_version=14.23.5.2768
dir_repo=./
mc_mappings=snapshot_20171217
mc_mappings=stable_39
version=r1.10
dir_output=../Build Output/Botania/
build_number=354
mc_version=1.12.2
build_number=359
+69 -9
View File
@@ -1,19 +1,16 @@
# Devs
#vazkii=6
vazkii=6
wiiv=marimorphosis
dylangk=munchdew
# Cool People
sl1pg8r=endoflame
direwolf20=thermalily
#wayofflowingtime=fallenKanade
wtfgeeks=daybloom
spitefulfox=tainthistle
gideonseymour=arcaneRose
#pahimar=medumone
gideonseymour=arcanerose
# Flower Designers
jadedcat=jadedAmaranthus
jadedcat=jadedamaranthus
pokefenn=hydroangeas
finvaara=bubbell
flaxbeard=kekimurus
@@ -54,7 +51,7 @@ swiftlileagle=14
gryphonn=11
loraanicus=10
samerater=8
coolcabbage16=13
coolcabbage16=hopperhock
eladkay=3
tobiasling=9
hysting=10
@@ -68,7 +65,7 @@ mstiles92=2
ninjax11=0
modapi=0
spectacular101=0
tamaized=6
tamaized=entropinnyum
lerazzer=10
akirakujo=5
solarcis=12
@@ -81,7 +78,7 @@ ydyt=6
tbnrsuns=2
vectored_pixels=2
egoisticalgoat=6
konotyran=12
konotyran=pollidisiac
rosareven=14
xanderwolf4=11
sandalle=3
@@ -96,3 +93,66 @@ quirkyrose=10
cynicalroses=6
adenmck=5
thenewdreamer=6
racerdelux=9
theicicle=9
yunchs=2
tonitch8=13
cmatt=9
vixlia=6
loudwhitenoise=2
or_in=arcanerose
kinomora=2
10pm=15
botanist_zyro=9
4ozscoop=15
robocyclone=6
ezfe=3
hehe3301=9
gelles=15
tralomine=fallenKanade
bigag3=13
odovbold=4
caigan=10
vpzom=10
ocker=manastar
kizbyspark=5
pongosapiens=bergamute
killfalcon=vinculotus
hanst99=fallenkanade
chosenarchitect=puredaisy
lifeofchrome=4
stylzm=vinculotus
yepidoodles=3
generrosity=2
nooblybear=agricarnation
3ddy=sweet_alexum
nekosoul241=arcanerose
hubry=5
tonitch8=13
gleeb=arcanerose
johnny215=15
zebia=13
gaius_caesar74=12
thenewdreamer=heiseiDream
unrealdinnerbone=9
buuz135=9
svennieke=6
kinclair=sprectrolus
imboomflex=daffomill
iris_pro=6
vhd=6
shiningstarling=vinculotus
somnioblivio=15
tokisutakaedelen=11
wittiko=11
redmecha30=shulk_me_not
lgthanatos=dandelifeon
voidbehemoth=10
pickbreaker=manastar
mojmacz=11
eeveein=2
_flipz_=vinculotus
_neotron_=9
taciturasa=6
nachog2003=9
ewsmith=rafflowsia
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Sat May 28 11:56:22 CDT 2016
#Thu Jan 03 14:54:29 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
Vendored
+61 -51
View File
@@ -1,4 +1,4 @@
#!/usr/bin/env bash
#!/usr/bin/env sh
##############################################################################
##
@@ -6,47 +6,6 @@
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=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"
@@ -61,9 +20,49 @@ while [ -h "$PRG" ] ; do
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
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"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
@@ -77,18 +76,20 @@ if [ -n "$JAVA_HOME" ] ; then
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
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
@@ -112,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`
@@ -152,11 +154,19 @@ if $cygwin ; then
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
APP_ARGS=$(save "$@")
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"
Vendored
+84 -90
View File
@@ -1,90 +1,84 @@
@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
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@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
@@ -1,49 +0,0 @@
/*
* ******************************************************************************
* Copyright 2011-2015 CovertJaguar
*
* This work (the API) is licensed under the "MIT" License, see LICENSE.md for details.
* ***************************************************************************
*/
package mods.railcraft.api.core.items;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.item.EntityMinecart;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
/**
* This interface should be implemented by any cart item,
* but it is generally optional.
*
* @author CovertJaguar <http://www.railcraft.info>
*/
public interface IMinecartItem
{
/**
* Controls whether this cart item can be placed by the Cart and Train Dispensers.
*
* Generally, you can ignore the placeCart() function if this returns false.
*
* @param cart
* @return true if it can be placed, false otherwise
*/
public boolean canBePlacedByNonPlayer(ItemStack cart);
/**
* Places a cart at the specified location.
*
* Implementing this function is optional.
*
* @param owner the name of the player placing the cart or "[MyMod]" with the brackets
* @param cart An ItemStack that contains the cart
* @param world The World
* @param i x-Coord
* @param j y-Coord
* @param k z-Coord
* @return the cart placed or null if failed
*/
public EntityMinecart placeCart(GameProfile owner, ItemStack cart, World world, int i, int j, int k);
}
@@ -1,20 +0,0 @@
package thaumcraft.api.crafting;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
*
* @author Azanor
*
* Blocks that implement this interface act as infusion crafting stabilisers like candles and skulls
*
*/
public interface IInfusionStabiliser {
/**
* returns true if the block can stabilise things
*/
public boolean canStabaliseInfusion(World world, BlockPos pos);
}
@@ -1,22 +0,0 @@
package thaumcraft.api.items;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped or held items that extend this class will be able to perform most functions that
* goggles of revealing can apart from view nodes which is handled by IRevealer.
*
*/
public interface IGoggles {
/*
* If this method returns true things like block essentia contents will be shown.
*/
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player);
}
@@ -1,22 +0,0 @@
package thaumcraft.api.items;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Equipped or held items that extend this class will make nodes or related objects visible in world.
*
*/
public interface IRevealer {
/*
* If this method returns true the nodes will be visible.
*/
public boolean showNodes(ItemStack itemstack, EntityLivingBase player);
}
@@ -1,22 +0,0 @@
package thaumcraft.api.items;
import net.minecraft.item.ItemStack;
/**
*
* @author Azanor
*
* Armor or bauble slot items that implement this interface can provide runic shielding.
* Recharging, hardening, etc. is handled internally by thaumcraft.
*
*/
public interface IRunicArmor {
/**
* returns how much charge this item can provide. This is the base shielding value - any hardening is stored and calculated internally.
*/
public int getRunicCharge(ItemStack itemstack);
}
@@ -1,14 +0,0 @@
package thaumcraft.api.items;
/**
*
* @author Azanor
*
* Interface used to identify scribing tool items used in research table
*
*/
public interface IScribeTools {
}
@@ -217,33 +217,19 @@ public final class BotaniaAPI {
addOreWeightNether("oreOnyx", 500); // SimpleOres 2
addOreWeightNether("oreHaditeCoal", 500); // Hadite
registerModWiki("Minecraft", new SimpleWikiProvider("Minecraft Wiki", "http://minecraft.gamepedia.com/%s"));
registerModWiki("minecraft", new SimpleWikiProvider("Minecraft Wiki", "https://minecraft.gamepedia.com/%s"));
IWikiProvider technicWiki = new SimpleWikiProvider("Technic Wiki", "http://wiki.technicpack.net/%s");
IWikiProvider mekanismWiki = new SimpleWikiProvider("Mekanism Wiki", "http://wiki.aidancbrady.com/wiki/%s");
IWikiProvider buildcraftWiki = new SimpleWikiProvider("BuildCraft Wiki", "http://www.mod-buildcraft.com/wiki/doku.php?id=%s");
registerModWiki("Mekanism", mekanismWiki);
registerModWiki("MekanismGenerators", mekanismWiki);
registerModWiki("MekanismTools", mekanismWiki);
registerModWiki("EnderIO", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s"));
registerModWiki("TropiCraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s"));
registerModWiki("RandomThings", new SimpleWikiProvider("Random Things Wiki", "http://randomthingsminecraftmod.wikispaces.com/%s"));
registerModWiki("Witchery", new SimpleWikiProvider("Witchery Wiki", "https://sites.google.com/site/witcherymod/%s", "-", true));
registerModWiki("AppliedEnergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s"));
registerModWiki("BigReactors", technicWiki);
registerModWiki("BuildCraft|Core", buildcraftWiki);
registerModWiki("BuildCraft|Builders", buildcraftWiki);
registerModWiki("BuildCraft|Energy", buildcraftWiki);
registerModWiki("BuildCraft|Factory", buildcraftWiki);
registerModWiki("BuildCraft|Silicon", buildcraftWiki);
registerModWiki("BuildCraft|Transport", buildcraftWiki);
registerModWiki("ArsMagica2", new SimpleWikiProvider("ArsMagica2 Wiki", "http://wiki.arsmagicamod.com/wiki/%s"));
registerModWiki("PneumaticCraft", new SimpleWikiProvider("PneumaticCraft Wiki", "http://www.minemaarten.com/wikis/pneumaticcraft-wiki/pneumaticcraft-wiki-%s"));
registerModWiki("StevesCarts2", new SimpleWikiProvider("Steve's Carts Wiki", "http://stevescarts2.wikispaces.com/%s"));
registerModWiki("GanysSurface", new SimpleWikiProvider("Gany's Surface Wiki", "http://ganys-surface.wikia.com/wiki/%s"));
registerModWiki("GanysNether", new SimpleWikiProvider("Gany's Nether Wiki", "http://ganys-nether.wikia.com/wiki/%s"));
registerModWiki("GanysEnd", new SimpleWikiProvider("Gany's End Wiki", "http://ganys-end.wikia.com/wiki/%s"));
registerModWiki("mekanism", mekanismWiki);
registerModWiki("mekanismgenerators", mekanismWiki);
registerModWiki("mekanismtools", mekanismWiki);
registerModWiki("enderio", new SimpleWikiProvider("EnderIO Wiki", "http://wiki.enderio.com/%s"));
registerModWiki("tropicraft", new SimpleWikiProvider("Tropicraft Wiki", "http://wiki.tropicraft.net/wiki/%s"));
registerModWiki("randomthings", new SimpleWikiProvider("Random Things Wiki", "https://lumien.net/rtwiki/blocks/%s/", "-", true));
registerModWiki("appliedenergistics2", new SimpleWikiProvider("AE2 Wiki", "http://ae-mod.info/%s"));
registerModWiki("bigreactors", technicWiki);
registerPaintableBlock(Blocks.STAINED_GLASS, BlockStainedGlass.COLOR);
registerPaintableBlock(Blocks.STAINED_GLASS_PANE, BlockStainedGlassPane.COLOR);
@@ -673,11 +659,11 @@ public final class BotaniaAPI {
if(stack.isEmpty())
return "";
return "i_" + stack.getItem().getUnlocalizedName() + "@" + stack.getItemDamage();
return "i_" + stack.getItem().getTranslationKey() + "@" + stack.getItemDamage();
}
private static String getMagnetKey(Block block, int meta) {
return "bm_" + block.getUnlocalizedName() + "@" + meta;
return "bm_" + block.getTranslationKey() + "@" + meta;
}
}
@@ -57,7 +57,7 @@ public final class BotaniaAPIClient {
* @param model A path to a blockstate json and variant to be used the block. The item model will be drawn from the same blockstate json, from variant "inventory"
*/
public static void registerSubtileModel(ResourceLocation subTileName, ModelResourceLocation model) {
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getResourceDomain() + ":" + model.getResourcePath(), "inventory"));
registerSubtileModel(subTileName, model, new ModelResourceLocation(model.getNamespace() + ":" + model.getPath(), "inventory"));
}
// Convenience overloads for the above two calls
@@ -17,6 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import vazkii.botania.api.BotaniaAPI;
@@ -297,4 +298,13 @@ public final class CorporeaHelper {
public static String stripControlCodes(String str) {
return patternControlCode.matcher(str).replaceAll("");
}
/**
* Returns the comparator strength for a corporea request that corporea crystal cubes and retainers use, following the usual "each step up requires double the items" formula.
*/
public static int signalStrengthForRequestSize(int requestSize) {
if(requestSize <= 0) return 0;
else if (requestSize >= 16384) return 15;
else return Math.min(15, MathHelper.log2(requestSize) + 1);
}
}
@@ -0,0 +1,33 @@
/**
* This class was created by <quaternary>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*
*/
package vazkii.botania.api.corporea;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraftforge.fml.common.eventhandler.Cancelable;
import net.minecraftforge.fml.common.eventhandler.Event;
/**
* CorporeaIndexRequestEvent is fired when a player attempts to request an item from a corporea index.
* If the event is cancelled, the request will not be performed.
* */
@Cancelable
public class CorporeaIndexRequestEvent extends Event {
public final EntityPlayerMP requester;
public String request;
public int requestCount;
public ICorporeaSpark indexSpark;
public CorporeaIndexRequestEvent(EntityPlayerMP requester, String request, int requestCount, ICorporeaSpark indexSpark) {
this.requester = requester;
this.request = request;
this.requestCount = requestCount;
this.indexSpark = indexSpark;
}
}
@@ -65,7 +65,7 @@ public final class LexiconRecipeMappings {
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
return stack.getTranslationKey() + (forceIgnore || ignoreMeta(stack) ? "" : "~" + stack.getItemDamage());
}
public static boolean ignoreMeta(ItemStack stack) {
@@ -299,7 +299,7 @@ public final class ManaItemHandler {
* @return The amount of mana received from the request.
*/
public static int requestManaForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player, stack));
int cost = (int) (manaToGet * multiplier);
return (int) (requestMana(stack, player, cost, remove) / multiplier);
}
@@ -313,7 +313,7 @@ public final class ManaItemHandler {
* @return If the request was succesful.
*/
public static boolean requestManaExactForTool(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player));
float multiplier = Math.max(0F, 1F - getFullDiscountForTools(player, stack));
int cost = (int) (manaToGet * multiplier);
return requestManaExact(stack, player, cost, remove);
}
@@ -1,4 +1,4 @@
@API(owner = "botania", apiVersion = "89", provides = "BotaniaAPI")
@API(owner = "botania", apiVersion = "92", provides = "BotaniaAPI")
package vazkii.botania.api;
import net.minecraftforge.fml.common.API;
@@ -14,12 +14,17 @@ import net.minecraft.item.ItemStack;
import vazkii.botania.api.item.IPetalApothecary;
/**
* Have an Item implement this to allow it to be used in the Petal Apothecary.
* An Item or Block that implements this interface can have a special particle color in the Petal Apothecary.
* TODO (breaking change): Rename to something more like "ISpecialApothecary", since now all items can go in the Apothecary
*/
public interface IFlowerComponent {
public boolean canFit(ItemStack stack, IPetalApothecary apothecary);
//TODO remove 1.13, unused, all items can go in the Petal Apothecary
@Deprecated
public default boolean canFit(ItemStack stack, IPetalApothecary apothecary) {
return true;
}
public int getParticleColor(ItemStack stack);
}
@@ -55,14 +55,9 @@ public class RecipeBrew {
for(int j = 0; j < inputsMissing.size(); j++) {
Object input = inputsMissing.get(j);
if(input instanceof String) {
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
boolean found = false;
for(ItemStack ostack : validStacks) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack)) {
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
oredictIndex = j;
found = true;
break;
@@ -44,11 +44,7 @@ public class RecipeElvenTrade {
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
boolean found = false;
for(ItemStack ostack : validStacks) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
if(!stacksToRemove.contains(stack))
stacksToRemove.add(stack);
oredictIndex = j;
@@ -35,22 +35,12 @@ public class RecipeManaInfusion {
public boolean matches(ItemStack stack) {
if(input instanceof ItemStack) {
ItemStack inputCopy = ((ItemStack) input).copy();
if(inputCopy.getItemDamage() == Short.MAX_VALUE)
inputCopy.setItemDamage(stack.getItemDamage());
return stack.isItemEqual(inputCopy);
return OreDictionary.itemMatches((ItemStack) input, stack, false);
}
if(input instanceof String) {
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
for(ItemStack ostack : validStacks) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack))
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
if(OreDictionary.itemMatches(ostack, stack, false))
return true;
}
}
@@ -12,6 +12,7 @@ package vazkii.botania.api.recipe;
import com.google.common.collect.ImmutableList;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.oredict.OreDictionary;
@@ -49,14 +50,9 @@ public class RecipePetals {
for(int j = 0; j < inputsMissing.size(); j++) {
Object input = inputsMissing.get(j);
if(input instanceof String) {
List<ItemStack> validStacks = OreDictionary.getOres((String) input);
boolean found = false;
for(ItemStack ostack : validStacks) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack)) {
for(ItemStack ostack : OreDictionary.getOres((String) input, false)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
oredictIndex = j;
found = true;
break;
@@ -66,7 +62,7 @@ public class RecipePetals {
if(found)
break;
} else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) {
} else if(input instanceof ItemStack && compareStacks((ItemStack) input, stack)) {
stackIndex = j;
break;
}
@@ -82,8 +78,20 @@ public class RecipePetals {
return inputsMissing.isEmpty();
}
private boolean simpleAreStacksEqual(ItemStack stack, ItemStack stack2) {
return stack.getItem() == stack2.getItem() && stack.getItemDamage() == stack2.getItemDamage();
private boolean compareStacks(ItemStack recipe, ItemStack supplied) {
if(recipe.getItem() == supplied.getItem() && recipe.getItemDamage() == supplied.getItemDamage()) {
//check that the user supplied nbt tag is a superset of the recipe item nbt tag
//if the recipe doesn't have an NBT tag, the user supplied one doesn't matter, it is a superset
if(!recipe.hasTagCompound()) return true;
//if the recipe does have an NBT tag but the user supplied doesn't, also no way it's a superset
if(!supplied.hasTagCompound()) return false;
NBTTagCompound mergedNBT = supplied.getTagCompound().copy();
mergedNBT.merge(recipe.getTagCompound());
return supplied.getTagCompound().equals(mergedNBT);
}
return false;
}
public List<Object> getInputs() {
@@ -26,7 +26,6 @@ import java.util.Map;
public class RecipePureDaisy {
public static final int DEFAULT_TIME = 150;
private static final Map<String, List<ItemStack>> oreMap = new HashMap<>();
private final Object input;
private final IBlockState outputState;
@@ -64,21 +63,10 @@ public class RecipePureDaisy {
if(stack.isEmpty())
return false;
List<ItemStack> ores;
if(oreMap.containsKey(entry))
ores = oreMap.get(entry);
else {
ores = OreDictionary.getOres(entry);
oreMap.put(entry, ores);
}
for(ItemStack ostack : ores) {
ItemStack cstack = ostack.copy();
if(cstack.getItemDamage() == Short.MAX_VALUE)
cstack.setItemDamage(stack.getItemDamage());
if(stack.isItemEqual(cstack))
for(ItemStack ostack : OreDictionary.getOres(entry, false)) {
if(OreDictionary.itemMatches(ostack, stack, false)) {
return true;
}
}
return false;
@@ -21,6 +21,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
@@ -38,6 +39,7 @@ import java.util.List;
* a no parameter constructor.
*/
public class SubTileEntity {
public static final ResourceLocation DING_SOUND_EVENT = new ResourceLocation("botania", "ding");
protected TileEntity supertile;
@@ -18,14 +18,14 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.common.core.handler.ModSounds;
import java.awt.Color;
@@ -137,7 +137,9 @@ public class SubTileFunctional extends SubTileEntity {
return false;
knownMana = mana;
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 0.1F, 1F);
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
if(evt != null)
player.playSound(evt, 0.1F, 1F);
return super.onWanded(player, wand);
}
@@ -22,15 +22,16 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.internal.IManaNetwork;
import vazkii.botania.api.mana.IManaCollector;
import vazkii.botania.common.core.handler.ModSounds;
import java.awt.Color;
import java.util.List;
@@ -94,8 +95,13 @@ public class SubTileGenerating extends SubTileEntity {
if(supertile.getWorld().isRemote) {
double particleChance = 1F - (double) mana / (double) getMaxMana() / 3.5F;
Color color = new Color(getColor());
if(Math.random() > particleChance)
BotaniaAPI.internalHandler.sparkleFX(supertile.getWorld(), supertile.getPos().getX() + 0.3 + Math.random() * 0.5, supertile.getPos().getY() + 0.5 + Math.random() * 0.5, supertile.getPos().getZ() + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
if(Math.random() > particleChance) {
Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos());
double x = getPos().getX() + offset.x;
double y = getPos().getY() + offset.y;
double z = getPos().getZ() + offset.z;
BotaniaAPI.internalHandler.sparkleFX(supertile.getWorld(), x + 0.3 + Math.random() * 0.5, y + 0.5 + Math.random() * 0.5, z + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
}
}
boolean passive = isPassiveFlower();
@@ -224,7 +230,9 @@ public class SubTileGenerating extends SubTileEntity {
sync();
knownMana = mana;
player.world.playSound(null, player.posX, player.posY, player.posZ, ModSounds.ding, SoundCategory.PLAYERS, 0.1F, 1F);
SoundEvent evt = ForgeRegistries.SOUND_EVENTS.getValue(DING_SOUND_EVENT);
if(evt != null)
player.playSound(evt, 0.1F, 1F);
return super.onWanded(player, wand);
}
@@ -18,13 +18,13 @@ import java.util.Map;
public class WikiHooks {
private static final IWikiProvider FALLBACK_PROVIDER = new SimpleWikiProvider("FTB Wiki", "http://ftb.gamepedia.com/%s");
private static final IWikiProvider FALLBACK_PROVIDER = new SimpleWikiProvider("FTB Wiki", "https://ftb.gamepedia.com/%s");
private static final Map<String, IWikiProvider> modWikis = new HashMap<>();
public static IWikiProvider getWikiFor(Block block) {
ResourceLocation mod = Block.REGISTRY.getNameForObject(block);
return getWikiFor(mod == null ? "" : mod.getResourceDomain().toLowerCase());
return getWikiFor(mod == null ? "" : mod.getNamespace().toLowerCase());
}
public static IWikiProvider getWikiFor(String mod) {
@@ -13,11 +13,13 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.registries.IRegistryDelegate;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.brew.Brew;
import vazkii.botania.api.brew.IBrewItem;
import vazkii.botania.api.mana.BurstProperties;
import vazkii.botania.api.state.BotaniaStateProps;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockCamo;
@@ -152,8 +154,8 @@ public final class ColorHandler {
return Minecraft.getMinecraft().getItemColors().colorMultiplier(lens, t);
if(t == 2) {
EntityManaBurst burst = ((ItemManaGun) s.getItem()).getBurst(Minecraft.getMinecraft().player, s, false);
Color color = new Color(burst == null ? 0x20FF20 : burst.getColor());
BurstProperties props = ((ItemManaGun) s.getItem()).getBurstProps(Minecraft.getMinecraft().player, s, false, EnumHand.MAIN_HAND);
Color color = new Color(props.color);
float mul = (float) (Math.sin((double) ClientTickHandler.ticksInGame / 5) * 0.15F);
int c = (int) (255 * mul);
@@ -0,0 +1,82 @@
/**
* This class was created by <Hubry>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
* <p>
* File Created @ [July 04, 2018, 19:16:14 (GMT)]
*/
package vazkii.botania.client.core.handler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.GuiScreenEvent.KeyboardInputEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.lwjgl.input.Keyboard;
import vazkii.botania.api.corporea.CorporeaHelper;
import vazkii.botania.client.core.proxy.ClientProxy;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.lib.LibMisc;
import java.util.function.Predicate;
import java.util.function.Supplier;
@Mod.EventBusSubscriber(modid = LibMisc.MOD_ID, value = Side.CLIENT)
public class CorporeaInputHandler {
/** Replaced in JEIBotaniaPlugin when JEI's loaded to provide stacks from the JEI item panel. */
public static Supplier<ItemStack> jeiPanelSupplier = () -> ItemStack.EMPTY;
/** Filter for usable guis to handle requests. Added to in JEIBotaniaPlugin */
public static Predicate<GuiScreen> supportedGuiFilter = gui -> gui instanceof GuiContainer;
@SubscribeEvent
public static void buttonPressed(KeyboardInputEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
if(mc.world == null || !supportedGuiFilter.test(mc.currentScreen)
|| Keyboard.getEventKey() != ClientProxy.CORPOREA_REQUEST.getKeyCode()
|| !Keyboard.getEventKeyState()
|| Keyboard.isRepeatEvent()
|| TileCorporeaIndex.InputHandler.getNearbyIndexes(mc.player).isEmpty())
return;
ItemStack stack = getStackUnderMouse();
if(stack != null && !stack.isEmpty()) {
int count = 1;
int max = stack.getMaxStackSize();
if(GuiScreen.isShiftKeyDown()) {
count = max;
if(GuiScreen.isCtrlKeyDown())
count /= 4;
} else if(GuiScreen.isCtrlKeyDown())
count = max / 2;
if(count > 0) {
String name = CorporeaHelper.stripControlCodes(stack.getDisplayName());
String full = count + " " + name;
mc.ingameGUI.getChatGUI().addToSentMessages(full);
mc.player.sendChatMessage(full);
event.setCanceled(true);
}
}
}
private static ItemStack getStackUnderMouse() {
GuiScreen screen = Minecraft.getMinecraft().currentScreen;
if(screen instanceof GuiContainer) {
Slot slotUnderMouse = ((GuiContainer) screen).getSlotUnderMouse();
if(slotUnderMouse != null)
return slotUnderMouse.getStack();
}
return jeiPanelSupplier.get();
}
}
@@ -18,7 +18,6 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
@@ -35,7 +34,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;
@@ -71,7 +69,6 @@ import vazkii.botania.common.item.equipment.bauble.ItemDodgeRing;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.lib.LibObfuscation;
import java.awt.Color;
import java.util.List;
@@ -88,7 +85,7 @@ public final class HUDHandler {
@SubscribeEvent(priority = EventPriority.HIGHEST)
public static void onDrawScreenPre(RenderGameOverlayEvent.Pre event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
if(event.getType() == ElementType.HEALTH) {
profiler.startSection("botania-hud");
@@ -120,7 +117,7 @@ public final class HUDHandler {
@SubscribeEvent
public static void onDrawScreenPost(RenderGameOverlayEvent.Post event) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
ItemStack main = mc.player.getHeldItemMainhand();
ItemStack offhand = mc.player.getHeldItemOffhand();
@@ -265,7 +262,7 @@ public final class HUDHandler {
private static void renderWandModeDisplay(ItemStack stack, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("wandMode");
int ticks = mc.ingameGUI.remainingHighlightTicks;
@@ -317,7 +314,7 @@ public final class HUDHandler {
private static void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("poolRecipe");
RecipeManaInfusion recipe = TilePool.getMatchingRecipe(stack, tile.getWorld().getBlockState(tile.getPos().down()));
@@ -349,7 +346,7 @@ public final class HUDHandler {
private static void renderCrystalCubeHUD(ScaledResolution res, TileCorporeaCrystalCube tile) {
Minecraft mc = Minecraft.getMinecraft();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("crystalCube");
ItemStack target = tile.getRequestTarget();
@@ -376,7 +373,7 @@ public final class HUDHandler {
private static void drawLexiconHUD(ItemStack stack, IBlockState state, RayTraceResult pos, ScaledResolution res) {
Minecraft mc = Minecraft.getMinecraft();
Block block = state.getBlock();
Profiler profiler = mc.mcProfiler;
Profiler profiler = mc.profiler;
profiler.startSection("lexicon");
FontRenderer font = mc.fontRenderer;
@@ -401,7 +398,7 @@ public final class HUDHandler {
}
}
if(!draw && pos.entityHit == null) {
if(!ConfigHandler.lexicaOfflineMode && !draw && pos.entityHit == null) {
profiler.startSection("wikiLookup");
if(!block.isAir(state, mc.world, pos.getBlockPos()) && !(block instanceof BlockLiquid)) {
IWikiProvider provider = WikiHooks.getWikiFor(block);
@@ -111,7 +111,7 @@ public final class ItemsRemainingRenderHandler {
int count = 0;
for(int i = 0; i < player.inventory.getSizeInventory(); i++) {
ItemStack stack = player.inventory.getStackInSlot(i);
if(!stack.isEmpty() && pattern.matcher(stack.getUnlocalizedName()).find())
if(!stack.isEmpty() && pattern.matcher(stack.getTranslationKey()).find())
count += stack.getCount();
}
@@ -43,7 +43,7 @@ public class LightningHandler {
@SubscribeEvent
public static void onRenderWorldLast(RenderWorldLastEvent event) {
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
Profiler profiler = Minecraft.getMinecraft().profiler;
profiler.startSection("botania-particles");
ParticleRenderDispatcher.dispatch();
@@ -14,14 +14,19 @@ import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.apache.commons.lang3.text.WordUtils;
import vazkii.botania.client.core.helper.IconHelper;
import vazkii.botania.client.model.FloatingFlowerModel;
import vazkii.botania.client.model.GunModel;
import vazkii.botania.client.model.LexiconModel;
import vazkii.botania.client.model.PlatformModel;
import vazkii.botania.common.integration.buildcraft.TriggerManaLevel;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
import vazkii.botania.common.item.relic.ItemKingKey;
import java.util.EnumMap;
import java.util.Map;
public class MiscellaneousIcons {
public static final MiscellaneousIcons INSTANCE = new MiscellaneousIcons();
@@ -48,7 +53,7 @@ public class MiscellaneousIcons {
public TextureAtlasSprite[] sparkUpgradeIcons;
public TextureAtlasSprite[] kingKeyWeaponIcons;
// todo buildcraft public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = Maps.newEnumMap(TriggerManaLevel.State.class);
public final Map<TriggerManaLevel.State, TextureAtlasSprite> manaLevelTriggerIcons = new EnumMap<>(TriggerManaLevel.State.class);
public TextureAtlasSprite[] tiaraWingIcons;
public TextureAtlasSprite[] thirdEyeLayers;
@@ -146,9 +151,9 @@ public class MiscellaneousIcons {
manaDetectorIcon = IconHelper.forName(evt.getMap(), "triggers/manaDetector", "items");
runeAltarTriggerIcon = IconHelper.forName(evt.getMap(), "triggers/runeAltarCanCraft", "items");
/*for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) { todo buildcraft
for (TriggerManaLevel.State s : TriggerManaLevel.State.values()) {
manaLevelTriggerIcons.put(s, IconHelper.forName(evt.getMap(), "triggers/mana" + WordUtils.capitalizeFully(s.name()), "items"));
}*/
}
tiaraWingIcons = new TextureAtlasSprite[ItemFlightTiara.WING_TYPES];
for (int i = 0; i < tiaraWingIcons.length; i++) {
@@ -135,7 +135,7 @@ public final class ModelHandler {
}
public static void registerItemAllMeta(Item item, int range) {
registerItemMetas(item, range, i -> item.getRegistryName().getResourcePath());
registerItemMetas(item, range, i -> item.getRegistryName().getPath());
}
public static void registerItemAppendMeta(Item item, int maxExclusive, String loc) {
@@ -106,9 +106,9 @@ public final class RedStringRenderer {
double freq = 20;
double ampl = (0.15 * (Math.sin(l * 2F) * 0.5 + 0.5) + 0.1) * sizeAlpha;
double randMul = 0.05;
double x = xpos + Math.sin(l * freq) * ampl * Math.abs(Math.abs(dir.getFrontOffsetX()) - 1) + rand * randMul;
double y = ypos + Math.cos(l * freq) * ampl * Math.abs(Math.abs(dir.getFrontOffsetY()) - 1) + rand * randMul;
double z = zpos + (dir.getFrontOffsetY() == 0 ? Math.sin(l * freq) : Math.cos(l * freq)) * ampl * Math.abs(Math.abs(dir.getFrontOffsetZ()) - 1) + rand * randMul;
double x = xpos + Math.sin(l * freq) * ampl * Math.abs(Math.abs(dir.getXOffset()) - 1) + rand * randMul;
double y = ypos + Math.cos(l * freq) * ampl * Math.abs(Math.abs(dir.getYOffset()) - 1) + rand * randMul;
double z = zpos + (dir.getYOffset() == 0 ? Math.sin(l * freq) : Math.cos(l * freq)) * ampl * Math.abs(Math.abs(dir.getZOffset()) - 1) + rand * randMul;
tess.getBuffer().pos(x, y, z).endVertex();
}
@@ -64,7 +64,7 @@ public final class TooltipAdditionDisplayHandler {
drawManaBar(stack, (IManaTooltipDisplay) stack.getItem(), tooltipX, tooltipY, width, height);
EntryData data = LexiconRecipeMappings.getDataForStack(stack);
if(data != null) {
if(mc.player != null && data != null) {
int lexSlot = -1;
ItemStack lexiconStack = ItemStack.EMPTY;
@@ -18,6 +18,7 @@ import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraft.client.renderer.tileentity.TileEntityItemStackRenderer;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.renderer.vertex.VertexFormat;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -26,6 +27,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.client.model.animation.AnimationTESR;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
@@ -34,6 +36,7 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;
import org.lwjgl.input.Keyboard;
import vazkii.botania.api.boss.IBotaniaBoss;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.api.lexicon.multiblock.IMultiblockRenderHook;
@@ -102,6 +105,7 @@ import vazkii.botania.common.item.ItemSextant.MultiblockSextant;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.equipment.bauble.ItemMonocle;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import java.awt.Desktop;
import java.io.File;
@@ -132,9 +136,11 @@ public class ClientProxy implements IProxy {
EMPTY_MODEL.setVisible(false);
}
public static final KeyBinding CORPOREA_REQUEST = new KeyBinding("nei.options.keys.gui.botania_corporea_request", KeyConflictContext.GUI, Keyboard.KEY_C, LibMisc.MOD_NAME);
@Override
public void preInit(FMLPreInitializationEvent event) {
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().mcDataDir, "BotaniaVars.dat"));
PersistentVariableHelper.setCacheFile(new File(Minecraft.getMinecraft().gameDir, "BotaniaVars.dat"));
try {
PersistentVariableHelper.load();
PersistentVariableHelper.save();
@@ -170,6 +176,8 @@ public class ClientProxy implements IProxy {
}
TileEntityItemStackRenderer.instance = new RenderTilePylon.ForwardingTEISR(TileEntityItemStackRenderer.instance);
ClientRegistry.registerKeyBinding(ClientProxy.CORPOREA_REQUEST);
}
@Override
@@ -277,6 +285,8 @@ public class ClientProxy implements IProxy {
@Override
public boolean openWikiPage(World world, Block block, RayTraceResult pos) {
if(ConfigHandler.lexicaOfflineMode)
return false;
IWikiProvider wiki = WikiHooks.getWikiFor(block);
String url = wiki.getWikiURL(world, pos, Minecraft.getMinecraft().player);
if(url != null && !url.isEmpty()) {
@@ -30,7 +30,7 @@ public final class ParticleRenderDispatcher {
public static void dispatch() {
Tessellator tessellator = Tessellator.getInstance();
Profiler profiler = Minecraft.getMinecraft().mcProfiler;
Profiler profiler = Minecraft.getMinecraft().profiler;
GL11.glPushAttrib(GL11.GL_LIGHTING_BIT);
GlStateManager.depthMask(false);
@@ -8,14 +8,20 @@
*/
package vazkii.botania.client.integration.jei;
import mezz.jei.api.IJeiRuntime;
import mezz.jei.api.IModPlugin;
import mezz.jei.api.IModRegistry;
import mezz.jei.api.IRecipesGui;
import mezz.jei.api.ISubtypeRegistry;
import mezz.jei.api.JEIPlugin;
import mezz.jei.api.recipe.IRecipeCategoryRegistration;
import mezz.jei.api.recipe.VanillaRecipeCategoryUid;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.api.recipe.RecipeElvenTrade;
@@ -23,6 +29,7 @@ import vazkii.botania.api.recipe.RecipeManaInfusion;
import vazkii.botania.api.recipe.RecipePetals;
import vazkii.botania.api.recipe.RecipePureDaisy;
import vazkii.botania.api.recipe.RecipeRuneAltar;
import vazkii.botania.client.core.handler.CorporeaInputHandler;
import vazkii.botania.client.gui.crafting.ContainerCraftingHalo;
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeCategory;
import vazkii.botania.client.integration.jei.brewery.BreweryRecipeWrapper;
@@ -31,6 +38,10 @@ import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeCategory
import vazkii.botania.client.integration.jei.elventrade.ElvenTradeRecipeWrapper;
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeCategory;
import vazkii.botania.client.integration.jei.manapool.ManaPoolRecipeWrapper;
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeCategory;
import vazkii.botania.client.integration.jei.orechid.OrechidIgnemRecipeWrapper;
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeCategory;
import vazkii.botania.client.integration.jei.orechid.OrechidRecipeWrapper;
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeCategory;
import vazkii.botania.client.integration.jei.petalapothecary.PetalApothecaryRecipeWrapper;
import vazkii.botania.client.integration.jei.puredaisy.PureDaisyRecipeCategory;
@@ -42,8 +53,14 @@ import vazkii.botania.common.crafting.recipe.SpecialFloatingFlowerRecipe;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.item.brew.ItemBrewBase;
import javax.annotation.Nonnull;
import java.util.stream.Collectors;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_ORECHID_IGNEM;
import static vazkii.botania.common.lib.LibBlockNames.SUBTILE_PUREDAISY;
@JEIPlugin
public class JEIBotaniaPlugin implements IModPlugin {
@@ -52,6 +69,10 @@ public class JEIBotaniaPlugin implements IModPlugin {
public void registerItemSubtypes(@Nonnull ISubtypeRegistry subtypeRegistry) {
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.specialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
subtypeRegistry.registerSubtypeInterpreter(Item.getItemFromBlock(ModBlocks.floatingSpecialFlower), stack -> ItemBlockSpecialFlower.getType(stack).toString());
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewVial, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.brewFlask, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.incenseStick, ItemBrewBase::getSubtype);
subtypeRegistry.registerSubtypeInterpreter(ModItems.bloodPendant, ItemBrewBase::getSubtype);
}
@Override
@@ -62,8 +83,16 @@ public class JEIBotaniaPlugin implements IModPlugin {
new RunicAltarRecipeCategory(registry.getJeiHelpers().getGuiHelper()), // Runic must come before petals. See williewillus/Botania#172
new PetalApothecaryRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new ElvenTradeRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new ManaPoolRecipeCategory(registry.getJeiHelpers().getGuiHelper())
);
new ManaPoolRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new OrechidRecipeCategory(registry.getJeiHelpers().getGuiHelper()),
new OrechidIgnemRecipeCategory(registry.getJeiHelpers().getGuiHelper())
);
}
public static boolean doesOreExist(String key) {
return OreDictionary.doesOreNameExist(key)
&& OreDictionary.getOres(key).stream()
.anyMatch(s -> s.getItem() instanceof ItemBlock);
}
@Override
@@ -83,6 +112,23 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.addRecipes(BotaniaAPI.runeAltarRecipes, RunicAltarRecipeCategory.UID);
registry.addRecipes(BotaniaAPI.manaInfusionRecipes, ManaPoolRecipeCategory.UID);
registry.addRecipes(
BotaniaAPI.oreWeights.entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(OrechidRecipeWrapper::new)
.sorted()
.collect(Collectors.toList()),
OrechidRecipeCategory.UID);
registry.addRecipes(
BotaniaAPI.oreWeightsNether.entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(OrechidIgnemRecipeWrapper::new)
.sorted()
.collect(Collectors.toList()),
OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.brewery), BreweryRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.alfPortal), ElvenTradeRecipeCategory.UID);
@@ -102,8 +148,12 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mesaAltar), PetalApothecaryRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.mossyAltar), PetalApothecaryRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), LibBlockNames.SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID), OrechidRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID), OrechidRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_ORECHID_IGNEM), OrechidIgnemRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(ItemBlockSpecialFlower.ofType(new ItemStack(ModBlocks.floatingSpecialFlower), SUBTILE_PUREDAISY), PureDaisyRecipeCategory.UID);
registry.addRecipeCatalyst(new ItemStack(ModBlocks.runeAltar), RunicAltarRecipeCategory.UID);
@@ -113,4 +163,20 @@ public class JEIBotaniaPlugin implements IModPlugin {
registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerCraftingHalo.class, VanillaRecipeCategoryUid.CRAFTING, 1, 9, 10, 36);
}
@Override
public void onRuntimeAvailable(IJeiRuntime jeiRuntime) {
CorporeaInputHandler.jeiPanelSupplier = () -> {
Object o = jeiRuntime.getIngredientListOverlay().getIngredientUnderMouse();
if(o == null && Minecraft.getMinecraft().currentScreen == jeiRuntime.getRecipesGui())
o = jeiRuntime.getRecipesGui().getIngredientUnderMouse();
if(o instanceof ItemStack)
return (ItemStack) o;
return ItemStack.EMPTY;
};
CorporeaInputHandler.supportedGuiFilter = gui -> gui instanceof GuiContainer || gui instanceof IRecipesGui;
}
}
@@ -13,17 +13,16 @@ import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class BreweryRecipeCategory implements IRecipeCategory {
@@ -68,9 +67,11 @@ public class BreweryRecipeCategory implements IRecipeCategory {
return;
List<List<ItemStack>> inputs = ingredients.getInputs(ItemStack.class);
List<List<ItemStack>> outputs = ingredients.getOutputs(ItemStack.class);
IFocus<?> focus = recipeLayout.getFocus();
recipeLayout.getItemStacks().init(0, true, 39, 41);
recipeLayout.getItemStacks().set(0, inputs.get(0));
recipeLayout.getItemStacks().set(0, getItemMatchingFocus(focus, IFocus.Mode.OUTPUT, outputs.get(0), inputs.get(0)));
int index = 1, posX = 60;
for(int i = 1; i < inputs.size(); i++) {
@@ -82,6 +83,19 @@ public class BreweryRecipeCategory implements IRecipeCategory {
}
recipeLayout.getItemStacks().init(7, false, 87, 41);
recipeLayout.getItemStacks().set(7, ingredients.getOutputs(ItemStack.class).get(0));
recipeLayout.getItemStacks().set(7, getItemMatchingFocus(focus, IFocus.Mode.INPUT, inputs.get(0), outputs.get(0)));
}
/**
* If an item in this recipe is focused, returns the corresponding item instead of all the containers/results.
*/
private List<ItemStack> getItemMatchingFocus(IFocus<?> focus, IFocus.Mode mode, List<ItemStack> focused, List<ItemStack> other) {
if(focus != null && focus.getMode() == mode) {
ItemStack focusStack = (ItemStack) focus.getValue();
for(int i = 0; i < focused.size(); i++)
if(focusStack.isItemEqual(focused.get(i)))
return Collections.singletonList(other.get(i));
}
return other;
}
}
@@ -11,35 +11,48 @@ package vazkii.botania.client.integration.jei.brewery;
import com.google.common.collect.ImmutableList;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.recipe.RecipeBrew;
import vazkii.botania.common.item.ModItems;
import javax.annotation.Nonnull;
import java.util.Arrays;
import java.util.List;
public class BreweryRecipeWrapper implements IRecipeWrapper {
private final List<List<ItemStack>> input;
private final List<ItemStack> output;
private static final List<ItemStack> inputs = Arrays.asList(new ItemStack(ModItems.vial),
new ItemStack(ModItems.flask), new ItemStack(ModItems.incenseStick), new ItemStack(ModItems.bloodPendant));
@SuppressWarnings("unchecked")
public BreweryRecipeWrapper(RecipeBrew recipeBrew) {
ImmutableList.Builder<List<ItemStack>> builder = ImmutableList.builder();
builder.add(ImmutableList.of(new ItemStack(ModItems.vial), new ItemStack(ModItems.flask)));
ImmutableList.Builder<List<ItemStack>> inputBuilder = ImmutableList.builder();
ImmutableList.Builder<ItemStack> outputBuilder = ImmutableList.builder();
ImmutableList.Builder<ItemStack> containers = ImmutableList.builder();
for(ItemStack stack : inputs) {
ItemStack brewed = recipeBrew.getOutput(stack);
if(!brewed.isEmpty()) {
containers.add(stack);
outputBuilder.add(brewed);
}
}
inputBuilder.add(containers.build());
for(Object o : recipeBrew.getInputs()) {
if(o instanceof ItemStack) {
builder.add(ImmutableList.of((ItemStack) o));
inputBuilder.add(ImmutableList.of((ItemStack) o));
}
if(o instanceof String) {
builder.add(OreDictionary.getOres((String) o));
inputBuilder.add(OreDictionary.getOres((String) o));
}
}
input = builder.build();
output = ImmutableList.of(recipeBrew.getOutput(new ItemStack(ModItems.vial)).copy(), recipeBrew.getOutput(new ItemStack(ModItems.flask)).copy());
input = inputBuilder.build();
output = outputBuilder.build();
}
@Override
@@ -0,0 +1,92 @@
/**
* This class was created by <codewarrior0>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.integration.jei.orechid;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class OrechidIgnemRecipeCategory implements IRecipeCategory {
public static final String UID = "botania.orechid_ignem";
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public OrechidIgnemRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.format("botania.nei.orechidIgnem");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return UID;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 40, 12);
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
itemStacks.init(1, true, 70, 12);
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID_IGNEM));
itemStacks.init(2, true, 99, 12);
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public String getModName() {
return LibMisc.MOD_NAME;
}
}
@@ -0,0 +1,32 @@
/**
* This class was created by <codewarrior0>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.integration.jei.orechid;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.BotaniaAPI;
import java.util.Map;
public class OrechidIgnemRecipeWrapper extends OrechidRecipeWrapper {
public OrechidIgnemRecipeWrapper(Map.Entry<String, Integer> entry) {
super(entry);
}
@Override
protected ItemStack getInputStack() {
return new ItemStack(Blocks.NETHERRACK, 64);
}
public Map<String, Integer> getOreWeights() {
return BotaniaAPI.oreWeightsNether;
}
}
@@ -0,0 +1,92 @@
/**
* This class was created by <codewarrior0>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.integration.jei.orechid;
import mezz.jei.api.IGuiHelper;
import mezz.jei.api.gui.IDrawable;
import mezz.jei.api.gui.IDrawableStatic;
import mezz.jei.api.gui.IGuiItemStackGroup;
import mezz.jei.api.gui.IRecipeLayout;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.common.item.block.ItemBlockSpecialFlower;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.lib.LibMisc;
import javax.annotation.Nonnull;
public class OrechidRecipeCategory implements IRecipeCategory {
public static final String UID = "botania.orechid";
private final IDrawableStatic background;
private final String localizedName;
private final IDrawableStatic overlay;
public OrechidRecipeCategory(IGuiHelper guiHelper) {
background = guiHelper.createBlankDrawable(168, 64);
localizedName = I18n.format("botania.nei.orechid");
overlay = guiHelper.createDrawable(new ResourceLocation("botania", "textures/gui/pureDaisyOverlay.png"),
0, 0, 64, 46);
}
@Nonnull
@Override
public String getUid() {
return UID;
}
@Nonnull
@Override
public String getTitle() {
return localizedName;
}
@Nonnull
@Override
public IDrawable getBackground() {
return background;
}
@Override
public void setRecipe(IRecipeLayout recipeLayout, IRecipeWrapper recipeWrapper, IIngredients ingredients) {
final IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks();
itemStacks.init(0, true, 40, 12);
itemStacks.set(0, ingredients.getInputs(ItemStack.class).get(0));
itemStacks.init(1, true, 70, 12);
itemStacks.set(1, ItemBlockSpecialFlower.ofType(LibBlockNames.SUBTILE_ORECHID));
itemStacks.init(2, true, 99, 12);
itemStacks.set(2, ingredients.getOutputs(ItemStack.class).get(0));
}
@Override
public void drawExtras(@Nonnull Minecraft minecraft) {
GlStateManager.enableAlpha();
GlStateManager.enableBlend();
overlay.draw(minecraft, 48, 0);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
}
@Nonnull
@Override
public String getModName() {
return LibMisc.MOD_NAME;
}
}
@@ -0,0 +1,74 @@
/**
* This class was created by <codewarrior0>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
* <p/>
* Botania is Open Source and distributed under the
* Botania License: http://botaniamod.net/license.php
*/
package vazkii.botania.client.integration.jei.orechid;
import mezz.jei.api.ingredients.IIngredients;
import mezz.jei.api.ingredients.VanillaTypes;
import mezz.jei.api.recipe.IRecipeWrapper;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.BotaniaAPI;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static vazkii.botania.client.integration.jei.JEIBotaniaPlugin.doesOreExist;
public class OrechidRecipeWrapper implements IRecipeWrapper, Comparable<OrechidRecipeWrapper> {
private final int weight;
private final List<List<ItemStack>> outputStacks;
protected ItemStack getInputStack() {
return new ItemStack(Blocks.STONE, 64);
}
public OrechidRecipeWrapper(Map.Entry<String, Integer> entry) {
this.weight = entry.getValue();
final int amount = Math.max(1, Math.round((float) weight * 64 / getTotalOreWeight()));
// Shouldn't ever return an empty list since the ore weight
// list is filtered to only have ores with ItemBlocks
List<ItemStack> stackList = OreDictionary.getOres(entry.getKey()).stream()
.filter(s -> s.getItem() instanceof ItemBlock)
.map(ItemStack::copy)
.collect(Collectors.toList());
stackList.forEach(s -> s.setCount(amount));
outputStacks = Collections.singletonList(stackList);
}
public Map<String, Integer> getOreWeights() {
return BotaniaAPI.oreWeights;
}
private float getTotalOreWeight() {
return (getOreWeights().entrySet().stream()
.filter(e -> doesOreExist(e.getKey()))
.map(Map.Entry::getValue)
.reduce(Integer::sum)).orElse(weight * 64 * 64);
}
@Override
public void getIngredients(IIngredients ingredients) {
ingredients.setInput(VanillaTypes.ITEM, getInputStack());
ingredients.setOutputLists(VanillaTypes.ITEM, outputStacks);
}
@Override
public int compareTo(OrechidRecipeWrapper o) {
return Integer.compare(o.weight, weight);
}
}
@@ -46,9 +46,8 @@ public class PlatformModel implements IBakedModel {
@Nonnull
@Override
public List<BakedQuad> getQuads(IBlockState state, EnumFacing side, long rand) {
// rendering the item form
if(state == null)
return original.getQuads(state, side, rand);
return ImmutableList.of();
if(!(state.getBlock() instanceof BlockPlatform))
return Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getModelManager().getMissingModel().getQuads(state, side, rand);
@@ -135,10 +135,10 @@ public class SpecialFlowerModel implements IModel {
@Override
public boolean accepts(ResourceLocation modelLocation) {
return modelLocation.getResourceDomain().equals("botania_special") && (
modelLocation.getResourcePath().equals("specialflower") ||
modelLocation.getResourcePath().equals("models/block/specialflower") ||
modelLocation.getResourcePath().equals("models/item/specialflower"));
return modelLocation.getNamespace().equals("botania_special") && (
modelLocation.getPath().equals("specialflower") ||
modelLocation.getPath().equals("models/block/specialflower") ||
modelLocation.getPath().equals("models/item/specialflower"));
}
@Override
@@ -37,7 +37,7 @@ public class RenderTileGaiaHead extends TileEntitySkullRenderer {
// Null-safe copy of super
renderSkull((float)x, (float)y, (float)z,
skull == null ? EnumFacing.NORTH : EnumFacing.getFront(skull.getBlockMetadata() & 7),
skull == null ? EnumFacing.NORTH : EnumFacing.byIndex(skull.getBlockMetadata() & 7),
skull == null ? 0 : skull.getSkullRotation() * 360 / 16.0F,
3, null, digProgress, partialTicks);
@@ -41,6 +41,7 @@ import vazkii.botania.client.model.ModelTinyPotato;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.tile.TileTinyPotato;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.item.block.ItemBlockTinyPotato;
import vazkii.botania.common.item.equipment.bauble.ItemBaubleCosmetic;
import vazkii.botania.common.item.equipment.bauble.ItemFlightTiara;
@@ -172,44 +173,61 @@ public class RenderTileTinyPotato extends TileEntitySpecialRenderer<TileTinyPota
}
boolean block = stack.getItem() instanceof ItemBlock;
boolean mySon = stack.getItem() instanceof ItemBlockTinyPotato;
switch(side) {
case UP:
if(block)
if(mySon)
GlStateManager.translate(0F, 0.6F, 0.5F);
else if(block)
GlStateManager.translate(0F, 0.3F, 0.5F);
GlStateManager.translate(0F, -0.5F, -0.4F);
break;
case DOWN:
GlStateManager.translate(0, -2.3, -0.88);
if(block)
if(mySon)
GlStateManager.translate(0, .65, 0.6);
else if(block)
GlStateManager.translate(0, 1, 0.6);
break;
case NORTH:
GlStateManager.translate(0, -1.9, 0.02);
if(block)
if(mySon)
GlStateManager.translate(0, 1, 0.6);
else if(block)
GlStateManager.translate(0, 1, 0.6);
break;
case SOUTH:
GlStateManager.translate(0, -1.6, -0.89);
if(block)
GlStateManager.translate(0, 1, 0.6);
if(mySon)
GlStateManager.translate(0, 1.4, 0.5);
else if(block)
GlStateManager.translate(0, 1.0, 0.5);
break;
case EAST:
if(block)
if(mySon)
GlStateManager.translate(-0.4F, 0.65F, 0F);
else if(block)
GlStateManager.translate(-0.4F, 0.8F, 0F);
else GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1.9F, 0.04F);
break;
case WEST:
if(block)
if(mySon)
GlStateManager.translate(1F, 0.65F, 1F);
else if(block)
GlStateManager.translate(1F, 0.8F, 1F);
else GlStateManager.rotate(-90F, 0F, 1F, 0F);
GlStateManager.translate(-0.3F, -1.9F, -0.92F);
break;
}
if(block)
if (mySon)
GlStateManager.scale(1.1, 1.1, 1.1);
else if(block)
GlStateManager.scale(0.5, 0.5, 0.5);
if(block && side != EnumFacing.NORTH)
GlStateManager.rotate(180F, 0, 1, 0);
renderItem(stack);
GlStateManager.popMatrix();
}
@@ -11,7 +11,7 @@
package vazkii.botania.common;
import net.minecraft.advancements.CriteriaTriggers;
import net.minecraft.advancements.ICriterionTrigger;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.MultiPartEntityPart;
import net.minecraft.entity.boss.EntityDragon;
@@ -38,7 +38,6 @@ import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.relauncher.ReflectionHelper;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import vazkii.botania.api.BotaniaAPI;
@@ -49,22 +48,17 @@ import vazkii.botania.common.advancements.*;
import vazkii.botania.common.block.ModBanners;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.ModMultiblocks;
import vazkii.botania.common.block.subtile.generating.SubTileNarslimmus;
import vazkii.botania.common.block.tile.TileLightRelay;
import vazkii.botania.common.block.tile.corporea.TileCorporeaIndex;
import vazkii.botania.common.brew.ModBrews;
import vazkii.botania.common.core.command.CommandDownloadLatest;
import vazkii.botania.common.core.command.CommandOpen;
import vazkii.botania.common.core.command.CommandShare;
import vazkii.botania.common.core.command.CommandSkyblockSpread;
import vazkii.botania.common.core.handler.BiomeDecorationHandler;
import vazkii.botania.common.core.handler.CommonTickHandler;
import vazkii.botania.common.core.handler.ConfigHandler;
import vazkii.botania.common.core.handler.IMCHandler;
import vazkii.botania.common.core.handler.InternalMethodHandler;
import vazkii.botania.common.core.handler.ManaNetworkHandler;
import vazkii.botania.common.core.handler.PixieHandler;
import vazkii.botania.common.core.handler.SheddingHandler;
import vazkii.botania.common.core.loot.LootHandler;
import vazkii.botania.common.core.proxy.IProxy;
import vazkii.botania.common.crafting.ModBrewRecipes;
@@ -90,6 +84,8 @@ import vazkii.botania.common.fixers.AttachedWills;
import vazkii.botania.common.fixers.CraftyCrateTE;
import vazkii.botania.common.fixers.FlattenItems;
import vazkii.botania.common.fixers.FlattenNBT;
import vazkii.botania.common.integration.buildcraft.StatementAPIPlugin;
import vazkii.botania.common.integration.thaumcraft.TCAspects;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibMisc;
import vazkii.botania.common.network.GuiHandler;
@@ -97,15 +93,13 @@ import vazkii.botania.common.network.PacketHandler;
import vazkii.botania.common.world.SkyblockWorldEvents;
import vazkii.botania.common.world.WorldTypeSkyblock;
import java.lang.reflect.InvocationTargetException;
@Mod(modid = LibMisc.MOD_ID, name = LibMisc.MOD_NAME, version = LibMisc.VERSION, dependencies = LibMisc.DEPENDENCIES, guiFactory = LibMisc.GUI_FACTORY)
public class Botania {
public static boolean gardenOfGlassLoaded = false;
public static boolean thaumcraftLoaded = false;
public static boolean bcTriggersLoaded = false;
public static boolean bcApiLoaded = false;
public static boolean bloodMagicLoaded = false;
public static boolean coloredLightsLoaded = false;
public static boolean etFuturumLoaded = false;
@@ -125,7 +119,7 @@ public class Botania {
gardenOfGlassLoaded = Loader.isModLoaded("gardenofglass");
thaumcraftLoaded = Loader.isModLoaded("thaumcraft");
bcTriggersLoaded = ModAPIManager.INSTANCE.hasAPI("BuildCraftAPI|statements");
bcApiLoaded = Loader.isModLoaded("buildcraftlib");
bloodMagicLoaded = Loader.isModLoaded("bloodmagic"); // Psh, noob
coloredLightsLoaded = Loader.isModLoaded("easycoloredlights");
etFuturumLoaded = Loader.isModLoaded("etfuturum");
@@ -180,21 +174,30 @@ public class Botania {
if(Botania.gardenOfGlassLoaded)
MinecraftForge.EVENT_BUS.register(SkyblockWorldEvents.class);
FMLInterModComms.sendMessage("ProjectE", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
FMLInterModComms.sendMessage("projecte", "interdictionblacklist", EntityManaBurst.class.getCanonicalName());
/*if(Botania.bcTriggersLoaded) todo buildcraft
new StatementAPIPlugin();*/
for(Block b : new Block[]{ ModBlocks.manaGlass, ModBlocks.elfGlass, ModBlocks.bifrostPerm })
FMLInterModComms.sendMessage("chiselsandbits", "ignoreblocklogic", b.getRegistryName().toString());
if(Botania.thaumcraftLoaded) {
if(ConfigHandler.enableThaumcraftAspects) {
MinecraftForge.EVENT_BUS.register(TCAspects.class);
}
ModBrews.initTC();
ModBrewRecipes.initTC();
}
if(Botania.bcApiLoaded)
new StatementAPIPlugin();
proxy.init(event);
}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {
if(Botania.thaumcraftLoaded) {
ModBrews.initTC();
ModBrewRecipes.initTC();
try {
@SuppressWarnings("unchecked")
Class<? extends Entity> clazz = (Class<? extends Entity>) Class.forName("thaumcraft.common.lib.aura.EntityAuraNode");
Class<? extends Entity> clazz = (Class<? extends Entity>) Class.forName("thaumcraft.common.entities.EntityFluxRift");
BotaniaAPI.blacklistEntityFromGravityRod(clazz);
} catch (ClassNotFoundException ignored) {}
}
@@ -86,7 +86,7 @@ public class BlockAlfPortal extends BlockMod implements IWandable, ILexiconable
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumFacing side) {
boolean did = ((TileAlfPortal) world.getTileEntity(pos)).onWanded();
if(!world.isRemote && did) {
if(!world.isRemote && did && player instanceof EntityPlayerMP) {
AlfPortalTrigger.INSTANCE.trigger((EntityPlayerMP) player, (WorldServer) world, pos, stack);
}
return did;
@@ -88,7 +88,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -103,7 +103,7 @@ public class BlockAltar extends BlockMod implements ILexiconable {
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity) {
if(!world.isRemote && entity instanceof EntityItem) {
TileAltar tile = (TileAltar) world.getTileEntity(pos);
if(tile.collideEntityItem((EntityItem) entity))
@@ -151,12 +151,12 @@ public class BlockAnimatedTorch extends BlockMod implements IWandable, IManaTrig
}
@Override
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state) {
public void onPlayerDestroy(World world, BlockPos pos, IBlockState state) {
// TE is already gone so best we can do is just notify everyone
for(EnumFacing side : EnumFacing.VALUES) {
world.notifyNeighborsOfStateChange(pos.offset(side), this, false);
}
super.onBlockDestroyedByPlayer(world, pos, state);
super.onPlayerDestroy(world, pos, state);
}
@Override
@@ -83,7 +83,7 @@ public class BlockAvatar extends BlockMod implements ILexiconable {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byIndex(meta));
}
@Override
@@ -72,7 +72,7 @@ public class BlockBifrostPerm extends BlockMod implements ILexiconable {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@@ -67,7 +67,7 @@ public class BlockCacophonium extends BlockMod {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0 || world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
@@ -73,7 +73,7 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity e) {
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity e) {
if(!world.isRemote && e instanceof EntityItem) {
EntityItem item = (EntityItem) e;
ItemStack stack = item.getItem();
@@ -87,8 +87,6 @@ public class BlockCocoon extends BlockMod implements ILexiconable {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
ItemStack stack = player.getHeldItem(hand);
Item item = stack.getItem();
return addStack(world, pos, stack, player.capabilities.isCreativeMode);
}
@@ -67,7 +67,7 @@ public class BlockFelPumpkin extends BlockMod implements ILexiconable {
@Nonnull
@Override
public IBlockState getStateFromMeta(int meta) {
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getHorizontal(meta));
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byHorizontalIndex(meta));
}
@Override
@@ -42,7 +42,7 @@ public class BlockGaiaHead extends BlockSkull implements IModelRegister {
public BlockGaiaHead() {
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GAIA_HEAD));
setUnlocalizedName(LibBlockNames.GAIA_HEAD);
setTranslationKey(LibBlockNames.GAIA_HEAD);
setHardness(1.0F);
}
@@ -49,7 +49,7 @@ public class BlockGhostRail extends BlockRailBase implements ILexiconable, IMode
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.RAIL_DIRECTION, EnumRailDirection.NORTH_SOUTH));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.GHOST_RAIL));
setUnlocalizedName(LibBlockNames.GHOST_RAIL);
setTranslationKey(LibBlockNames.GHOST_RAIL);
}
@Nonnull
@@ -66,7 +66,7 @@ public class BlockIncensePlate extends BlockMod implements ILexiconable {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byIndex(meta));
}
@Override
@@ -89,7 +89,7 @@ public class BlockLightLauncher extends BlockMod implements ILexiconable {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0|| world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0|| world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
@@ -30,7 +30,7 @@ public abstract class BlockMod extends Block implements IModelRegister {
public BlockMod(Material par2Material, String name) {
super(par2Material);
setUnlocalizedName(name);
setTranslationKey(name);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
if(registerInCreative())
setCreativeTab(BotaniaCreativeTab.INSTANCE);
@@ -63,7 +63,7 @@ public abstract class BlockModDoubleFlower extends BlockDoublePlant implements I
String name = LibBlockNames.DOUBLE_FLOWER + (second ? 2 : 1);
setDefaultState(pickDefaultState());
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
setUnlocalizedName(name);
setTranslationKey(name);
setHardness(0F);
setTickRandomly(false);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
@@ -26,6 +26,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.client.model.ModelLoader;
@@ -55,7 +56,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowab
}
protected BlockModFlower(String name) {
setUnlocalizedName(name);
setTranslationKey(name);
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
setHardness(0F);
@@ -124,9 +125,13 @@ public class BlockModFlower extends BlockFlower implements ILexiconable, IGrowab
int r = (hex & 0xFF0000) >> 16;
int g = (hex & 0xFF00) >> 8;
int b = hex & 0xFF;
Vec3d offset = state.getOffset(world, pos);
double x = pos.getX() + offset.x;
double y = pos.getY() + offset.y;
double z = pos.getZ() + offset.z;
if(rand.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(pos.getX() + 0.3 + rand.nextFloat() * 0.5, pos.getY() + 0.5 + rand.nextFloat() * 0.5, pos.getZ() + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
Botania.proxy.sparkleFX(x + 0.3 + rand.nextFloat() * 0.5, y + 0.5 + rand.nextFloat() * 0.5, z + 0.3 + rand.nextFloat() * 0.5, r / 255F, g / 255F, b / 255F, rand.nextFloat(), 5);
}
@Override
@@ -221,7 +221,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
world.setBlockState(pos.offset(dir), ModBlocks.pistonRelay.getDefaultState());
else if(!world.isRemote) {
ItemStack stack = new ItemStack(ModBlocks.pistonRelay);
world.spawnEntity(new EntityItem(world, x + dir.getFrontOffsetX(), y + dir.getFrontOffsetY(), z + dir.getFrontOffsetZ(), stack));
world.spawnEntity(new EntityItem(world, x + dir.getXOffset(), y + dir.getYOffset(), z + dir.getZOffset(), stack));
}
checkedCoords.add(s);
newPos = new DimWithPos(world.provider.getDimension(), pos.offset(dir));
@@ -237,7 +237,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
TileEntity tile = world.getTileEntity(pos2);
Material mat = srcState.getMaterial();
if(!sticky && tile == null && mat.getMobilityFlag() == EnumPushReaction.NORMAL && srcState.getBlockHardness(world, pos2) != -1 && !srcState.getBlock().isAir(srcState, world, pos2)) {
if(!sticky && tile == null && mat.getPushReaction() == EnumPushReaction.NORMAL && srcState.getBlockHardness(world, pos2) != -1 && !srcState.getBlock().isAir(srcState, world, pos2)) {
Material destMat = world.getBlockState(pos2.offset(dir)).getMaterial();
if(world.isAirBlock(pos2.offset(dir)) || destMat.isReplaceable()) {
world.setBlockState(pos2, Blocks.AIR.getDefaultState());
@@ -35,7 +35,7 @@ public class BlockSolidVines extends BlockVine implements ILexiconable {
public BlockSolidVines() {
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SOLID_VINE));
setUnlocalizedName(LibBlockNames.SOLID_VINE);
setTranslationKey(LibBlockNames.SOLID_VINE);
setHardness(0.5F);
setSoundType(SoundType.PLANT);
setCreativeTab(null);
@@ -91,7 +91,7 @@ public class BlockSparkChanger extends BlockMod implements ILexiconable {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0 || world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
@@ -122,7 +122,7 @@ public class BlockSpecialFlower extends BlockFlower implements ISpecialFlower, I
protected BlockSpecialFlower() {
setDefaultState(blockState.getBaseState().withProperty(BotaniaStateProps.COLOR, EnumDyeColor.WHITE).withProperty(type, EnumFlowerType.POPPY));
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.SPECIAL_FLOWER));
setUnlocalizedName(LibBlockNames.SPECIAL_FLOWER);
setTranslationKey(LibBlockNames.SPECIAL_FLOWER);
setHardness(0.1F);
setSoundType(SoundType.PLANT);
setTickRandomly(false);
@@ -54,7 +54,7 @@ public class BlockTeruTeruBozu extends BlockMod implements ILexiconable {
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity e) {
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity e) {
if(!world.isRemote && e instanceof EntityItem) {
EntityItem item = (EntityItem) e;
ItemStack stack = item.getItem();
@@ -33,20 +33,7 @@ import vazkii.botania.common.block.corporea.BlockCorporeaFunnel;
import vazkii.botania.common.block.corporea.BlockCorporeaIndex;
import vazkii.botania.common.block.corporea.BlockCorporeaInterceptor;
import vazkii.botania.common.block.corporea.BlockCorporeaRetainer;
import vazkii.botania.common.block.decor.BlockBlaze;
import vazkii.botania.common.block.decor.BlockBuriedPetals;
import vazkii.botania.common.block.decor.BlockAzulejo;
import vazkii.botania.common.block.decor.BlockElfGlass;
import vazkii.botania.common.block.decor.BlockFloatingFlower;
import vazkii.botania.common.block.decor.BlockManaFlame;
import vazkii.botania.common.block.decor.BlockManaGlass;
import vazkii.botania.common.block.decor.BlockModMushroom;
import vazkii.botania.common.block.decor.BlockPetalBlock;
import vazkii.botania.common.block.decor.BlockShimmerrock;
import vazkii.botania.common.block.decor.BlockShimmerwoodPlanks;
import vazkii.botania.common.block.decor.BlockShinyFlower;
import vazkii.botania.common.block.decor.BlockStarfield;
import vazkii.botania.common.block.decor.BlockTinyPotato;
import vazkii.botania.common.block.decor.*;
import vazkii.botania.common.block.dispenser.BehaviourFelPumpkin;
import vazkii.botania.common.block.dispenser.BehaviourPoolMinecart;
import vazkii.botania.common.block.dispenser.BehaviourWand;
@@ -538,7 +525,7 @@ public final class ModBlocks {
r.register(new ItemBlockMod(pump).setRegistryName(pump.getRegistryName()));
r.register(new ItemBlockWithMetadataAndName(doubleFlower1).setRegistryName(doubleFlower1.getRegistryName()));
r.register(new ItemBlockWithMetadataAndName(doubleFlower2).setRegistryName(doubleFlower2.getRegistryName()));
r.register(new ItemBlockMod(blazeBlock).setRegistryName(blazeBlock.getRegistryName()));
r.register(new ItemBlockBlaze(blazeBlock).setRegistryName(blazeBlock.getRegistryName()));
r.register(new ItemBlockMod(corporeaInterceptor).setRegistryName(corporeaInterceptor.getRegistryName()));
r.register(new ItemBlockMod(corporeaCrystalCube).setRegistryName(corporeaCrystalCube.getRegistryName()));
r.register(new ItemBlockMod(incensePlate).setRegistryName(incensePlate.getRegistryName()));
@@ -714,7 +701,7 @@ public final class ModBlocks {
for(Class innerClazz : clazz.getDeclaredClasses())
if(innerClazz.getSimpleName().equals("Mini"))
BotaniaAPI.registerMiniSubTile(new ResourceLocation(key.getResourceDomain(), key.getResourcePath() + "Chibi"), innerClazz, key);
BotaniaAPI.registerMiniSubTile(new ResourceLocation(key.getNamespace(), key.getPath() + "Chibi"), innerClazz, key);
}
private static void registerTile(Class<? extends TileEntity> clazz, String key) {
@@ -128,7 +128,7 @@ public class BlockCorporeaCrystalCube extends BlockCorporeaBase implements ILexi
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).compValue;
return ((TileCorporeaCrystalCube) world.getTileEntity(pos)).getComparatorValue();
}
@Nonnull
@@ -57,7 +57,7 @@ public class BlockCorporeaFunnel extends BlockCorporeaBase implements ILexiconab
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0 || world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
@@ -58,7 +58,7 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable {
@Override
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos) {
boolean power = world.isBlockIndirectlyGettingPowered(pos) > 0 || world.isBlockIndirectlyGettingPowered(pos.up()) > 0;
boolean power = world.getRedstonePowerFromNeighbors(pos) > 0 || world.getRedstonePowerFromNeighbors(pos.up()) > 0;
boolean powered = state.getValue(BotaniaStateProps.POWERED);
if(power && !powered) {
@@ -75,7 +75,7 @@ public class BlockCorporeaRetainer extends BlockMod implements ILexiconable {
@Override
public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos) {
return ((TileCorporeaRetainer) world.getTileEntity(pos)).hasPendingRequest() ? 15 : 0;
return ((TileCorporeaRetainer) world.getTileEntity(pos)).getComparatorValue();
}
@Override
@@ -13,22 +13,16 @@ package vazkii.botania.common.block.decor;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.IFuelHandler;
import net.minecraftforge.fml.common.registry.GameRegistry;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
public class BlockBlaze extends BlockMod implements ILexiconable, IFuelHandler {
public class BlockBlaze extends BlockMod implements ILexiconable {
public BlockBlaze() {
super(Material.IRON, LibBlockNames.BLAZE_BLOCK);
@@ -36,17 +30,10 @@ public class BlockBlaze extends BlockMod implements ILexiconable, IFuelHandler {
setResistance(10F);
setSoundType(SoundType.METAL);
setLightLevel(1F);
GameRegistry.registerFuelHandler(this);
}
@Override
public LexiconEntry getEntry(World world, BlockPos pos, EntityPlayer player, ItemStack lexicon) {
return LexiconData.blazeBlock;
}
@Override
public int getBurnTime(ItemStack fuel) {
return fuel.getItem() == Item.getItemFromBlock(this) ? TileEntityFurnace.getItemBurnTime(new ItemStack(Items.BLAZE_ROD)) * (Botania.gardenOfGlassLoaded ? 5 : 10) : 0;
}
}
@@ -92,8 +92,9 @@ public class BlockFloatingFlower extends BlockMod implements ILexiconable, IInfu
}
@Nonnull
@SideOnly(Side.CLIENT)
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT;
}
@@ -31,12 +31,12 @@ import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.items.ItemHandlerHelper;
import vazkii.botania.api.lexicon.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.BlockMod;
import vazkii.botania.common.block.tile.TileManaFlame;
import vazkii.botania.common.item.ModItems;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockNames;
import vazkii.botania.common.world.WorldTypeSkyblock;
import javax.annotation.Nonnull;
import java.util.Random;
@@ -98,7 +98,7 @@ public class BlockManaFlame extends BlockMod implements ILexiconable {
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing s, float xs, float ys, float zs) {
if(WorldTypeSkyblock.isWorldSkyblock(world)) {
if(Botania.gardenOfGlassLoaded) {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty() && stack.getItem() == Item.getItemFromBlock(Blocks.SAPLING) && !player.inventory.hasItemStack(new ItemStack(ModItems.lexicon))) {
if(!world.isRemote) {
@@ -64,7 +64,7 @@ public class BlockManaGlass extends BlockMod implements ILexiconable {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@@ -55,7 +55,7 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
public BlockModMushroom() {
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, LibBlockNames.MUSHROOM));
setUnlocalizedName(LibBlockNames.MUSHROOM);
setTranslationKey(LibBlockNames.MUSHROOM);
setLightLevel(0.2F);
setHardness(0F);
setSoundType(SoundType.PLANT);
@@ -162,11 +162,6 @@ public class BlockModMushroom extends BlockMushroom implements IInfusionStabilis
ModelHandler.registerCustomItemblock(this, EnumDyeColor.values().length, i -> "mushroom_" + EnumDyeColor.byMetadata(i).getName());
}
@Override
public boolean canFit(ItemStack stack, IPetalApothecary apothecary) {
return true;
}
@Override
public int getParticleColor(ItemStack stack) {
return EnumDyeColor.byMetadata(stack.getItemDamage()).colorValue;
@@ -57,7 +57,7 @@ public class BlockStarfield extends BlockMod implements ILexiconable {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.CUTOUT_MIPPED;
}
@@ -0,0 +1,20 @@
package vazkii.botania.common.block.decor;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntityFurnace;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.block.ItemBlockMod;
public class ItemBlockBlaze extends ItemBlockMod {
public ItemBlockBlaze(Block block) {
super(block);
}
@Override
public int getItemBurnTime(ItemStack stack) {
return TileEntityFurnace.getItemBurnTime(new ItemStack(Items.BLAZE_ROD))
* (Botania.gardenOfGlassLoaded ? 5 : 10);
}
}
@@ -12,6 +12,10 @@ package vazkii.botania.common.block.decor.biomestone;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import vazkii.botania.api.state.BotaniaStateProps;
@@ -49,12 +53,9 @@ public class BlockBiomeStoneA extends BlockBiomeStone {
}
@Override
public int damageDropped(IBlockState state) {
int meta = getMetaFromState(state);
if (meta < 8) {
meta += 8; // Drop cobblestone variant
}
return meta;
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
int cobbleMeta = getMetaFromState(state) | 0x8;
drops.add(new ItemStack(this, 1, cobbleMeta));
}
@SideOnly(Side.CLIENT)
@@ -27,7 +27,7 @@ public class BlockAlfglassPane extends BlockModPane {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@@ -27,7 +27,7 @@ public class BlockBifrostPane extends BlockModPane {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@@ -27,7 +27,7 @@ public class BlockManaglassPane extends BlockModPane {
@SideOnly(Side.CLIENT)
@Nonnull
@Override
public BlockRenderLayer getBlockLayer() {
public BlockRenderLayer getRenderLayer() {
return BlockRenderLayer.TRANSLUCENT;
}
@@ -30,9 +30,9 @@ public class BlockModPane extends BlockPane implements IModelRegister {
public BlockModPane(Block source) {
super(Material.GLASS, false);
// Backward compat don't kill me
String name = source.getUnlocalizedName().replaceAll("tile.", "") + "Pane";
String name = source.getTranslationKey().replaceAll("tile.", "") + "Pane";
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
setUnlocalizedName(name);
setTranslationKey(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
setHardness(0.3F);
setSoundType(SoundType.GLASS);
@@ -7,7 +7,7 @@ public abstract class BlockLivingSlab extends BlockModSlab {
final IBlockState sourceState;
public BlockLivingSlab(boolean full, IBlockState state) {
super(full, state.getMaterial(), state.getBlock().getUnlocalizedName().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Slab" + (full ? "Full" : ""));
super(full, state.getMaterial(), state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Slab" + (full ? "Full" : ""));
setSoundType(state.getBlock().getSoundType());
sourceState = state;
}
@@ -40,7 +40,7 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
public BlockModSlab(boolean full, Material mat, String name) {
super(mat);
this.name = name;
setUnlocalizedName(name);
setTranslationKey(name);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
doubleSlab = full;
if(!full) {
@@ -101,7 +101,7 @@ public abstract class BlockModSlab extends BlockSlab implements ILexiconable, IM
@Nonnull
@Override
public String getUnlocalizedName(int i) {
public String getTranslationKey(int i) {
return name;
}
@@ -5,7 +5,7 @@ import net.minecraft.block.state.IBlockState;
public class BlockLivingStairs extends BlockModStairs {
public BlockLivingStairs(IBlockState state) {
super(state, state.getBlock().getUnlocalizedName().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Stairs");
super(state, state.getBlock().getTranslationKey().replaceAll("tile.", "") + state.getBlock().getMetaFromState(state) + "Stairs");
}
}
@@ -24,7 +24,7 @@ public class BlockModStairs extends BlockStairs implements ILexiconable, IModelR
public BlockModStairs(IBlockState state, String name) {
super(state);
setRegistryName(new ResourceLocation(LibMisc.MOD_ID, name));
setUnlocalizedName(name);
setTranslationKey(name);
setCreativeTab(BotaniaCreativeTab.INSTANCE);
useNeighborBrightness = true;
}
@@ -38,9 +38,9 @@ public abstract class BlockModWall extends BlockWall implements ILexiconable, IM
public BlockModWall(Block block, int meta) {
super(block);
// For backward compat don't kill me
String name = block.getUnlocalizedName().replaceAll("tile.", "") + meta + "Wall";
String name = block.getTranslationKey().replaceAll("tile.", "") + meta + "Wall";
setRegistryName(name);
setUnlocalizedName(name);
setTranslationKey(name);
setDefaultState(pickDefaultState());
setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@@ -32,9 +32,9 @@ public class BehaviourPoolMinecart extends BehaviorDefaultDispenseItem {
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
EnumFacing enumfacing = world.getBlockState(source.getBlockPos()).getValue(BlockDispenser.FACING);
double d0 = source.getX() + enumfacing.getFrontOffsetX() * 1.125F;
double d1 = source.getY() + enumfacing.getFrontOffsetY() * 1.125F;
double d2 = source.getZ() + enumfacing.getFrontOffsetZ() * 1.125F;
double d0 = source.getX() + enumfacing.getXOffset() * 1.125F;
double d1 = source.getY() + enumfacing.getYOffset() * 1.125F;
double d2 = source.getZ() + enumfacing.getZOffset() * 1.125F;
BlockPos pos = source.getBlockPos().offset(enumfacing);
IBlockState state = world.getBlockState(pos);
double d3;
@@ -72,7 +72,7 @@ public class BlockBellows extends BlockMod implements ILexiconable {
if (meta < 2 || meta > 5) {
meta = 2;
}
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.getFront(meta));
return getDefaultState().withProperty(BotaniaStateProps.CARDINALS, EnumFacing.byIndex(meta));
}
@Nonnull
@@ -87,8 +87,10 @@ public class BlockBrewery extends BlockMod implements ILexiconable, IWandHUD {
TileBrewery brew = (TileBrewery) world.getTileEntity(pos);
if(player.isSneaking()) {
if(brew.recipe == null && !state.getValue(BotaniaStateProps.POWERED))
if(brew.recipe == null && !state.getValue(BotaniaStateProps.POWERED)) {
InventoryHelper.withdrawFromInventory(brew, player);
return true;
}
} else {
ItemStack stack = player.getHeldItem(hand);
if(!stack.isEmpty())
@@ -138,10 +138,10 @@ public class BlockPool extends BlockMod implements IWandHUD, IWandable, ILexicon
}
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity par5Entity) {
if(par5Entity instanceof EntityItem) {
public void onEntityCollision(World world, BlockPos pos, IBlockState state, Entity entity) {
if(entity instanceof EntityItem) {
TilePool tile = (TilePool) world.getTileEntity(pos);
if(tile.collideEntityItem((EntityItem) par5Entity))
if(tile.collideEntityItem((EntityItem) entity))
VanillaPacketDispatcher.dispatchTEToNearbyPlayers(world, pos);
}
}
Loaded 100 of 254 files, more files were not shown because too many files have changed in this diff. Show more