Given source
This commit is contained in:
commit
71dddda6cb
370 changed files with 29210 additions and 0 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
109
build.gradle
Normal file
109
build.gradle
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
maven {
|
||||||
|
name = "forge"
|
||||||
|
url = "http://files.minecraftforge.net/maven"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'net.minecraftforge.gradle.forge'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "CurseForge"
|
||||||
|
url = "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// JEI & TiC
|
||||||
|
name = "progwml6"
|
||||||
|
url = "http://dvs1.progwml6.com/files/maven/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// CraftTweaker
|
||||||
|
name = "blamejared"
|
||||||
|
url = "http://maven.blamejared.com/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// General
|
||||||
|
name = "mcmoddev"
|
||||||
|
url = "https://maven.mcmoddev.com"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// Fallbacks
|
||||||
|
name = "ModMaven"
|
||||||
|
url = "https://modmaven.k-4u.nl"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
// ICBM
|
||||||
|
name = "builtbroken"
|
||||||
|
url = "http://api.dmodoomsirius.me/com/builtbroken"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
version = "${mod_version}-${mc_version}"
|
||||||
|
group = "trinity"
|
||||||
|
archivesBaseName = "Trinity"
|
||||||
|
sourceCompatibility = targetCompatibility = '1.8'
|
||||||
|
compileJava {
|
||||||
|
sourceCompatibility = targetCompatibility = '1.8'
|
||||||
|
}
|
||||||
|
|
||||||
|
minecraft {
|
||||||
|
version = "${mc_version}-${forge_version}"
|
||||||
|
runDir = "run"
|
||||||
|
replace "@VERSION@", "${mod_version}"
|
||||||
|
mappings = "${mapping_version}"
|
||||||
|
makeObfSourceJar = true
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// compile against the JEI API but do not include it at runtime
|
||||||
|
deobfProvided "mezz.jei:jei_${mc_version}:${jei_version}:api"
|
||||||
|
// at runtime, use the full JEI jar
|
||||||
|
runtime "mezz.jei:jei_${mc_version}:${jei_version}"
|
||||||
|
//deobfCompile "baubles:Baubles:${baubles_version}"
|
||||||
|
deobfCompile ("cofh:CoFHCore:${cofh_core_version}:universal") {
|
||||||
|
transitive = false
|
||||||
|
}
|
||||||
|
deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:${crafttweaker_version}"
|
||||||
|
//deobfCompile "nuclearcraft-mod:NuclearCraft:2.18k:1.12.2"
|
||||||
|
compileOnly "thaumcraft:Thaumcraft:1.12.2:6.1.BETA26"
|
||||||
|
deobfCompile "nuclearcraft-overhauled:NuclearCraft:2o.4.5:1.12.2"
|
||||||
|
deobfCompile "icbm-classic:ICBM-Classic:1.12.2-4.0.0b74"
|
||||||
|
deobfCompile "mcjty.theoneprobe:TheOneProbe-1.12:1.12-1.4.28-17"
|
||||||
|
deobfCompile "mekanism:Mekanism:${mekanism_version}"
|
||||||
|
deobfCompile "li.cil.oc:OpenComputers:${oc_version}"
|
||||||
|
|
||||||
|
deobfCompile "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
|
||||||
|
}
|
||||||
|
|
||||||
|
processResources {
|
||||||
|
exclude '**/Thumbs.db'
|
||||||
|
|
||||||
|
inputs.property "version", project.version
|
||||||
|
inputs.property "mcversion", project.minecraft.version
|
||||||
|
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
include 'mcmod.info'
|
||||||
|
expand 'version':project.version, 'mcversion':project.minecraft.version
|
||||||
|
}
|
||||||
|
|
||||||
|
from(sourceSets.main.resources.srcDirs) {
|
||||||
|
exclude 'mcmod.info'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task deobfJar(type: Jar) {
|
||||||
|
from sourceSets.main.output
|
||||||
|
classifier = 'deobf'
|
||||||
|
}
|
||||||
|
|
||||||
|
artifacts {
|
||||||
|
archives deobfJar
|
||||||
|
}
|
22
gradle.properties
Normal file
22
gradle.properties
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
mc_version=1.12.2
|
||||||
|
forge_version=14.23.5.2838
|
||||||
|
mapping_version=stable_39
|
||||||
|
mod_version=2.18h
|
||||||
|
|
||||||
|
ic2_version=2.8.170-ex112
|
||||||
|
jei_version=4.15.0.+
|
||||||
|
crafttweaker_version=1.12-4.1.19.+
|
||||||
|
mantle_version=1.12-1.3.3.55
|
||||||
|
tic_version=1.12.2-2.12.0.157
|
||||||
|
oc_version=MC1.12.2-1.7.4.+
|
||||||
|
cofh_core_version=1.12.2-4.6.3.+
|
||||||
|
common_capabilities_version=2.4.4-309
|
||||||
|
gamestages_version=2.0.+
|
||||||
|
|
||||||
|
baubles_version=1.12:1.5.2
|
||||||
|
conarm_version=1.12.2:1.2.4
|
||||||
|
gregtech_version=1.12.2:1.8.4.419
|
||||||
|
mekanism_version=1.12.2:9.8.0.381
|
||||||
|
projecte_version=1.12.2:PE1.4.1
|
||||||
|
|
||||||
|
org.gradle.jvmargs=-Xmx4G
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#Mon Sep 14 12:28:28 PDT 2015
|
||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
|
164
gradlew
vendored
Normal file
164
gradlew
vendored
Normal file
|
@ -0,0 +1,164 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
##############################################################################
|
||||||
|
##
|
||||||
|
## Gradle start up script for UN*X
|
||||||
|
##
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
# Need this for relative symlinks.
|
||||||
|
while [ -h "$PRG" ] ; do
|
||||||
|
ls=`ls -ld "$PRG"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
PRG="$link"
|
||||||
|
else
|
||||||
|
PRG=`dirname "$PRG"`"/$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
SAVED="`pwd`"
|
||||||
|
cd "`dirname \"$PRG\"`/" >&-
|
||||||
|
APP_HOME="`pwd -P`"
|
||||||
|
cd "$SAVED" >&-
|
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM.
|
||||||
|
if [ -n "$JAVA_HOME" ] ; then
|
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||||
|
# IBM's JDK on AIX uses strange locations for the executables
|
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||||
|
else
|
||||||
|
JAVACMD="$JAVA_HOME/bin/java"
|
||||||
|
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
|
||||||
|
MAX_FD_LIMIT=`ulimit -H -n`
|
||||||
|
if [ $? -eq 0 ] ; then
|
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||||
|
MAX_FD="$MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
ulimit -n $MAX_FD
|
||||||
|
if [ $? -ne 0 ] ; then
|
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock
|
||||||
|
if $darwin; then
|
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
|
if $cygwin ; then
|
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath
|
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||||
|
SEP=""
|
||||||
|
for dir in $ROOTDIRSRAW ; do
|
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||||
|
SEP="|"
|
||||||
|
done
|
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||||
|
# Add a user-defined pattern to the cygpath arguments
|
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||||
|
fi
|
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||||
|
i=0
|
||||||
|
for arg in "$@" ; do
|
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||||
|
else
|
||||||
|
eval `echo args$i`="\"$arg\""
|
||||||
|
fi
|
||||||
|
i=$((i+1))
|
||||||
|
done
|
||||||
|
case $i in
|
||||||
|
(0) set -- ;;
|
||||||
|
(1) set -- "$args0" ;;
|
||||||
|
(2) set -- "$args0" "$args1" ;;
|
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||||
|
function splitJvmOpts() {
|
||||||
|
JVM_OPTS=("$@")
|
||||||
|
}
|
||||||
|
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||||
|
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||||
|
|
||||||
|
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
90
gradlew.bat
vendored
Normal file
90
gradlew.bat
vendored
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
@if "%DEBUG%" == "" @echo off
|
||||||
|
@rem ##########################################################################
|
||||||
|
@rem
|
||||||
|
@rem Gradle startup script for Windows
|
||||||
|
@rem
|
||||||
|
@rem ##########################################################################
|
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell
|
||||||
|
if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
|
set DIRNAME=%~dp0
|
||||||
|
if "%DIRNAME%" == "" set DIRNAME=.
|
||||||
|
set APP_BASE_NAME=%~n0
|
||||||
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@rem Find java.exe
|
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
|
set JAVA_EXE=java.exe
|
||||||
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
|
if "%ERRORLEVEL%" == "0" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:findJavaFromJavaHome
|
||||||
|
set JAVA_HOME=%JAVA_HOME:"=%
|
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||||
|
echo.
|
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the
|
||||||
|
echo location of your Java installation.
|
||||||
|
|
||||||
|
goto fail
|
||||||
|
|
||||||
|
:init
|
||||||
|
@rem Get command-line arguments, handling Windowz variants
|
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||||
|
if "%@eval[2+2]" == "4" goto 4NT_args
|
||||||
|
|
||||||
|
:win9xME_args
|
||||||
|
@rem Slurp the command line arguments.
|
||||||
|
set CMD_LINE_ARGS=
|
||||||
|
set _SKIP=2
|
||||||
|
|
||||||
|
:win9xME_args_slurp
|
||||||
|
if "x%~1" == "x" goto execute
|
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%*
|
||||||
|
goto execute
|
||||||
|
|
||||||
|
:4NT_args
|
||||||
|
@rem Get arguments from the 4NT Shell from JP Software
|
||||||
|
set CMD_LINE_ARGS=%$
|
||||||
|
|
||||||
|
:execute
|
||||||
|
@rem Setup the command line
|
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
|
@rem Execute Gradle
|
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||||
|
|
||||||
|
:end
|
||||||
|
@rem End local scope for the variables with windows NT shell
|
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||||
|
|
||||||
|
:fail
|
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
|
rem the _cmd.exe /c_ return code!
|
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:mainEnd
|
||||||
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
||||||
|
:omega
|
10
src/main/java/trinity/Global.java
Normal file
10
src/main/java/trinity/Global.java
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
package trinity;
|
||||||
|
|
||||||
|
public class Global {
|
||||||
|
|
||||||
|
public static final String MOD_ID = "trinity";
|
||||||
|
public static final String MOD_SHORT_ID = "trinity";
|
||||||
|
public static final String MOD_NAME = "Trinity";
|
||||||
|
public static final String VERSION = "1.4.b";
|
||||||
|
public static final String DEPENDENCIES = "nuclearcraft;";
|
||||||
|
}
|
88
src/main/java/trinity/Trinity.java
Normal file
88
src/main/java/trinity/Trinity.java
Normal file
|
@ -0,0 +1,88 @@
|
||||||
|
package trinity;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Ordering;
|
||||||
|
|
||||||
|
import nc.handler.GuiHandler;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.gui.GuiHandlerRegistry;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.TrinityRecipes;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
//import nca.worldgen.OreGen;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||||
|
import net.minecraftforge.fml.common.Mod.Instance;
|
||||||
|
import net.minecraftforge.fml.common.SidedProxy;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import scala.actors.threadpool.Arrays;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Mod(modid = trinity.util.Reference.MODID, name = trinity.util.Reference.NAME, version = trinity.util.Reference.VERSION, dependencies = trinity.util.Reference.REQUIREMENT)
|
||||||
|
|
||||||
|
public class Trinity {
|
||||||
|
|
||||||
|
static { FluidRegistry.enableUniversalBucket(); }
|
||||||
|
|
||||||
|
@Instance
|
||||||
|
public static Trinity instance;
|
||||||
|
|
||||||
|
@SidedProxy(clientSide = "trinity.proxy.ClientProxy", serverSide = "trinity.proxy.CommonProxy")
|
||||||
|
public static trinity.proxy.CommonProxy proxy;
|
||||||
|
|
||||||
|
//public static Comparator<ItemStack> trinityOrder;
|
||||||
|
|
||||||
|
public static boolean TCLoaded;
|
||||||
|
|
||||||
|
public static boolean ICBMLoaded;
|
||||||
|
|
||||||
|
//public static boolean DELoaded;
|
||||||
|
|
||||||
|
public static boolean QMDLoaded;
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void preInit(FMLPreInitializationEvent preEvent) {
|
||||||
|
TCLoaded = Loader.isModLoaded("thaumcraft");
|
||||||
|
ICBMLoaded = Loader.isModLoaded("icbmclassic");
|
||||||
|
QMDLoaded = Loader.isModLoaded("qmd");
|
||||||
|
TrinityConfig.preInit();
|
||||||
|
proxy.preInit(preEvent);
|
||||||
|
proxy.registerRenderInfo();
|
||||||
|
|
||||||
|
|
||||||
|
//trinityOrder = Ordering<ItemStack>.explicit(valuesInOrder)
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void Init(FMLInitializationEvent event) {
|
||||||
|
proxy.init(event);
|
||||||
|
//NetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());
|
||||||
|
NetworkRegistry.INSTANCE.registerGuiHandler(this, GuiHandlerRegistry.getInstance());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void PostInit(FMLPostInitializationEvent postEvent) {
|
||||||
|
proxy.postInit(postEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onIdMapping(FMLModIdMappingEvent idMappingEvent)
|
||||||
|
{
|
||||||
|
proxy.onIdMapping(idMappingEvent);
|
||||||
|
}
|
||||||
|
}
|
123
src/main/java/trinity/blocks/AntimatterBomb.java
Normal file
123
src/main/java/trinity/blocks/AntimatterBomb.java
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import io.netty.util.internal.ThreadLocalRandom;
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.entities.EntityShockwave;
|
||||||
|
import trinity.entities.EntityThermonuclearBlast;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.ThermonuclearBomb;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class AntimatterBomb extends Block {
|
||||||
|
|
||||||
|
public int blastRadius;
|
||||||
|
|
||||||
|
public AntimatterBomb(String nameIn, Material material, int blastRadius) {
|
||||||
|
super(material);
|
||||||
|
this.blastRadius=blastRadius;
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
setSoundType(blockSoundType.METAL);
|
||||||
|
this.setHardness(2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
tooltip.add("Crater Radius: "+this.blastRadius);
|
||||||
|
tooltip.add("Thermal Radius: "+this.blastRadius*TrinityConfig.fallout_multiplier*2);
|
||||||
|
|
||||||
|
tooltip.add(TextFormatting.DARK_BLUE+"Leaves no radioactivity behind.");
|
||||||
|
tooltip.add(TextFormatting.DARK_RED+"Danger: Will explode if exposed to explosions!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||||
|
{
|
||||||
|
AtomicBomb(world,pos,this.blastRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
AtomicBomb(world,pos,this.blastRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
if(world.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
world.scheduleUpdate(pos, this, 600);
|
||||||
|
//AtomicBomb(world,pos,this.blastRadius, this.salted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @SideOnly(Side.CLIENT)
|
||||||
|
public void randomDisplayTick(IBlockState stateIn, World world, BlockPos pos, Random rand)
|
||||||
|
{
|
||||||
|
world.spawnParticle(EnumParticleTypes.SUSPENDED_DEPTH, pos.getX()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getY()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getZ()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), 0, 0, 0);
|
||||||
|
//this.randomDisplayTick(stateIn, world, pos, rand);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
public static void AtomicBomb(World world, BlockPos pos, int blastRadius)
|
||||||
|
{
|
||||||
|
//boolean antimatter = world.getBlockState(pos).getBlock()==ModBlocks.bomb_antimatter;
|
||||||
|
//System.out.println("This is not a thermonuclear bomb");
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(world, 1000, (Math.min(blastRadius,TrinityConfig.max_radius)*2) * 0.005F);
|
||||||
|
entity2.posX = pos.getX();
|
||||||
|
entity2.posY = pos.getY();
|
||||||
|
entity2.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(entity2);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
ExplosionNukeGeneric.irradiate(world, pos.getX(), pos.getY(), pos.getZ(), Math.min(blastRadius,TrinityConfig.max_radius)*6);
|
||||||
|
world.spawnEntity(EntityNuclearExplosion.statFacAntimatter(world, Math.min(blastRadius,TrinityConfig.max_radius), pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
83
src/main/java/trinity/blocks/BasicBlock.java
Normal file
83
src/main/java/trinity/blocks/BasicBlock.java
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
public class BasicBlock extends Block {
|
||||||
|
|
||||||
|
public BasicBlock(String nameIn, Material material) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 0);
|
||||||
|
// setSoundType(blockSoundType.GROUND);
|
||||||
|
this.setHardness(2F);
|
||||||
|
// this.setTickRandomly(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.trinitite)
|
||||||
|
{
|
||||||
|
ItemStack block = new ItemStack(Blocks.SAND, 1);
|
||||||
|
EntityItem sand = new EntityItem(world);
|
||||||
|
sand.setItem(block);
|
||||||
|
|
||||||
|
ItemStack shard = new ItemStack(ModItems.trinitite, 1);
|
||||||
|
EntityItem trinitite = new EntityItem(world);
|
||||||
|
trinitite.setItem(shard);
|
||||||
|
trinitite.posX = pos.getX();
|
||||||
|
trinitite.posY = pos.getY();
|
||||||
|
trinitite.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(trinitite);
|
||||||
|
world.spawnEntity(sand);
|
||||||
|
}
|
||||||
|
super.onBlockHarvested(world, pos, state, player);
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.trinitite)
|
||||||
|
{
|
||||||
|
ItemStack shard = new ItemStack(ModItems.trinitite, 1);
|
||||||
|
ItemStack block = new ItemStack(Blocks.SAND, 1);
|
||||||
|
drops.add(block);
|
||||||
|
drops.add(shard);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
super.getDrops(drops, world, pos, state, fortune);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
220
src/main/java/trinity/blocks/DirtyBomb.java
Normal file
220
src/main/java/trinity/blocks/DirtyBomb.java
Normal file
|
@ -0,0 +1,220 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.IProperty;
|
||||||
|
import net.minecraft.block.properties.PropertyBool;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.projectile.EntityArrow;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.Items;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityDirtyBomb;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
|
||||||
|
public class DirtyBomb extends Block
|
||||||
|
{
|
||||||
|
//public static final PropertyBool EXPLODE = PropertyBool.create("explode");
|
||||||
|
|
||||||
|
public DirtyBomb(String nameIn, Material mat, SoundType sound)
|
||||||
|
{
|
||||||
|
super(mat);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
//this.setDefaultState(this.blockState.getBaseState().withProperty(EXPLODE, Boolean.valueOf(false)));
|
||||||
|
//this.setCreativeTab(CreativeTabs.REDSTONE);
|
||||||
|
this.setSoundType(sound);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after the block is set in the Chunk data, but before the Tile Entity is set
|
||||||
|
*/
|
||||||
|
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
|
||||||
|
{
|
||||||
|
super.onBlockAdded(worldIn, pos, state);
|
||||||
|
|
||||||
|
if (worldIn.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
this.onPlayerDestroy(worldIn, pos, true);
|
||||||
|
worldIn.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
|
||||||
|
* change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
|
||||||
|
* block, etc.
|
||||||
|
*/
|
||||||
|
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
if (worldIn.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
//if(this==ModBlocks.fusion_bomb)
|
||||||
|
//{
|
||||||
|
// this.explode(worldIn, pos, true, (EntityLivingBase)null);
|
||||||
|
//}
|
||||||
|
this.onPlayerDestroy(worldIn, pos, true);
|
||||||
|
worldIn.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when this Block is destroyed by an Explosion
|
||||||
|
*/
|
||||||
|
public void onExplosionDestroy(World worldIn, BlockPos pos, Explosion explosionIn)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.dirty_bomb)
|
||||||
|
{
|
||||||
|
if (!worldIn.isRemote)
|
||||||
|
{
|
||||||
|
EntityDirtyBomb entitytntprimed = new EntityDirtyBomb(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy(), 0.5D);
|
||||||
|
entitytntprimed.setFuse((short)(worldIn.rand.nextInt(50) + 25));
|
||||||
|
worldIn.spawnEntity(entitytntprimed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this==ModBlocks.gold_bomb)
|
||||||
|
{
|
||||||
|
if (!worldIn.isRemote)
|
||||||
|
{
|
||||||
|
EntityDirtyBomb entitytntprimed = new EntityDirtyBomb(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy(), 300D);
|
||||||
|
entitytntprimed.setFuse((short)(worldIn.rand.nextInt(50) + 25));
|
||||||
|
worldIn.spawnEntity(entitytntprimed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called after a player destroys this Block - the posiiton pos may no longer hold the state indicated.
|
||||||
|
*/
|
||||||
|
public void onPlayerDestroy(World worldIn, BlockPos pos, boolean explode)
|
||||||
|
{
|
||||||
|
//if(this!=ModBlocks.fusion_bomb)
|
||||||
|
//{
|
||||||
|
this.explode(worldIn, pos, explode, (EntityLivingBase)null);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void explode(World worldIn, BlockPos pos, boolean explode, EntityLivingBase igniter)
|
||||||
|
{
|
||||||
|
if (!worldIn.isRemote)
|
||||||
|
{
|
||||||
|
if (explode)
|
||||||
|
{
|
||||||
|
worldIn.setBlockToAir(pos);
|
||||||
|
if(this==ModBlocks.fusion_bomb)
|
||||||
|
{
|
||||||
|
worldIn.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 6, true);
|
||||||
|
ExplosionNukeGeneric.irradiate(worldIn, pos.getX(), pos.getY(), pos.getZ(), Math.min(16,TrinityConfig.max_radius)*6);
|
||||||
|
}
|
||||||
|
if(this==ModBlocks.dirty_bomb)
|
||||||
|
{
|
||||||
|
EntityDirtyBomb entitytntprimed = new EntityDirtyBomb(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter, 0.5D);
|
||||||
|
entitytntprimed.setFuse(80);
|
||||||
|
worldIn.spawnEntity(entitytntprimed);
|
||||||
|
worldIn.playSound((EntityPlayer)null, entitytntprimed.posX, entitytntprimed.posY, entitytntprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
if(this==ModBlocks.gold_bomb)
|
||||||
|
{
|
||||||
|
EntityDirtyBomb entitytntprimed = new EntityDirtyBomb(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter, 300D);
|
||||||
|
entitytntprimed.setFuse(80);
|
||||||
|
worldIn.spawnEntity(entitytntprimed);
|
||||||
|
worldIn.playSound((EntityPlayer)null, entitytntprimed.posX, entitytntprimed.posY, entitytntprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the block is right clicked by a player.
|
||||||
|
*/
|
||||||
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
|
ItemStack itemstack = playerIn.getHeldItem(hand);
|
||||||
|
|
||||||
|
if (!itemstack.isEmpty() && (itemstack.getItem() == Items.FLINT_AND_STEEL || itemstack.getItem() == Items.FIRE_CHARGE))
|
||||||
|
{
|
||||||
|
this.explode(worldIn, pos, true, playerIn);
|
||||||
|
worldIn.setBlockState(pos, Blocks.AIR.getDefaultState(), 11);
|
||||||
|
|
||||||
|
if (itemstack.getItem() == Items.FLINT_AND_STEEL)
|
||||||
|
{
|
||||||
|
itemstack.damageItem(1, playerIn);
|
||||||
|
}
|
||||||
|
else if (!playerIn.capabilities.isCreativeMode)
|
||||||
|
{
|
||||||
|
itemstack.shrink(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called When an Entity Collided with the Block
|
||||||
|
*/
|
||||||
|
public void onEntityCollision(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
|
||||||
|
{
|
||||||
|
if (!worldIn.isRemote && entityIn instanceof EntityArrow)
|
||||||
|
{
|
||||||
|
EntityArrow entityarrow = (EntityArrow)entityIn;
|
||||||
|
|
||||||
|
if (entityarrow.isBurning())
|
||||||
|
{
|
||||||
|
this.explode(worldIn, pos, true, entityarrow.shootingEntity instanceof EntityLivingBase ? (EntityLivingBase)entityarrow.shootingEntity : null);
|
||||||
|
worldIn.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return whether this block can drop from an explosion.
|
||||||
|
*/
|
||||||
|
public boolean canDropFromExplosion(Explosion explosionIn)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given metadata into a BlockState for this Block
|
||||||
|
*/
|
||||||
|
/*public IBlockState getStateFromMeta(int meta)
|
||||||
|
{
|
||||||
|
return this.getDefaultState().withProperty(EXPLODE, Boolean.valueOf((meta & 1) > 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the BlockState into the correct metadata value
|
||||||
|
*/
|
||||||
|
/*public int getMetaFromState(IBlockState state)
|
||||||
|
{
|
||||||
|
return ((Boolean)state.getValue(EXPLODE)).booleanValue() ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected BlockStateContainer createBlockState()
|
||||||
|
{
|
||||||
|
return new BlockStateContainer(this, new IProperty[] {EXPLODE});
|
||||||
|
}*/
|
||||||
|
}
|
143
src/main/java/trinity/blocks/ExoticBomb.java
Normal file
143
src/main/java/trinity/blocks/ExoticBomb.java
Normal file
|
@ -0,0 +1,143 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import io.netty.util.internal.ThreadLocalRandom;
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityBlackHole;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.entities.EntityShockwave;
|
||||||
|
import trinity.entities.EntityThermonuclearBlast;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.radiation.FalloutSavedData;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.ThermonuclearBomb;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.DimensionType;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.common.DimensionManager;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class ExoticBomb extends Block {
|
||||||
|
|
||||||
|
public int blastRadius;
|
||||||
|
|
||||||
|
public ExoticBomb(String nameIn, Material material, int blastRadius) {
|
||||||
|
super(material);
|
||||||
|
this.blastRadius=blastRadius;
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
setSoundType(blockSoundType.METAL);
|
||||||
|
this.setHardness(2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
//tooltip.add("Crater Radius: "+this.blastRadius);
|
||||||
|
//tooltip.add("Thermal Radius: "+this.blastRadius*TrinityConfig.fallout_multiplier*2);
|
||||||
|
|
||||||
|
tooltip.add(TextFormatting.DARK_BLUE+"Creates a wormhole to a random location upon detonation.");
|
||||||
|
tooltip.add(TextFormatting.DARK_RED+"Warning: wormholes are one-way, and may leave you VERY far from home!");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||||
|
{
|
||||||
|
AtomicBomb(world,pos,this.blastRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
AtomicBomb(world,pos,this.blastRadius);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
if(world.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
world.scheduleUpdate(pos, this, 600);
|
||||||
|
//AtomicBomb(world,pos,this.blastRadius, this.salted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @SideOnly(Side.CLIENT)
|
||||||
|
public void randomDisplayTick(IBlockState stateIn, World world, BlockPos pos, Random rand)
|
||||||
|
{
|
||||||
|
world.spawnParticle(EnumParticleTypes.SUSPENDED_DEPTH, pos.getX()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getY()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getZ()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), 0, 0, 0);
|
||||||
|
//this.randomDisplayTick(stateIn, world, pos, rand);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
public static void AtomicBomb(World world, BlockPos pos, int blastRadius)
|
||||||
|
{
|
||||||
|
//boolean antimatter = world.getBlockState(pos).getBlock()==ModBlocks.bomb_antimatter;
|
||||||
|
//System.out.println("This is not a thermonuclear bomb");
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
|
||||||
|
int[] dimension = DimensionManager.getRegisteredDimensions().values().stream().flatMap(Collection::stream).mapToInt(Integer::intValue).toArray();
|
||||||
|
Random rand = new Random();
|
||||||
|
int randomDim = getRandom(dimension);
|
||||||
|
int randomX = rand.nextInt(50000000)-30000000;
|
||||||
|
int randomY = rand.nextInt(256);
|
||||||
|
int randomZ = rand.nextInt(50000000)-30000000;
|
||||||
|
EntityBlackHole entity2 = new EntityBlackHole(world, 2, randomDim, randomX ,randomY ,randomZ);
|
||||||
|
entity2.posX = pos.getX();
|
||||||
|
entity2.posY = pos.getY();
|
||||||
|
entity2.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(entity2);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
FalloutSavedData.incrementRad(world, pos.getX(), pos.getZ(), 1, 10);
|
||||||
|
//ExplosionNukeGeneric.irradiate(world, pos.getX(), pos.getY(), pos.getZ(), Math.min(blastRadius,TrinityConfig.max_radius)*6);
|
||||||
|
//world.spawnEntity(EntityNuclearExplosion.statFacAntimatter(world, Math.min(blastRadius,TrinityConfig.max_radius), pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
|
||||||
|
public static int getRandom(int[] array) {
|
||||||
|
int rnd = new Random().nextInt(array.length);
|
||||||
|
return array[rnd];
|
||||||
|
}
|
||||||
|
}
|
147
src/main/java/trinity/blocks/ExplosiveCharge.java
Normal file
147
src/main/java/trinity/blocks/ExplosiveCharge.java
Normal file
|
@ -0,0 +1,147 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.PropertyDirection;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.dispenser.IBlockSource;
|
||||||
|
import net.minecraft.dispenser.IPosition;
|
||||||
|
import net.minecraft.dispenser.PositionImpl;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class ExplosiveCharge extends Block {
|
||||||
|
|
||||||
|
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||||
|
|
||||||
|
public ExplosiveCharge(String nameIn, Material material) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
setSoundType(blockSoundType.METAL);
|
||||||
|
this.setHardness(2F);
|
||||||
|
setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||||
|
}
|
||||||
|
public static EnumFacing getFacingFromEntity(BlockPos clickedBlock, EntityLivingBase entity) {
|
||||||
|
return EnumFacing.getFacingFromVector(
|
||||||
|
(float) (entity.posX - clickedBlock.getX()),
|
||||||
|
(float) (entity.posY - clickedBlock.getY()),
|
||||||
|
(float) (entity.posZ - clickedBlock.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// @SideOnly(Side.CLIENT)
|
||||||
|
// public void initModel() {
|
||||||
|
// ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||||
|
world.setBlockState(pos, state.withProperty(FACING, getFacingFromEntity(pos, placer)), 2);
|
||||||
|
// System.out.println(getMetaFromState(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
|
return getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta & 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
return state.getValue(FACING).getIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState() {
|
||||||
|
return new BlockStateContainer(this, FACING);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
IBlockState state2 = world.getBlockState(fromPos);
|
||||||
|
if(state2.getBlock()==Blocks.FIRE || state2.getMaterial()==Material.LAVA)
|
||||||
|
{
|
||||||
|
Explode(state, world, pos);
|
||||||
|
}
|
||||||
|
if(world.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
Explode(state, world, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Explode(IBlockState state, World world, BlockPos pos)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.baratol)
|
||||||
|
{
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 3, true);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 6, false);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.NORTH)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ()-2, 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.SOUTH)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ()+2, 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.EAST)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX()+2, pos.getY(), pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.WEST)
|
||||||
|
{
|
||||||
|
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX()-2, pos.getY(), pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.UP)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY()+2, pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.DOWN)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY()-2, pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 3, true);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 6, false);
|
||||||
|
}
|
||||||
|
}
|
100
src/main/java/trinity/blocks/FallingRadioactiveBlock.java
Normal file
100
src/main/java/trinity/blocks/FallingRadioactiveBlock.java
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockFalling;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
public class FallingRadioactiveBlock extends BlockFalling {
|
||||||
|
|
||||||
|
public FallingRadioactiveBlock(String nameIn, Material material) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
// setHarvestLevel("Pickaxe", 1);
|
||||||
|
// setSoundType(blockSoundType.GROUND);
|
||||||
|
// this.setHardness(2F);
|
||||||
|
this.setTickRandomly(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||||
|
{
|
||||||
|
super.updateTick(world, pos, state, rand);
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
if(this==ModBlocks.salted_sand2)
|
||||||
|
{
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double radioactivity = RadiationHandler.HEAVY_SALTED_EARTH;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (radioactivity)) {
|
||||||
|
chunkRadation.setRadiationBuffer(radioactivity);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + radioactivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.salted_sand.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this==ModBlocks.salted_sand)
|
||||||
|
{
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double radioactivity = RadiationHandler.SALTED_EARTH;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (radioactivity)) {
|
||||||
|
chunkRadation.setRadiationBuffer(radioactivity);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + radioactivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.SAND.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
world.spawnEntity(EntityNukeExplosionMK4.statFac(world, 100, pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}*/
|
||||||
|
}
|
215
src/main/java/trinity/blocks/NuclearCore.java
Normal file
215
src/main/java/trinity/blocks/NuclearCore.java
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import io.netty.util.internal.ThreadLocalRandom;
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
//import trinity.entities.EntityCaldera;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.entities.EntityBlackHole;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.entities.EntityShockwave;
|
||||||
|
import trinity.entities.EntityThermonuclearBlast;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.ThermonuclearBomb;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class NuclearCore extends Block {
|
||||||
|
|
||||||
|
public int blastRadius;
|
||||||
|
|
||||||
|
public boolean salted;
|
||||||
|
|
||||||
|
public NuclearCore(String nameIn, Material material, int blastRadius, boolean salted) {
|
||||||
|
super(material);
|
||||||
|
this.blastRadius=blastRadius;
|
||||||
|
this.salted=salted;
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
setSoundType(blockSoundType.METAL);
|
||||||
|
this.setHardness(2F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
if(this.salted)
|
||||||
|
{
|
||||||
|
tooltip.add("Crater Radius: "+this.blastRadius*0.75);
|
||||||
|
}
|
||||||
|
if(!this.salted)
|
||||||
|
{
|
||||||
|
tooltip.add("Crater Radius: "+this.blastRadius);
|
||||||
|
}
|
||||||
|
tooltip.add("Wasteland Radius: "+this.blastRadius*TrinityConfig.fallout_multiplier);
|
||||||
|
|
||||||
|
if(this.salted)
|
||||||
|
{
|
||||||
|
tooltip.add(TextFormatting.DARK_RED+"Danger: Leaves extremely radioactive fallout behind!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@SuppressWarnings("null")
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||||
|
{
|
||||||
|
AtomicBomb(world,pos,this.blastRadius, this.salted);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
if(world.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
//world.scheduleUpdate(pos, this, 600);
|
||||||
|
AtomicBomb(world,pos,this.blastRadius, this.salted);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @SideOnly(Side.CLIENT)
|
||||||
|
public void randomDisplayTick(IBlockState stateIn, World world, BlockPos pos, Random rand)
|
||||||
|
{
|
||||||
|
world.spawnParticle(EnumParticleTypes.SUSPENDED_DEPTH, pos.getX()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getY()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), pos.getZ()-4 + (ThreadLocalRandom.current().nextDouble(0, 9)), 0, 0, 0);
|
||||||
|
//this.randomDisplayTick(stateIn, world, pos, rand);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
public static void AtomicBomb(World world, BlockPos pos, int blastRadius, boolean salted)
|
||||||
|
{
|
||||||
|
//boolean antimatter = world.getBlockState(pos).getBlock()==ModBlocks.bomb_antimatter;
|
||||||
|
//System.out.println("This is not a thermonuclear bomb");
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
|
||||||
|
if(ThermonuclearBomb.ThermonuclearCheck(world,pos)==true && TrinityConfig.thermonuclear)
|
||||||
|
{
|
||||||
|
//System.out.println("This is sa thermonuclear bomb");
|
||||||
|
int X = pos.getX();
|
||||||
|
int Y = pos.getY();
|
||||||
|
int Z = pos.getZ();
|
||||||
|
for(int x=X-3;x<=X+3;x++)
|
||||||
|
{
|
||||||
|
for(int y=Y-3;y<=Y+3;y++)
|
||||||
|
{
|
||||||
|
for(int z=Z-3;z<=Z+3;z++)
|
||||||
|
{
|
||||||
|
BlockPos clear = new BlockPos(x,y,z);
|
||||||
|
Block block = world.getBlockState(clear).getBlock();
|
||||||
|
if(block != Blocks.BEDROCK && clear.getY()<=1)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(clear);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double multiplier = ThermonuclearBomb.ThermonuclearMultiplier(world,pos, false);
|
||||||
|
int radius = (int) (Math.min(blastRadius,TrinityConfig.max_radius)*multiplier);
|
||||||
|
//System.out.println("Radius: "+radius+" Multiplier: "+multiplier);
|
||||||
|
int salt = (int) ThermonuclearBomb.ThermonuclearMultiplier(world,pos, true);
|
||||||
|
ExplosionNukeGeneric.irradiate(world, pos.getX(), pos.getY(), pos.getZ(), Math.min(radius,TrinityConfig.max_radius)*2);
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(world, 1000, (radius*2) * 0.005F);
|
||||||
|
entity2.posX = pos.getX();
|
||||||
|
entity2.posY = pos.getY();
|
||||||
|
entity2.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(entity2);
|
||||||
|
|
||||||
|
world.spawnEntity(EntityNuclearExplosion.statFacNoRad(world, Math.min((int) (blastRadius*1.5f),TrinityConfig.max_radius), pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
|
||||||
|
EntityThermonuclearBlast blast = new EntityThermonuclearBlast(world);
|
||||||
|
blast.posX = pos.getX();
|
||||||
|
blast.posY = pos.getY();
|
||||||
|
blast.posZ = pos.getZ();
|
||||||
|
blast.setScale(radius);
|
||||||
|
//fallout.setThermonuclear(true);
|
||||||
|
blast.setIntensity(salt);
|
||||||
|
world.spawnEntity(blast);
|
||||||
|
|
||||||
|
//world.spawnEntity(EntityNuclearExplosion.statFacThermo(world, radius, pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0, salt));
|
||||||
|
//System.out.println("Radius: "+radius);
|
||||||
|
//System.out.println("Salt modifier: "+salt);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(world, 1000, (Math.min(blastRadius,TrinityConfig.max_radius)*2) * 0.005F);
|
||||||
|
entity2.posX = pos.getX();
|
||||||
|
entity2.posY = pos.getY();
|
||||||
|
entity2.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(entity2);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
ExplosionNukeGeneric.irradiate(world, pos.getX(), pos.getY(), pos.getZ(), Math.min(blastRadius,TrinityConfig.max_radius)*2);
|
||||||
|
if(!salted)
|
||||||
|
{
|
||||||
|
/*EntityImplosion shock = new EntityImplosion(world);
|
||||||
|
shock.posX = pos.getX();
|
||||||
|
shock.posY = pos.getY();
|
||||||
|
shock.posZ = pos.getZ();
|
||||||
|
shock.setScale(20);
|
||||||
|
world.spawnEntity(shock);*/
|
||||||
|
world.spawnEntity(EntityNuclearExplosion.statFac(world, Math.min(blastRadius,TrinityConfig.max_radius), pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}
|
||||||
|
else if(salted)
|
||||||
|
{
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double promptRads = TrinityConfig.salted_burst;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (promptRads)) {
|
||||||
|
chunkRadation.setRadiationBuffer(promptRads);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + promptRads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
world.spawnEntity(EntityNuclearExplosion.statFacSalted(world, Math.min(blastRadius,TrinityConfig.max_radius), pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*else if(antimatter)
|
||||||
|
{
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(world, 1000, (blastRadius*2) * 0.005F);
|
||||||
|
entity2.posX = pos.getX();
|
||||||
|
entity2.posY = pos.getY();
|
||||||
|
entity2.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(entity2);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
ExplosionNukeGeneric.irradiate(world, pos.getX(), pos.getY(), pos.getZ(), blastRadius*6);
|
||||||
|
world.spawnEntity(EntityNuclearExplosion.statFacNoRad(world, blastRadius, pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}*/
|
||||||
|
//}
|
||||||
|
}
|
98
src/main/java/trinity/blocks/RadioactiveBlock.java
Normal file
98
src/main/java/trinity/blocks/RadioactiveBlock.java
Normal file
|
@ -0,0 +1,98 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
public class RadioactiveBlock extends Block {
|
||||||
|
|
||||||
|
public RadioactiveBlock(String nameIn, Material material) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
// setHarvestLevel("Pickaxe", 1);
|
||||||
|
// setSoundType(blockSoundType.GROUND);
|
||||||
|
this.setHardness(2F);
|
||||||
|
this.setTickRandomly(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
@Override
|
||||||
|
public void updateTick(World world, BlockPos pos, IBlockState state, Random rand)
|
||||||
|
{
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
if(this==ModBlocks.radioactive_earth2)
|
||||||
|
{
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double radioactivity = RadiationHandler.HEAVY_SALTED_EARTH;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (radioactivity)) {
|
||||||
|
chunkRadation.setRadiationBuffer(radioactivity);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + radioactivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this==ModBlocks.radioactive_earth)
|
||||||
|
{
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double radioactivity = RadiationHandler.SALTED_EARTH;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (radioactivity)) {
|
||||||
|
chunkRadation.setRadiationBuffer(radioactivity);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + radioactivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, NCBlocks.wasteland_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
world.spawnEntity(EntityNukeExplosionMK4.statFac(world, 100, pos.getX() + 0.0, pos.getY() + 0.0, pos.getZ() + 0.0));
|
||||||
|
}*/
|
||||||
|
}
|
213
src/main/java/trinity/blocks/ShieldedContainer.java
Normal file
213
src/main/java/trinity/blocks/ShieldedContainer.java
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.gui.GuiHandlerTrinity;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockContainer;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.EnumBlockRenderType;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
|
||||||
|
public class ShieldedContainer extends BlockContainer {
|
||||||
|
|
||||||
|
public double shielding;
|
||||||
|
public static double rads;
|
||||||
|
private static final String RADIATION = Lang.localise("item.nuclearcraft.rads");
|
||||||
|
|
||||||
|
public ShieldedContainer(String nameIn, Material material, double shielding) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
this.shielding = shielding*8;
|
||||||
|
// setSoundType(blockSoundType.GROUND);
|
||||||
|
this.setHardness(2F);
|
||||||
|
this.setLightOpacity(0);
|
||||||
|
// this.setTickRandomly(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void onBlockHarvested(World world, BlockPos pos, IBlockState state, EntityPlayer player)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.trinitite)
|
||||||
|
{
|
||||||
|
ItemStack block = new ItemStack(Blocks.SAND, 1);
|
||||||
|
EntityItem sand = new EntityItem(world);
|
||||||
|
sand.setItem(block);
|
||||||
|
|
||||||
|
ItemStack shard = new ItemStack(ModItems.trinitite, 1);
|
||||||
|
EntityItem trinitite = new EntityItem(world);
|
||||||
|
trinitite.setItem(shard);
|
||||||
|
trinitite.posX = pos.getX();
|
||||||
|
trinitite.posY = pos.getY();
|
||||||
|
trinitite.posZ = pos.getZ();
|
||||||
|
world.spawnEntity(trinitite);
|
||||||
|
world.spawnEntity(sand);
|
||||||
|
}
|
||||||
|
super.onBlockHarvested(world, pos, state, player);
|
||||||
|
}*/
|
||||||
|
@Override
|
||||||
|
public TileEntity createNewTileEntity(World worldIn, int meta) {
|
||||||
|
return new TileEntityShieldedContainer();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isTranslucent(IBlockState state)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTileEntity(IBlockState state)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Called when the block is right clicked
|
||||||
|
// In this block it is used to open the blocks gui when right clicked by a player
|
||||||
|
@Override
|
||||||
|
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand,
|
||||||
|
EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
|
// Uses the gui handler registered to your mod to open the gui for the given gui id
|
||||||
|
// open on the server side only (not sure why you shouldn't open client side too... vanilla doesn't, so we better not either)
|
||||||
|
if (worldIn.isRemote) return true;
|
||||||
|
|
||||||
|
playerIn.openGui(Trinity.instance, GuiHandlerTrinity.getGuiID(), worldIn, pos.getX(), pos.getY(), pos.getZ());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dropBlockAsItemWithChance(World worldIn, BlockPos pos, IBlockState blockState, float chance, int fortune)
|
||||||
|
{
|
||||||
|
// Disable super to prevent standard drop.
|
||||||
|
// super.dropBlockAsItemWithChance(worldIn, pos, blockState, chance, fortune);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||||
|
{
|
||||||
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
|
if(tile != null && tile instanceof TileEntityShieldedContainer)
|
||||||
|
{
|
||||||
|
TileEntityShieldedContainer container = ((TileEntityShieldedContainer)tile);
|
||||||
|
if(stack.hasTagCompound()){
|
||||||
|
container.readFromNBT(stack.getTagCompound());
|
||||||
|
container.setPos(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
// tooltip.add("Light Shielding: "+NCConfig.radiation_shielding_level[0]);
|
||||||
|
// tooltip.add("Medium Shielding: "+NCConfig.radiation_shielding_level[1]);
|
||||||
|
// tooltip.add("Heavy Shielding: "+NCConfig.radiation_shielding_level[2]);
|
||||||
|
rads = stack.getTagCompound().getDouble("Radioactivity");
|
||||||
|
tooltip.add(RadiationHelper.getRadiationTextColor(this.rads*stack.getCount()) + RADIATION + " " + RadiationHelper.radsPrefix(this.rads*stack.getCount(), true));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isOpaqueCube(IBlockState state)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void breakBlock(World worldIn, BlockPos pos, IBlockState state) {
|
||||||
|
|
||||||
|
//IInventory inventory = worldIn.getTileEntity(pos) instanceof IInventory ? (IInventory)worldIn.getTileEntity(pos) : null;
|
||||||
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
|
if(tile instanceof TileEntityShieldedContainer)
|
||||||
|
{
|
||||||
|
TileEntityShieldedContainer te = ((TileEntityShieldedContainer)tile);
|
||||||
|
rads = te.getRadioactivity();
|
||||||
|
|
||||||
|
}
|
||||||
|
NBTTagCompound nbt = new NBTTagCompound();
|
||||||
|
tile.writeToNBT(nbt);
|
||||||
|
EntityItem item = new EntityItem(worldIn);
|
||||||
|
ItemStack container = new ItemStack(Item.getItemFromBlock(this), 1);
|
||||||
|
container.setTagCompound(nbt);
|
||||||
|
container.getTagCompound().setDouble("Radioactivity", rads);
|
||||||
|
item.setPosition(pos.getX()+0.5f, pos.getY(), pos.getZ()+0.5f);
|
||||||
|
item.entityDropItem(container, 0.5f);
|
||||||
|
/*if (inventory != null){
|
||||||
|
// For each slot in the inventory
|
||||||
|
for (int i = 0; i < inventory.getSizeInventory(); i++){
|
||||||
|
// If the slot is not empty
|
||||||
|
if (!inventory.getStackInSlot(i).isEmpty()) // isEmpty
|
||||||
|
{
|
||||||
|
// Create a new entity item with the item stack in the slot
|
||||||
|
EntityItem item = new EntityItem(worldIn, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, inventory.getStackInSlot(i));
|
||||||
|
|
||||||
|
// Apply some random motion to the item
|
||||||
|
float multiplier = 0.1f;
|
||||||
|
float motionX = worldIn.rand.nextFloat() - 0.5f;
|
||||||
|
float motionY = worldIn.rand.nextFloat() - 0.5f;
|
||||||
|
float motionZ = worldIn.rand.nextFloat() - 0.5f;
|
||||||
|
|
||||||
|
item.motionX = motionX * multiplier;
|
||||||
|
item.motionY = motionY * multiplier;
|
||||||
|
item.motionZ = motionZ * multiplier;
|
||||||
|
|
||||||
|
// Spawn the item in the world
|
||||||
|
worldIn.spawnEntity(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the inventory so nothing else (such as another mod) can do anything with the items
|
||||||
|
inventory.clear();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Super MUST be called last because it removes the tile entity
|
||||||
|
super.breakBlock(worldIn, pos, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EnumBlockRenderType getRenderType(IBlockState iBlockState) {
|
||||||
|
return EnumBlockRenderType.MODEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
162
src/main/java/trinity/blocks/ThermonuclearCore.java
Normal file
162
src/main/java/trinity/blocks/ThermonuclearCore.java
Normal file
|
@ -0,0 +1,162 @@
|
||||||
|
package trinity.blocks;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
//import nca.handler.NuclearExplosion;
|
||||||
|
//import nca.handler.ProcessHandler;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.properties.PropertyDirection;
|
||||||
|
import net.minecraft.block.state.BlockStateContainer;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.dispenser.IBlockSource;
|
||||||
|
import net.minecraft.dispenser.IPosition;
|
||||||
|
import net.minecraft.dispenser.PositionImpl;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.potion.Potion;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class ThermonuclearCore extends Block {
|
||||||
|
|
||||||
|
public static final PropertyDirection FACING = PropertyDirection.create("facing");
|
||||||
|
|
||||||
|
public ThermonuclearCore(String nameIn, Material material) {
|
||||||
|
super(material);
|
||||||
|
setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
setHarvestLevel("Pickaxe", 1);
|
||||||
|
setSoundType(blockSoundType.METAL);
|
||||||
|
this.setHardness(2F);
|
||||||
|
setDefaultState(blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
|
||||||
|
}
|
||||||
|
public static EnumFacing getFacingFromEntity(BlockPos clickedBlock, EntityLivingBase entity) {
|
||||||
|
return EnumFacing.getFacingFromVector(
|
||||||
|
(float) (entity.posX - clickedBlock.getX()),
|
||||||
|
(float) (entity.posY - clickedBlock.getY()),
|
||||||
|
(float) (entity.posZ - clickedBlock.getZ()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
tooltip.add(TextFormatting.GRAY+"Valid reflective blocks: Lead");
|
||||||
|
tooltip.add(TextFormatting.GOLD+"Valid salting blocks: Gold, Cobalt, Zinc");
|
||||||
|
tooltip.add(TextFormatting.GREEN+"Valid fissionable blocks: Uranium-238, Neptunium-237, Plutonium-242");
|
||||||
|
tooltip.add(TextFormatting.DARK_RED+"Danger: Extremely powerful! Expect massive amounts of lag!");
|
||||||
|
}
|
||||||
|
|
||||||
|
// @SideOnly(Side.CLIENT)
|
||||||
|
// public void initModel() {
|
||||||
|
// ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(this), 0, new ModelResourceLocation(getRegistryName(), "inventory"));
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) {
|
||||||
|
world.setBlockState(pos, state.withProperty(FACING, getFacingFromEntity(pos, placer)), 2);
|
||||||
|
// System.out.println(getMetaFromState(state));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IBlockState getStateFromMeta(int meta) {
|
||||||
|
return getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta & 7));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMetaFromState(IBlockState state) {
|
||||||
|
return state.getValue(FACING).getIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected BlockStateContainer createBlockState() {
|
||||||
|
return new BlockStateContainer(this, FACING);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block, BlockPos fromPos)
|
||||||
|
{
|
||||||
|
IBlockState state2 = world.getBlockState(fromPos);
|
||||||
|
if(state2.getBlock()==Blocks.FIRE || state2.getMaterial()==Material.LAVA)
|
||||||
|
{
|
||||||
|
Explode(state, world, pos);
|
||||||
|
}
|
||||||
|
if(world.isBlockPowered(pos))
|
||||||
|
{
|
||||||
|
Explode(state, world, pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void Explode(IBlockState state, World world, BlockPos pos)
|
||||||
|
{
|
||||||
|
if(this==ModBlocks.baratol)
|
||||||
|
{
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 3, true);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 6, false);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.NORTH)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ()-2, 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.SOUTH)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ()+2, 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.EAST)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX()+2, pos.getY(), pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.WEST)
|
||||||
|
{
|
||||||
|
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX()-2, pos.getY(), pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.UP)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY()+2, pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
if(state.getValue(FACING)==EnumFacing.DOWN)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.AIR.getDefaultState());
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY()-2, pos.getZ(), 4, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onBlockExploded(World world, BlockPos pos, Explosion explosion)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 3, true);
|
||||||
|
world.createExplosion(null, pos.getX(), pos.getY(), pos.getZ(), 6, false);
|
||||||
|
}*/
|
||||||
|
}
|
299
src/main/java/trinity/config/TrinityConfig.java
Normal file
299
src/main/java/trinity/config/TrinityConfig.java
Normal file
|
@ -0,0 +1,299 @@
|
||||||
|
package trinity.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.network.PacketHandler;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import nc.util.NCMath;
|
||||||
|
import trinity.blocks.NuclearCore;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.common.config.Configuration;
|
||||||
|
import net.minecraftforge.common.config.Property;
|
||||||
|
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
|
||||||
|
import net.minecraftforge.fml.common.Loader;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
|
||||||
|
|
||||||
|
public class TrinityConfig {
|
||||||
|
private static Configuration config = null;
|
||||||
|
|
||||||
|
private static double salted = 50;
|
||||||
|
|
||||||
|
private static int u233 = 130/2;
|
||||||
|
private static int u235 = 108/2;
|
||||||
|
private static int np237 = 81/2;
|
||||||
|
private static int pu239 = 140/2;
|
||||||
|
private static int am242 = 173/2;
|
||||||
|
private static int cm247 = 124/2;
|
||||||
|
private static int bk248 = 122/2;
|
||||||
|
private static int cf249 = 194/2;
|
||||||
|
private static int cf251 = 203/2;
|
||||||
|
private static int cust1 = 100/2;
|
||||||
|
private static int cust2 = 100/2;
|
||||||
|
private static int cust3 = 100/2;
|
||||||
|
private static int cust4 = 100/2;
|
||||||
|
private static int icbm = 100/2;
|
||||||
|
private static int anti = 50/2;
|
||||||
|
private static int max = 1000;
|
||||||
|
private static int speed = 512;
|
||||||
|
//private static int cap = 300;
|
||||||
|
private static float multiplier = 5;
|
||||||
|
private static boolean render = true;
|
||||||
|
|
||||||
|
private static boolean thermo = true;
|
||||||
|
|
||||||
|
private static boolean custom = false;
|
||||||
|
|
||||||
|
public static final String CATEGORY_NAME_OTHER = "Nuclear Weapons";
|
||||||
|
|
||||||
|
public static double salted_burst;
|
||||||
|
|
||||||
|
public static int u233_radius;
|
||||||
|
|
||||||
|
public static int u235_radius;
|
||||||
|
|
||||||
|
public static int np237_radius;
|
||||||
|
|
||||||
|
public static int pu239_radius;
|
||||||
|
|
||||||
|
public static int am242_radius;
|
||||||
|
|
||||||
|
public static int cm247_radius;
|
||||||
|
|
||||||
|
public static int bk248_radius;
|
||||||
|
|
||||||
|
public static int cf249_radius;
|
||||||
|
|
||||||
|
public static int cf251_radius;
|
||||||
|
|
||||||
|
public static int custom_1_radius;
|
||||||
|
|
||||||
|
public static int custom_2_radius;
|
||||||
|
|
||||||
|
public static int custom_3_radius;
|
||||||
|
|
||||||
|
public static int custom_4_radius;
|
||||||
|
|
||||||
|
public static int antimatter_radius;
|
||||||
|
|
||||||
|
public static int max_radius;
|
||||||
|
|
||||||
|
public static int icbm_radius;
|
||||||
|
|
||||||
|
public static int fallout_speed;
|
||||||
|
|
||||||
|
public static double fallout_multiplier;
|
||||||
|
|
||||||
|
public static boolean fallout_rendering;
|
||||||
|
|
||||||
|
public static boolean thermonuclear;
|
||||||
|
|
||||||
|
public static boolean custom_nukes;
|
||||||
|
|
||||||
|
//public static int capacity;
|
||||||
|
|
||||||
|
public static void preInit() {
|
||||||
|
File configFile = new File(Loader.instance().getConfigDir(), "trinity.cfg");
|
||||||
|
config = new Configuration(configFile);
|
||||||
|
syncFromFiles();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Configuration getConfig() {
|
||||||
|
return config;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clientPreInit() {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ConfigEventHandler());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromFiles() {
|
||||||
|
syncConfig(true, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromGui() {
|
||||||
|
syncConfig(false, true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void syncFromFields() {
|
||||||
|
syncConfig(false, false);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void syncConfig(boolean loadFromFile, boolean setFromConfig) {
|
||||||
|
if (loadFromFile)
|
||||||
|
config.load();
|
||||||
|
|
||||||
|
Property propertyCustom = config.get(CATEGORY_NAME_OTHER, "custom_nukes", new Boolean(custom), Lang.localise("gui.config.nuke.custom_nukes.comment"));
|
||||||
|
propertyCustom.setLanguageKey("gui.config.nuke.custom_nukes");
|
||||||
|
|
||||||
|
Property propertyThermonuclear = config.get(CATEGORY_NAME_OTHER, "thermonuclear", new Boolean(thermo), Lang.localise("gui.config.nuke.thermonuclear.comment"));
|
||||||
|
propertyThermonuclear.setLanguageKey("gui.config.nuke.thermonuclear");
|
||||||
|
|
||||||
|
Property propertyFalloutRender = config.get(CATEGORY_NAME_OTHER, "fallout_rendering", new Boolean(render), Lang.localise("gui.config.fallout.fallout_rendering.comment"));
|
||||||
|
propertyFalloutRender.setLanguageKey("gui.config.fallout.fallout_rendering");
|
||||||
|
|
||||||
|
Property propertySaltedBurst = config.get(CATEGORY_NAME_OTHER, "salted_burst", new Double(salted), Lang.localise("gui.config.fallout.salted_burst.comment"), 1, Double.MAX_VALUE);
|
||||||
|
propertySaltedBurst.setLanguageKey("gui.config.fallout.salted_burst");
|
||||||
|
|
||||||
|
Property propertyFalloutRadius = config.get(CATEGORY_NAME_OTHER, "fallout_multiplier", new Double(multiplier), Lang.localise("gui.config.fallout.fallout_multiplier.comment"), 1, Double.MAX_VALUE);
|
||||||
|
propertyFalloutRadius.setLanguageKey("gui.config.fallout.fallout_multiplier");
|
||||||
|
|
||||||
|
Property propertyU233Radius = config.get(CATEGORY_NAME_OTHER, "u233_radius", new Integer(u233), Lang.localise("gui.config.nuke.u233_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyU233Radius.setLanguageKey("gui.config.nuke.u233_radius");
|
||||||
|
|
||||||
|
Property propertyU235Radius = config.get(CATEGORY_NAME_OTHER, "u235_radius", new Integer(u235), Lang.localise("gui.config.nuke.u235_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyU233Radius.setLanguageKey("gui.config.nuke.u235_radius");
|
||||||
|
|
||||||
|
Property propertyNp237Radius = config.get(CATEGORY_NAME_OTHER, "np237_radius", new Integer(np237), Lang.localise("gui.config.nuke.np237_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyNp237Radius.setLanguageKey("gui.config.nuke.np237_radius");
|
||||||
|
|
||||||
|
Property propertyPu239Radius = config.get(CATEGORY_NAME_OTHER, "pu239_radius", new Integer(pu239), Lang.localise("gui.config.nuke.pu239_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyPu239Radius.setLanguageKey("gui.config.nuke.pu239_radius");
|
||||||
|
|
||||||
|
Property propertyAm242Radius = config.get(CATEGORY_NAME_OTHER, "am242_radius", new Integer(am242), Lang.localise("gui.config.nuke.am242_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyPu239Radius.setLanguageKey("gui.config.nuke.am242_radius");
|
||||||
|
|
||||||
|
Property propertyCm247Radius = config.get(CATEGORY_NAME_OTHER, "cm247_radius", new Integer(cm247), Lang.localise("gui.config.nuke.cm247_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCm247Radius.setLanguageKey("gui.config.nuke.cm247_radius");
|
||||||
|
|
||||||
|
Property propertyBk248Radius = config.get(CATEGORY_NAME_OTHER, "bk248_radius", new Integer(bk248), Lang.localise("gui.config.nuke.bk248_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyBk248Radius.setLanguageKey("gui.config.nuke.bk248_radius");
|
||||||
|
|
||||||
|
Property propertyCf249Radius = config.get(CATEGORY_NAME_OTHER, "cf249_radius", new Integer(cf249), Lang.localise("gui.config.nuke.cf249_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCf249Radius.setLanguageKey("gui.config.nuke.cf249_radius");
|
||||||
|
|
||||||
|
Property propertyCf251Radius = config.get(CATEGORY_NAME_OTHER, "cf251_radius", new Integer(cf251), Lang.localise("gui.config.nuke.cf251_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCf251Radius.setLanguageKey("gui.config.nuke.cf251_radius");
|
||||||
|
|
||||||
|
Property propertyCustom1Radius = config.get(CATEGORY_NAME_OTHER, "custom1_radius", new Integer(cust1), Lang.localise("gui.config.nuke.cust1_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCustom1Radius.setLanguageKey("gui.config.nuke.cust1_radius");
|
||||||
|
|
||||||
|
Property propertyCustom2Radius = config.get(CATEGORY_NAME_OTHER, "custom2_radius", new Integer(cust2), Lang.localise("gui.config.nuke.cust2_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCustom2Radius.setLanguageKey("gui.config.nuke.cust2_radius");
|
||||||
|
|
||||||
|
Property propertyCustom3Radius = config.get(CATEGORY_NAME_OTHER, "custom3_radius", new Integer(cust3), Lang.localise("gui.config.nuke.cust3_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCustom3Radius.setLanguageKey("gui.config.nuke.cust3_radius");
|
||||||
|
|
||||||
|
Property propertyCustom4Radius = config.get(CATEGORY_NAME_OTHER, "custom4_radius", new Integer(cust4), Lang.localise("gui.config.nuke.cust4_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyCustom4Radius.setLanguageKey("gui.config.nuke.cust4_radius");
|
||||||
|
|
||||||
|
Property propertyICBMRadius = config.get(CATEGORY_NAME_OTHER, "icbm_radius", new Integer(icbm), Lang.localise("gui.config.nuke.icbm_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyICBMRadius.setLanguageKey("gui.config.nuke.icbm_radius");
|
||||||
|
|
||||||
|
Property propertyAntimatterRadius = config.get(CATEGORY_NAME_OTHER, "antimatter_radius", new Integer(anti), Lang.localise("gui.config.nuke.antimatter_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyAntimatterRadius.setLanguageKey("gui.config.nuke.antimatter_radius");
|
||||||
|
|
||||||
|
Property propertyMaxRadius = config.get(CATEGORY_NAME_OTHER, "max_radius", new Integer(max), Lang.localise("gui.config.nuke.max_radius.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyU233Radius.setLanguageKey("gui.config.nuke.max_radius");
|
||||||
|
|
||||||
|
Property propertySpeed = config.get(CATEGORY_NAME_OTHER, "speed", new Integer(speed), Lang.localise("gui.config.nuke.speed.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
propertyU233Radius.setLanguageKey("gui.config.nuke.speed");
|
||||||
|
|
||||||
|
//Property propertyCapacity = config.get(CATEGORY_NAME_OTHER, "capacity", new Integer(cap), Lang.localise("gui.config.nuke.capacity.comment"), 1, Integer.MAX_VALUE);
|
||||||
|
//propertyU233Radius.setLanguageKey("gui.config.nuke.capacity");
|
||||||
|
|
||||||
|
List<String> propertyOrderOther = new ArrayList<String>();
|
||||||
|
config.setCategoryPropertyOrder(CATEGORY_NAME_OTHER, propertyOrderOther);
|
||||||
|
|
||||||
|
|
||||||
|
if (setFromConfig) {
|
||||||
|
custom_nukes = propertyCustom.getBoolean();
|
||||||
|
thermonuclear = propertyThermonuclear.getBoolean();
|
||||||
|
fallout_rendering = propertyFalloutRender.getBoolean();
|
||||||
|
fallout_multiplier = propertyFalloutRadius.getDouble();
|
||||||
|
salted_burst = propertySaltedBurst.getDouble();
|
||||||
|
u233_radius = propertyU233Radius.getInt();
|
||||||
|
u235_radius = propertyU235Radius.getInt();
|
||||||
|
np237_radius = propertyNp237Radius.getInt();
|
||||||
|
pu239_radius = propertyPu239Radius.getInt();
|
||||||
|
am242_radius = propertyAm242Radius.getInt();
|
||||||
|
cm247_radius = propertyCm247Radius.getInt();
|
||||||
|
bk248_radius = propertyBk248Radius.getInt();
|
||||||
|
cf249_radius = propertyCf249Radius.getInt();
|
||||||
|
cf251_radius = propertyCf251Radius.getInt();
|
||||||
|
custom_1_radius = propertyCustom1Radius.getInt();
|
||||||
|
custom_2_radius = propertyCustom2Radius.getInt();
|
||||||
|
custom_3_radius = propertyCustom3Radius.getInt();
|
||||||
|
custom_4_radius = propertyCustom4Radius.getInt();
|
||||||
|
icbm_radius = propertyICBMRadius.getInt();
|
||||||
|
antimatter_radius = propertyAntimatterRadius.getInt();
|
||||||
|
max_radius = propertyMaxRadius.getInt();
|
||||||
|
fallout_speed = propertySpeed.getInt();
|
||||||
|
//capacity = propertyCapacity.getInt();
|
||||||
|
}
|
||||||
|
propertyCustom.set(custom_nukes);
|
||||||
|
propertyThermonuclear.set(thermonuclear);
|
||||||
|
propertyFalloutRender.set(fallout_rendering);
|
||||||
|
propertySaltedBurst.set(salted_burst);
|
||||||
|
propertyFalloutRadius.set(fallout_multiplier);
|
||||||
|
propertyU233Radius.set(u233_radius);
|
||||||
|
propertyU235Radius.set(u235_radius);
|
||||||
|
propertyNp237Radius.set(np237_radius);
|
||||||
|
propertyPu239Radius.set(pu239_radius);
|
||||||
|
propertyAm242Radius.set(am242_radius);
|
||||||
|
propertyCm247Radius.set(cm247_radius);
|
||||||
|
propertyBk248Radius.set(bk248_radius);
|
||||||
|
propertyCf249Radius.set(cf249_radius);
|
||||||
|
propertyCf251Radius.set(cf251_radius);
|
||||||
|
propertyCustom1Radius.set(custom_1_radius);
|
||||||
|
propertyCustom2Radius.set(custom_2_radius);
|
||||||
|
propertyCustom3Radius.set(custom_3_radius);
|
||||||
|
propertyCustom4Radius.set(custom_4_radius);
|
||||||
|
propertyICBMRadius.set(icbm_radius);
|
||||||
|
propertyAntimatterRadius.set(antimatter_radius);
|
||||||
|
propertyMaxRadius.set(max_radius);
|
||||||
|
propertySpeed.set(fallout_speed);
|
||||||
|
//propertyCapacity.set(capacity);
|
||||||
|
|
||||||
|
if (config.hasChanged())
|
||||||
|
config.save();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private static double[] readDoubleArrayFromConfig(Property property) {
|
||||||
|
int currentLength = property.getDoubleList().length;
|
||||||
|
int defaultLength = property.getDefaults().length;
|
||||||
|
if (currentLength == defaultLength) {
|
||||||
|
return property.getDoubleList();
|
||||||
|
}
|
||||||
|
double[] newArray = new double[defaultLength];
|
||||||
|
if (currentLength > defaultLength) {
|
||||||
|
for (int i = 0; i < defaultLength; i++) {
|
||||||
|
newArray[i] = property.getDoubleList()[i];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < currentLength; i++) {
|
||||||
|
newArray[i] = property.getDoubleList()[i];
|
||||||
|
}
|
||||||
|
for (int i = currentLength; i < defaultLength; i++) {
|
||||||
|
newArray[i] = property.setToDefault().getDoubleList()[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class ConfigEventHandler {
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
|
public void onEvent(ConfigChangedEvent.OnConfigChangedEvent event) {
|
||||||
|
if (event.getModID().equals(Reference.MODID)) {
|
||||||
|
syncFromGui();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
289
src/main/java/trinity/entities/EntityBlackHole.java
Normal file
289
src/main/java/trinity/entities/EntityBlackHole.java
Normal file
|
@ -0,0 +1,289 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
//import com.hbm.explosion.NukeEnvironmentalEffect;
|
||||||
|
//import com.hbm.lib.Library;
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
//import com.hbm.potion.HbmPotion;
|
||||||
|
//import com.hbm.saveddata.AuxSavedData;
|
||||||
|
import nc.worldgen.biome.NCBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.BlockCactus;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityWither;
|
||||||
|
import net.minecraft.entity.item.EntityFallingBlock;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
//import net.minecraft.util.AxisAlignedBB;
|
||||||
|
//import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
|
||||||
|
public class EntityBlackHole extends Entity {
|
||||||
|
|
||||||
|
public static final DataParameter<Float> SCALE = EntityDataManager.<Float>createKey(EntityBlackHole.class, DataSerializers.FLOAT);
|
||||||
|
public static final DataParameter<Integer> X = EntityDataManager.<Integer>createKey(EntityBlackHole.class, DataSerializers.VARINT);
|
||||||
|
public static final DataParameter<Integer> Y = EntityDataManager.<Integer>createKey(EntityBlackHole.class, DataSerializers.VARINT);
|
||||||
|
public static final DataParameter<Integer> Z = EntityDataManager.<Integer>createKey(EntityBlackHole.class, DataSerializers.VARINT);
|
||||||
|
public static final DataParameter<Integer> DIM = EntityDataManager.<Integer>createKey(EntityBlackHole.class, DataSerializers.VARINT);
|
||||||
|
|
||||||
|
private final static Random random = new Random();
|
||||||
|
|
||||||
|
// public int revProgress;
|
||||||
|
// public int radProgress;
|
||||||
|
|
||||||
|
public EntityBlackHole(World worldIn) {
|
||||||
|
super(worldIn);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityBlackHole(World w, float scale, int dim, int x, int y, int z){
|
||||||
|
this(w);
|
||||||
|
this.getDataManager().set(SCALE, scale);
|
||||||
|
this.getDataManager().set(X, x);
|
||||||
|
this.getDataManager().set(Y, y);
|
||||||
|
this.getDataManager().set(Z, z);
|
||||||
|
this.getDataManager().set(DIM, dim);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - getScale() - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + getScale() - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - getScale() - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + getScale() - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - getScale() - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + getScale() - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
float scale = this.getDataManager().get(SCALE);
|
||||||
|
/*if(!world.isRemote) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos2 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos3 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos4 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos5 = new BlockPos.MutableBlockPos();
|
||||||
|
for(int i = 0; i < 512; i++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(radProgress * 0.5, 0, 0);
|
||||||
|
Vec3 vec2 = Vec3.createVectorHelper(0, radProgress * 0.5, 0);
|
||||||
|
double circum = radProgress * 2 * Math.PI * 2;
|
||||||
|
|
||||||
|
///
|
||||||
|
if(circum == 0)
|
||||||
|
circum = 1;
|
||||||
|
///
|
||||||
|
|
||||||
|
double part = 360D / circum;
|
||||||
|
|
||||||
|
vec.rotateAroundY((float) (part * revProgress));
|
||||||
|
vec2.rotateAroundZ((float) (part * revProgress));
|
||||||
|
|
||||||
|
int x = (int) (posX + vec.xCoord);
|
||||||
|
int y = (int) (posY + vec2.yCoord);
|
||||||
|
int z = (int) (posZ + vec.zCoord);
|
||||||
|
|
||||||
|
double dist = radProgress * 100 / getScale() * 0.5;
|
||||||
|
pos.setPos(x, y, z);
|
||||||
|
/*pos2.setPos(x-1, posY, z);
|
||||||
|
pos3.setPos(x+1, posY, z);
|
||||||
|
pos4.setPos(x, posY, z-1);
|
||||||
|
pos5.setPos(x, posY, z-1);
|
||||||
|
blast(pos, dist);
|
||||||
|
/*blast(pos2, dist);
|
||||||
|
blast(pos3, dist);
|
||||||
|
blast(pos4, dist);
|
||||||
|
blast(pos5, dist);
|
||||||
|
|
||||||
|
revProgress++;
|
||||||
|
|
||||||
|
if(revProgress > circum) {
|
||||||
|
revProgress = 0;
|
||||||
|
radProgress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radProgress > getScale() * 2D) {
|
||||||
|
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
gravity(world, (int)this.posX, (int)this.posY, (int)this.posZ, (int)Math.ceil(scale * 15));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void gravity(World world, int x, int y, int z, int radius) {
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
double d5;
|
||||||
|
double d6;
|
||||||
|
double d7;
|
||||||
|
double wat = radius;
|
||||||
|
|
||||||
|
// bombStartStrength *= 2.0F;
|
||||||
|
i = MathHelper.floor(x - wat - 1.0D);
|
||||||
|
j = MathHelper.floor(x + wat + 1.0D);
|
||||||
|
k = MathHelper.floor(y - wat - 1.0D);
|
||||||
|
int i2 = MathHelper.floor(y + wat + 1.0D);
|
||||||
|
int l = MathHelper.floor(z - wat - 1.0D);
|
||||||
|
int j2 = MathHelper.floor(z + wat + 1.0D);
|
||||||
|
List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(i, k, l, j, i2, j2));
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < list.size(); ++i1) {
|
||||||
|
Entity entity = (Entity) list.get(i1);
|
||||||
|
|
||||||
|
if(entity instanceof EntityBlackHole)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double d4 = entity.getDistance(x, y, z) / radius;
|
||||||
|
|
||||||
|
if (d4 <= 1.0D) {
|
||||||
|
d5 = entity.posX - x;
|
||||||
|
d6 = entity.posY + entity.getEyeHeight() - y;
|
||||||
|
d7 = entity.posZ - z;
|
||||||
|
double d9 = MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
|
||||||
|
if (d9 < wat && !(entity instanceof EntityPlayer)) {// && ArmorUtil.checkArmor((EntityPlayer) entity, ModItems.euphemium_helmet, ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots))) {
|
||||||
|
d5 /= d9;
|
||||||
|
d6 /= d9;
|
||||||
|
d7 /= d9;
|
||||||
|
|
||||||
|
if (!(entity instanceof EntityPlayer && ((EntityPlayer) entity).capabilities.isCreativeMode)) {
|
||||||
|
double d8 = 0.125 + (random.nextDouble() * 0.25);
|
||||||
|
entity.motionX -= d5 * d8;
|
||||||
|
entity.motionY -= d6 * d8;
|
||||||
|
entity.motionZ -= d7 * d8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(SCALE, Float.valueOf(0));
|
||||||
|
this.dataManager.register(DIM, Integer.valueOf(0));
|
||||||
|
this.dataManager.register(X, Integer.valueOf(0));
|
||||||
|
this.dataManager.register(Y, Integer.valueOf(0));
|
||||||
|
this.dataManager.register(Z, Integer.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
setScale(p_70037_1_.getFloat("scale"));
|
||||||
|
setScale(p_70037_1_.getInteger("dimension"));
|
||||||
|
setScale(p_70037_1_.getInteger("X"));
|
||||||
|
setScale(p_70037_1_.getInteger("Y"));
|
||||||
|
setScale(p_70037_1_.getInteger("Z"));
|
||||||
|
//revProgress = p_70037_1_.getInteger("revProgress");
|
||||||
|
//radProgress = p_70037_1_.getInteger("radProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setFloat("scale", getScale());
|
||||||
|
p_70014_1_.setInteger("dimension", getDimension());
|
||||||
|
p_70014_1_.setInteger("X", getX());
|
||||||
|
p_70014_1_.setInteger("Y", getY());
|
||||||
|
p_70014_1_.setInteger("Z", getZ());
|
||||||
|
//p_70014_1_.setInteger("revProgress", revProgress);
|
||||||
|
//p_70014_1_.setInteger("radProgress", radProgress);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void setScale(float i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SCALE, Float.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getScale() {
|
||||||
|
|
||||||
|
float scale = this.dataManager.get(SCALE);
|
||||||
|
|
||||||
|
return scale == 0 ? 1 : scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDimension(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(DIM, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDimension() {
|
||||||
|
|
||||||
|
int dim = this.dataManager.get(DIM);
|
||||||
|
|
||||||
|
return dim == 0 ? 1 : dim;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setX(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(X, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getX() {
|
||||||
|
|
||||||
|
int x = this.dataManager.get(X);
|
||||||
|
|
||||||
|
return x == 0 ? 1 : x;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setY(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(Y, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getY() {
|
||||||
|
|
||||||
|
int y = this.dataManager.get(Y);
|
||||||
|
|
||||||
|
return y == 0 ? 1 : y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZ(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(Z, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZ() {
|
||||||
|
|
||||||
|
int z = this.dataManager.get(Z);
|
||||||
|
|
||||||
|
return z == 0 ? 1 : z;
|
||||||
|
}
|
||||||
|
}
|
227
src/main/java/trinity/entities/EntityDirtyBomb.java
Normal file
227
src/main/java/trinity/entities/EntityDirtyBomb.java
Normal file
|
@ -0,0 +1,227 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
//import trinity.util.IConstantRenderer;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.MoverType;
|
||||||
|
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||||
|
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
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.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class EntityDirtyBomb extends Entity {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> FUSE = EntityDataManager.<Integer>createKey(EntityDirtyBomb.class, DataSerializers.VARINT);
|
||||||
|
private static final DataParameter<Float> RADS = EntityDataManager.<Float>createKey(EntityDirtyBomb.class, DataSerializers.FLOAT);
|
||||||
|
@Nullable
|
||||||
|
private EntityLivingBase tntPlacedBy;
|
||||||
|
/** How long the fuse is */
|
||||||
|
private int fuse;
|
||||||
|
public float rads;
|
||||||
|
|
||||||
|
public EntityDirtyBomb(World worldIn)
|
||||||
|
{
|
||||||
|
super(worldIn);
|
||||||
|
this.fuse = 80;
|
||||||
|
this.preventEntitySpawning = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
this.setSize(0.98F, 0.98F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityDirtyBomb(World worldIn, double x, double y, double z, EntityLivingBase igniter, double radioactivity)
|
||||||
|
{
|
||||||
|
this(worldIn);
|
||||||
|
this.setPosition(x, y, z);
|
||||||
|
float f = (float)(Math.random() * (Math.PI * 2D));
|
||||||
|
this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F);
|
||||||
|
this.motionY = 0.20000000298023224D;
|
||||||
|
this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F);
|
||||||
|
this.setFuse(80);
|
||||||
|
this.rads = (float) radioactivity;
|
||||||
|
this.prevPosX = x;
|
||||||
|
this.prevPosY = y;
|
||||||
|
this.prevPosZ = z;
|
||||||
|
this.tntPlacedBy = igniter;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void entityInit()
|
||||||
|
{
|
||||||
|
this.dataManager.register(FUSE, Integer.valueOf(80));
|
||||||
|
this.dataManager.register(RADS, Float.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns if this entity triggers Block.onEntityWalking on the blocks they walk on. used for spiders and wolves to
|
||||||
|
* prevent them from trampling crops
|
||||||
|
*/
|
||||||
|
protected boolean canTriggerWalking()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if other Entities should be prevented from moving through this Entity.
|
||||||
|
*/
|
||||||
|
public boolean canBeCollidedWith()
|
||||||
|
{
|
||||||
|
return !this.isDead;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called to update the entity's position/logic.
|
||||||
|
*/
|
||||||
|
public void onUpdate()
|
||||||
|
{
|
||||||
|
this.prevPosX = this.posX;
|
||||||
|
this.prevPosY = this.posY;
|
||||||
|
this.prevPosZ = this.posZ;
|
||||||
|
|
||||||
|
if (!this.hasNoGravity())
|
||||||
|
{
|
||||||
|
this.motionY -= 0.03999999910593033D;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
|
||||||
|
this.motionX *= 0.9800000190734863D;
|
||||||
|
this.motionY *= 0.9800000190734863D;
|
||||||
|
this.motionZ *= 0.9800000190734863D;
|
||||||
|
|
||||||
|
if (this.onGround)
|
||||||
|
{
|
||||||
|
this.motionX *= 0.699999988079071D;
|
||||||
|
this.motionZ *= 0.699999988079071D;
|
||||||
|
this.motionY *= -0.5D;
|
||||||
|
}
|
||||||
|
|
||||||
|
--this.fuse;
|
||||||
|
|
||||||
|
if (this.fuse <= 0)
|
||||||
|
{
|
||||||
|
this.setDead();
|
||||||
|
|
||||||
|
if (!this.world.isRemote)
|
||||||
|
{
|
||||||
|
this.explode((double)this.rads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.handleWaterMovement();
|
||||||
|
this.world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("null")
|
||||||
|
private void explode(double radioactivity)
|
||||||
|
{
|
||||||
|
BlockPos pos = new BlockPos(this.posX,this.posY,this.posZ);
|
||||||
|
Chunk chunk = world.getChunk(pos);
|
||||||
|
if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (radioactivity)) {
|
||||||
|
chunkRadation.setRadiationBuffer(radioactivity);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + radioactivity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float f = 4.0F;
|
||||||
|
this.world.createExplosion(this, this.posX, this.posY + (double)(this.height / 16.0F), this.posZ, 4.0F, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (abstract) Protected helper method to write subclass entity data to NBT.
|
||||||
|
*/
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound compound)
|
||||||
|
{
|
||||||
|
compound.setShort("Fuse", (short)this.getFuse());
|
||||||
|
compound.setShort("Radioactivity", (short)this.getRadioactivity());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (abstract) Protected helper method to read subclass entity data from NBT.
|
||||||
|
*/
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound compound)
|
||||||
|
{
|
||||||
|
this.setFuse(compound.getShort("Fuse"));
|
||||||
|
this.setFuse(compound.getShort("Radioactivity"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* returns null or the entityliving it was placed or ignited by
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public EntityLivingBase getTntPlacedBy()
|
||||||
|
{
|
||||||
|
return this.tntPlacedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getEyeHeight()
|
||||||
|
{
|
||||||
|
return 0.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFuse(int fuseIn)
|
||||||
|
{
|
||||||
|
this.dataManager.set(FUSE, Integer.valueOf(fuseIn));
|
||||||
|
this.fuse = fuseIn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void notifyDataManagerChange(DataParameter<?> key)
|
||||||
|
{
|
||||||
|
if (FUSE.equals(key))
|
||||||
|
{
|
||||||
|
this.fuse = this.getFuseDataManager();
|
||||||
|
}
|
||||||
|
if (RADS.equals(key))
|
||||||
|
{
|
||||||
|
this.rads = this.getRadDataManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the fuse from the data manager
|
||||||
|
*/
|
||||||
|
public int getFuseDataManager()
|
||||||
|
{
|
||||||
|
return ((Integer)this.dataManager.get(FUSE)).intValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadioactivity(float rads)
|
||||||
|
{
|
||||||
|
this.dataManager.set(RADS, Float.valueOf(rads));
|
||||||
|
this.rads = rads;
|
||||||
|
}
|
||||||
|
public float getRadDataManager()
|
||||||
|
{
|
||||||
|
return ((Float)this.dataManager.get(RADS)).floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFuse()
|
||||||
|
{
|
||||||
|
return this.fuse;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadioactivity()
|
||||||
|
{
|
||||||
|
return this.rads;
|
||||||
|
}
|
||||||
|
}
|
563
src/main/java/trinity/entities/EntityFalloutRain.java
Normal file
563
src/main/java/trinity/entities/EntityFalloutRain.java
Normal file
|
@ -0,0 +1,563 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
//import com.hbm.explosion.NukeEnvironmentalEffect;
|
||||||
|
//import com.hbm.lib.Library;
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
//import com.hbm.potion.HbmPotion;
|
||||||
|
//import com.hbm.saveddata.AuxSavedData;
|
||||||
|
import nc.worldgen.biome.NCBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.BlockCactus;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.BlockMobSpawner;
|
||||||
|
import net.minecraft.block.BlockSilverfish;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityWither;
|
||||||
|
import net.minecraft.init.Biomes;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
//import net.minecraft.util.AxisAlignedBB;
|
||||||
|
//import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeOcean;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
//import thaumcraft.api.aura.AuraHelper;
|
||||||
|
//import thaumcraft.api.blocks.BlocksTC;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.handler.INuclearEffect;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.world.TrinityBiomes;
|
||||||
|
|
||||||
|
public class EntityFalloutRain extends Entity implements INuclearEffect {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> SCALE = EntityDataManager.<Integer>createKey(EntityFalloutRain.class, DataSerializers.VARINT);
|
||||||
|
private static final DataParameter<Boolean> SALTED = EntityDataManager.<Boolean>createKey(EntityFalloutRain.class, DataSerializers.BOOLEAN);
|
||||||
|
private static final DataParameter<Boolean> THERMONUCLEAR = EntityDataManager.<Boolean>createKey(EntityFalloutRain.class, DataSerializers.BOOLEAN);
|
||||||
|
private static final DataParameter<Integer> INTENSITY = EntityDataManager.<Integer>createKey(EntityFalloutRain.class, DataSerializers.VARINT);
|
||||||
|
//private static final DataParameter<Boolean> RADIOACTIVE = EntityDataManager.<Boolean>createKey(EntityFalloutRain.class, DataSerializers.BOOLEAN);
|
||||||
|
|
||||||
|
public int revProgress;
|
||||||
|
public int radProgress;
|
||||||
|
private boolean salted;
|
||||||
|
private boolean thermonuclear;
|
||||||
|
|
||||||
|
public EntityFalloutRain(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityFalloutRain(World p_i1582_1_, boolean salt) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
this.salted = salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityFalloutRain(World p_i1582_1_, int maxAge) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - getScale() - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + getScale() - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - getScale() - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + getScale() - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - getScale() - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + getScale() - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
|
||||||
|
/*if (this.world.isRemote)
|
||||||
|
{
|
||||||
|
for (int x = (int) (this.posX-getScale()); this.posX < (int) (this.posX+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int z = (int) (this.posZ-getScale()); this.posZ < (int) (this.posZ+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; this.posY < 256; ++x)
|
||||||
|
{
|
||||||
|
this.world.spawnParticle(EnumParticleTypes.PORTAL, (double)x, (double)y, (double)z, x, y-0.5, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
for(int i = 0; i < TrinityConfig.fallout_speed; i++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(radProgress * 0.5, 0, 0);
|
||||||
|
double circum = radProgress * 2 * Math.PI * 2;
|
||||||
|
|
||||||
|
///
|
||||||
|
if(circum == 0)
|
||||||
|
circum = 1;
|
||||||
|
///
|
||||||
|
|
||||||
|
double part = 360D / circum;
|
||||||
|
|
||||||
|
vec.rotateAroundY((float) (part * revProgress));
|
||||||
|
|
||||||
|
int x = (int) (posX + vec.xCoord);
|
||||||
|
int z = (int) (posZ + vec.zCoord);
|
||||||
|
|
||||||
|
double dist = radProgress * 100 / getScale() * 0.5;
|
||||||
|
pos.setPos(x, posY, z);
|
||||||
|
//System.out.println("Is this radioactive? "+getRadioactive());
|
||||||
|
contaminate(pos, dist);
|
||||||
|
|
||||||
|
revProgress++;
|
||||||
|
|
||||||
|
if(revProgress > circum) {
|
||||||
|
revProgress = 0;
|
||||||
|
radProgress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radProgress > getScale() * 2D) {
|
||||||
|
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contaminate(MutableBlockPos pos, double dist) {
|
||||||
|
|
||||||
|
int depth = 0;
|
||||||
|
|
||||||
|
//int mult = 1;
|
||||||
|
|
||||||
|
int topBlock =world.getTopSolidOrLiquidBlock(pos).getY();
|
||||||
|
|
||||||
|
for(int y = topBlock+35; y >= (topBlock-10); y--) {
|
||||||
|
pos.setY(y);
|
||||||
|
IBlockState b = world.getBlockState(pos);
|
||||||
|
//int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
if(dist<=100/TrinityConfig.fallout_multiplier)
|
||||||
|
{
|
||||||
|
Chunk chunk = this.world.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
|
if(!(chunk.getBiome(pos, world.getBiomeProvider()) instanceof BiomeOcean))
|
||||||
|
{
|
||||||
|
chunk.getBiomeArray()[(pos.getZ() & 15) << 4 | pos.getX() & 15] = (byte)Biome.getIdForBiome(TrinityBiomes.NUCLEAR_CRATER);
|
||||||
|
chunk.setModified(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(dist>100/TrinityConfig.fallout_multiplier)
|
||||||
|
{
|
||||||
|
Chunk chunk = this.world.getChunk(pos.getX() >> 4, pos.getZ() >> 4);
|
||||||
|
if((chunk.getBiome(pos, world.getBiomeProvider()) instanceof BiomeOcean))
|
||||||
|
{
|
||||||
|
chunk.getBiomeArray()[(pos.getZ() & 15) << 4 | pos.getX() & 15] = (byte)Biome.getIdForBiome(TrinityBiomes.CONTAMINATED_OCEAN);
|
||||||
|
chunk.setModified(true);
|
||||||
|
}
|
||||||
|
else if(!(chunk.getBiome(pos, world.getBiomeProvider()) instanceof BiomeOcean || chunk.getBiome(pos, world.getBiomeProvider())==TrinityBiomes.CONTAMINATED_OCEAN))
|
||||||
|
{
|
||||||
|
chunk.getBiomeArray()[(pos.getZ() & 15) << 4 | pos.getX() & 15] = (byte)Biome.getIdForBiome(NCBiomes.NUCLEAR_WASTELAND);
|
||||||
|
chunk.setModified(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(b.getMaterial() == Material.AIR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(b.getMaterial() == Material.SNOW || b.getMaterial() == Material.CRAFTED_SNOW || b.getMaterial() == Material.ICE)
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
|
||||||
|
if(b.getBlock().isFlammable(world, pos, EnumFacing.UP) && !(b.getMaterial()==Material.LEAVES) ) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
if(rand.nextInt(10) == 0)
|
||||||
|
world.setBlockState(pos.add(0, 1, 0), Blocks.FIRE.getDefaultState());
|
||||||
|
else
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
if(dist>65 && dist<70)
|
||||||
|
world.setBlockToAir(pos.add(0, 1, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.getMaterial()==Material.LEAVES || b.getBlock() instanceof BlockBush || b.getBlock() instanceof BlockMobSpawner) {
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
} else if(b.getMaterial() == Material.GRASS) {
|
||||||
|
BlockPos up = pos.add(0, 1, 0);
|
||||||
|
if(world.getBlockState(up).getMaterial()==Material.PLANTS)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(up);
|
||||||
|
}
|
||||||
|
/*if(!getRadioactive())
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||||
|
}*/
|
||||||
|
if(getThermonuclear())
|
||||||
|
{
|
||||||
|
if(getIntensity()>0)
|
||||||
|
{
|
||||||
|
int chance = rand.nextInt(12);
|
||||||
|
if(chance<getIntensity()&&chance>0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth2.getDefaultState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(getSalted())
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if(getRadioactive())
|
||||||
|
//{
|
||||||
|
world.setBlockState(pos, NCBlocks.wasteland_earth.getDefaultState());
|
||||||
|
//}
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if(b.getBlock() == Blocks.MYCELIUM) {
|
||||||
|
if(getThermonuclear())
|
||||||
|
{
|
||||||
|
if(getIntensity()>0)
|
||||||
|
{
|
||||||
|
int chance = rand.nextInt(12);
|
||||||
|
if(chance<getIntensity()&&chance>0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth2.getDefaultState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(getSalted())
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if(getRadioactive())
|
||||||
|
//{
|
||||||
|
world.setBlockState(pos, NCBlocks.wasteland_earth.getDefaultState());
|
||||||
|
//}
|
||||||
|
return;
|
||||||
|
} else if(b.getMaterial() == Material.GROUND) {
|
||||||
|
depth++;
|
||||||
|
BlockPos up = pos.add(0, 1, 0);
|
||||||
|
|
||||||
|
if(depth < 2)
|
||||||
|
if(world.getBlockState(up).getMaterial()==Material.PLANTS)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(up);
|
||||||
|
}
|
||||||
|
if(getThermonuclear())
|
||||||
|
{
|
||||||
|
if(getIntensity()>0)
|
||||||
|
{
|
||||||
|
int chance = rand.nextInt(12);
|
||||||
|
if(chance<getIntensity()&&chance>0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth2.getDefaultState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(getSalted())
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//if(getRadioactive())
|
||||||
|
//{
|
||||||
|
world.setBlockState(pos, NCBlocks.wasteland_earth.getDefaultState());
|
||||||
|
//}
|
||||||
|
return;
|
||||||
|
} else if(b.getBlock() == Blocks.SAND) {
|
||||||
|
if(dist<30)
|
||||||
|
{
|
||||||
|
BlockPos up = new BlockPos(pos.getX(),pos.getY()+1,pos.getZ());
|
||||||
|
if (world.isAirBlock(up))
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.trinitite.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(getThermonuclear())
|
||||||
|
{
|
||||||
|
if(getIntensity()>0)
|
||||||
|
{
|
||||||
|
int chance = rand.nextInt(12);
|
||||||
|
if(chance<getIntensity()&&chance>0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.salted_sand2.getDefaultState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world.setBlockState(pos, ModBlocks.salted_sand.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(getSalted() && dist >=30){
|
||||||
|
world.setBlockState(pos, ModBlocks.salted_sand.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.CLAY && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.HARDENED_CLAY.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == NCBlocks.wasteland_earth) {
|
||||||
|
if(getThermonuclear())
|
||||||
|
{
|
||||||
|
if(getIntensity()>0)
|
||||||
|
{
|
||||||
|
int chance = rand.nextInt(12);
|
||||||
|
if(chance<=getIntensity()&&chance>0)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth2.getDefaultState());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(getSalted())
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(Trinity.TCLoaded)
|
||||||
|
{
|
||||||
|
float vis=AuraHelper.getVis(world, pos);
|
||||||
|
float flux=AuraHelper.getFlux(world, pos);
|
||||||
|
AuraHelper.drainVis(world, pos, vis, false);
|
||||||
|
AuraHelper.drainFlux(world, pos, flux, false);
|
||||||
|
Block block = b.getBlock();
|
||||||
|
if(block==BlocksTC.crystalAir||block==BlocksTC.crystalEarth||block==BlocksTC.crystalEntropy||block==BlocksTC.crystalFire||block==BlocksTC.crystalOrder||block==BlocksTC.crystalTaint||block==BlocksTC.crystalWater)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
else if (b.getBlock() instanceof BlockFluidClassic) {
|
||||||
|
//world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.MOSSY_COBBLESTONE) {
|
||||||
|
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*else if (b.getBlock() == Blocks.MONSTER_EGG) {
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.COBBLESTONE)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.STONE)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.STONEBRICK)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONEBRICK.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.MOSSY_STONEBRICK)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONEBRICK.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.WOOD) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
if(rand.nextInt(10) == 0)
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
else
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
//world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(dist>65 && dist<70)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.CACTUS && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.GOURD) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() instanceof BlockCactus && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() ==Blocks.STONE && dist<(100/TrinityConfig.fallout_multiplier) && getThermonuclear()) {
|
||||||
|
if(rand.nextInt((int)((dist+1)*10))<=1)
|
||||||
|
world.setBlockState(pos, Blocks.LAVA.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.BROWN_MUSHROOM_BLOCK || b.getBlock() == Blocks.RED_MUSHROOM_BLOCK) {
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(b.getBlock().isNormalCube(world.getBlockState(pos))) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(SCALE, Integer.valueOf(0));
|
||||||
|
this.dataManager.register(SALTED, Boolean.valueOf(false));
|
||||||
|
this.dataManager.register(THERMONUCLEAR, Boolean.valueOf(false));
|
||||||
|
//this.dataManager.register(RADIOACTIVE, Boolean.valueOf(false));
|
||||||
|
this.dataManager.register(INTENSITY, Integer.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
setScale(p_70037_1_.getInteger("scale"));
|
||||||
|
setSalted(p_70037_1_.getBoolean("salted"));
|
||||||
|
setThermonuclear(p_70037_1_.getBoolean("thermonuclear"));
|
||||||
|
//setRadioactive(p_70037_1_.getBoolean("radioactive"));
|
||||||
|
setIntensity(p_70037_1_.getInteger("intensity"));
|
||||||
|
revProgress = p_70037_1_.getInteger("revProgress");
|
||||||
|
radProgress = p_70037_1_.getInteger("radProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setInteger("scale", getScale());
|
||||||
|
p_70014_1_.setBoolean("salted", getSalted());
|
||||||
|
p_70014_1_.setBoolean("thermonuclear", getThermonuclear());
|
||||||
|
//p_70014_1_.setBoolean("radioactive", getRadioactive());
|
||||||
|
p_70014_1_.setInteger("intensity", getIntensity());
|
||||||
|
p_70014_1_.setInteger("revProgress", revProgress);
|
||||||
|
p_70014_1_.setInteger("radProgress", radProgress);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSalted(boolean i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SALTED, Boolean.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSalted() {
|
||||||
|
|
||||||
|
boolean salt = this.dataManager.get(SALTED);
|
||||||
|
|
||||||
|
return salt == false ? false : salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThermonuclear(boolean i) {
|
||||||
|
|
||||||
|
this.dataManager.set(THERMONUCLEAR, Boolean.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getThermonuclear() {
|
||||||
|
|
||||||
|
boolean thermo = this.dataManager.get(THERMONUCLEAR);
|
||||||
|
|
||||||
|
return thermo == false ? false : thermo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*public void setRadioactive(boolean i) {
|
||||||
|
|
||||||
|
this.dataManager.set(RADIOACTIVE, Boolean.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getRadioactive() {
|
||||||
|
|
||||||
|
boolean thermo = this.dataManager.get(RADIOACTIVE);
|
||||||
|
|
||||||
|
return thermo == false ? false : thermo;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public void setIntensity(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(INTENSITY, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIntensity() {
|
||||||
|
|
||||||
|
int intensity = this.dataManager.get(INTENSITY);
|
||||||
|
|
||||||
|
return intensity == 0 ? 1 : intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SCALE, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScale() {
|
||||||
|
|
||||||
|
int scale = this.dataManager.get(SCALE);
|
||||||
|
|
||||||
|
return scale == 0 ? 1 : scale;
|
||||||
|
}
|
||||||
|
}
|
153
src/main/java/trinity/entities/EntityNuclearCloud.java
Normal file
153
src/main/java/trinity/entities/EntityNuclearCloud.java
Normal file
|
@ -0,0 +1,153 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import trinity.handler.INuclearEffect;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.effect.EntityLightningBolt;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class EntityNuclearCloud extends Entity implements INuclearEffect {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> AGE = EntityDataManager.createKey(EntityNuclearCloud.class,
|
||||||
|
DataSerializers.VARINT);
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> MAXAGE = EntityDataManager.createKey(EntityNuclearCloud.class,
|
||||||
|
DataSerializers.VARINT);
|
||||||
|
|
||||||
|
public static final DataParameter<Float> SCALE = EntityDataManager.createKey(EntityNuclearCloud.class,
|
||||||
|
DataSerializers.FLOAT);
|
||||||
|
|
||||||
|
public static final DataParameter<Byte> SOMETHING = EntityDataManager.createKey(EntityNuclearCloud.class,
|
||||||
|
DataSerializers.BYTE);
|
||||||
|
public int maxAge = 1000;
|
||||||
|
public int age;
|
||||||
|
|
||||||
|
public EntityNuclearCloud(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(1, 80);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
this.age = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
// @Override
|
||||||
|
// public boolean shouldRenderInPass() {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - 200 - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + 200 - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - 200 - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + 200 - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - 200 - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + 200 - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getBrightnessForRender() {
|
||||||
|
return 15728880;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float getBrightness() {
|
||||||
|
return 1.0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityNuclearCloud(World p_i1582_1_, int maxAge, float scale) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(20, 40);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
this.maxAge = maxAge;
|
||||||
|
this.dataManager.set(SCALE, scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
|
||||||
|
this.age++;
|
||||||
|
this.world.spawnEntity(new EntityLightningBolt(this.world, this.posX, this.posY + 400, this.posZ, true));
|
||||||
|
|
||||||
|
if (this.age >= this.maxAge) {
|
||||||
|
this.age = 0;
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dataManager.set(MAXAGE, maxAge);
|
||||||
|
this.dataManager.set(AGE, age);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(MAXAGE, maxAge);
|
||||||
|
this.dataManager.register(AGE, age);
|
||||||
|
this.dataManager.register(SCALE, 1.0F);
|
||||||
|
this.dataManager.register(SOMETHING, Byte.valueOf((byte) 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||||
|
if (nbt.hasKey("maxAge"))
|
||||||
|
maxAge = nbt.getShort("maxAge");
|
||||||
|
if (nbt.hasKey("age"))
|
||||||
|
age = nbt.getShort("age");
|
||||||
|
if (nbt.hasKey("scale"))
|
||||||
|
this.dataManager.set(SCALE, nbt.getFloat("scale"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setShort("maxAge", (short) maxAge);
|
||||||
|
p_70014_1_.setShort("age", (short) age);
|
||||||
|
p_70014_1_.setFloat("scale", this.dataManager.get(SCALE));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearCloud statFac(World world, double x, double y, double z, float radius) {
|
||||||
|
|
||||||
|
EntityNuclearCloud cloud = new EntityNuclearCloud(world, (int) radius * 5, radius * 0.005F);
|
||||||
|
cloud.posX = x;
|
||||||
|
cloud.posY = y;
|
||||||
|
cloud.posZ = z;
|
||||||
|
cloud.dataManager.set(SOMETHING, (byte) 0);
|
||||||
|
|
||||||
|
return cloud;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearCloud statFacBale(World world, double x, double y, double z, float radius,
|
||||||
|
int maxAge) {
|
||||||
|
|
||||||
|
EntityNuclearCloud cloud = new EntityNuclearCloud(world, (int) radius * 5, radius * 0.005F);
|
||||||
|
cloud.posX = x;
|
||||||
|
cloud.posY = y;
|
||||||
|
cloud.posZ = z;
|
||||||
|
cloud.dataManager.set(SOMETHING, (byte) 1);
|
||||||
|
|
||||||
|
return cloud;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public boolean isInRangeToRenderDist(double distance) {
|
||||||
|
return distance < 25000;
|
||||||
|
}
|
||||||
|
}
|
275
src/main/java/trinity/entities/EntityNuclearExplosion.java
Normal file
275
src/main/java/trinity/entities/EntityNuclearExplosion.java
Normal file
|
@ -0,0 +1,275 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
//import trinity.explosion.ExplosionHyperspace;
|
||||||
|
//import com.hbm.explosion.ExplosionLarge;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.explosion.ExplosionNukeRay;
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
//import com.hbm.saveddata.RadiationSavedData;
|
||||||
|
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.SoundEvent;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class EntityNuclearExplosion extends Entity {
|
||||||
|
|
||||||
|
//Strength of the blast
|
||||||
|
public int strength;
|
||||||
|
public int count;
|
||||||
|
public int speed;
|
||||||
|
public int length;
|
||||||
|
|
||||||
|
public boolean fallout = true;
|
||||||
|
|
||||||
|
public boolean salted = false;
|
||||||
|
public boolean thermonuclear = false;
|
||||||
|
public boolean thermal = true;
|
||||||
|
public boolean Void = false;
|
||||||
|
public int chance = 0;
|
||||||
|
|
||||||
|
ExplosionNukeRay explosion;
|
||||||
|
|
||||||
|
public EntityNuclearExplosion(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityNuclearExplosion(World world, int strength, int count, int speed, int length) {
|
||||||
|
super(world);
|
||||||
|
this.strength = strength;
|
||||||
|
this.count = count;
|
||||||
|
this.speed = speed;
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
|
||||||
|
if(strength == 0) {
|
||||||
|
this.setDead();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockPos pos = new BlockPos(this.posX, this.posY, this.posZ);
|
||||||
|
this.world.playSound(this.posX, this.posY, this.posZ, SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F, false);
|
||||||
|
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
this.world.playSound(this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F, false);
|
||||||
|
|
||||||
|
if(thermal)
|
||||||
|
{
|
||||||
|
ExplosionNukeGeneric.dealDamage(this.world, (int)this.posX, (int)this.posY, (int)this.posZ, this.length * 10);
|
||||||
|
}
|
||||||
|
else if(!thermal)
|
||||||
|
{
|
||||||
|
ExplosionNukeGeneric.dealDamage(this.world, (int)this.posX, (int)this.posY, (int)this.posZ, this.length * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(explosion == null) {
|
||||||
|
explosion = new ExplosionNukeRay(world, (int)this.posX, (int)this.posY, (int)this.posZ, this.strength, this.count, this.speed, this.length, this.Void);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!explosion.isAusf3Complete) {
|
||||||
|
explosion.collectTipMk4_5(speed * 10);
|
||||||
|
} else if(explosion.getStoredSize() > 0) {
|
||||||
|
explosion.processTip(1024);
|
||||||
|
} else if(fallout) {
|
||||||
|
EntityShockwave shock = new EntityShockwave(this.world);
|
||||||
|
shock.posX = this.posX;
|
||||||
|
shock.posY = this.posY;
|
||||||
|
shock.posZ = this.posZ;
|
||||||
|
shock.setScale((int)(this.length * 2) * 100 / 100);
|
||||||
|
this.world.spawnEntity(shock);
|
||||||
|
if(thermonuclear)
|
||||||
|
{
|
||||||
|
EntityFalloutRain fallout = new EntityFalloutRain(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.length * TrinityConfig.fallout_multiplier) * 100 / 100);
|
||||||
|
fallout.setThermonuclear(true);
|
||||||
|
fallout.setIntensity(chance);
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}
|
||||||
|
if(salted)
|
||||||
|
{
|
||||||
|
EntityFalloutRain fallout = new EntityFalloutRain(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.length * TrinityConfig.fallout_multiplier) * 100 / 100);
|
||||||
|
fallout.setSalted(true);
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}
|
||||||
|
else if(!salted)
|
||||||
|
{
|
||||||
|
EntityFalloutRain fallout = new EntityFalloutRain(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.length * TrinityConfig.fallout_multiplier) * 100 / 100);
|
||||||
|
fallout.setSalted(false);
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}
|
||||||
|
/*if(!radioactive)
|
||||||
|
{
|
||||||
|
//System.out.println("should this be radioactive? "+radioactive);
|
||||||
|
EntityThermalBlast fallout = new EntityThermalBlast(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.length * TrinityConfig.fallout_multiplier) * 100 / 100);
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}*/
|
||||||
|
this.setDead();
|
||||||
|
} else {
|
||||||
|
EntityShockwave shock = new EntityShockwave(this.world);
|
||||||
|
shock.posX = this.posX;
|
||||||
|
shock.posY = this.posY;
|
||||||
|
shock.posZ = this.posZ;
|
||||||
|
shock.setScale((int)(this.length * 1.5) * 100 / 100);
|
||||||
|
this.world.spawnEntity(shock);
|
||||||
|
if(thermal)
|
||||||
|
{
|
||||||
|
EntityThermalBlast fallout = new EntityThermalBlast(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.length * TrinityConfig.fallout_multiplier*2) * 100 / 100);
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFac(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
if(r == 0)
|
||||||
|
r = 25;
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacExperimental(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.salted=false;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacNoRad(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.fallout = false;
|
||||||
|
mk4.thermal = false;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacAntimatter(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.fallout = false;
|
||||||
|
mk4.thermal = true;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacSalted(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r*(0.75f));
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.salted = true;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacThermo(World world, int r, double x, double y, double z, int chance) {
|
||||||
|
|
||||||
|
if(r == 0)
|
||||||
|
r = 25;
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.thermonuclear=true;
|
||||||
|
mk4.chance = chance;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static EntityNuclearExplosion statFacHyperspace(World world, int r, double x, double y, double z) {
|
||||||
|
|
||||||
|
r *= 2;
|
||||||
|
|
||||||
|
EntityNuclearExplosion mk4 = new EntityNuclearExplosion(world);
|
||||||
|
mk4.strength = (int)(r);
|
||||||
|
mk4.count = (int)(4 * Math.PI * Math.pow(mk4.strength, 2) * 25);
|
||||||
|
mk4.speed = (int)Math.ceil(100000 / mk4.strength);
|
||||||
|
mk4.setPosition(x, y, z);
|
||||||
|
mk4.length = mk4.strength / 2;
|
||||||
|
mk4.fallout = false;
|
||||||
|
mk4.thermal = false;
|
||||||
|
mk4.Void = true;
|
||||||
|
return mk4;
|
||||||
|
}
|
||||||
|
}
|
222
src/main/java/trinity/entities/EntityShockwave.java
Normal file
222
src/main/java/trinity/entities/EntityShockwave.java
Normal file
|
@ -0,0 +1,222 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
//import com.hbm.explosion.NukeEnvironmentalEffect;
|
||||||
|
//import com.hbm.lib.Library;
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
//import com.hbm.potion.HbmPotion;
|
||||||
|
//import com.hbm.saveddata.AuxSavedData;
|
||||||
|
import nc.worldgen.biome.NCBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.BlockCactus;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityWither;
|
||||||
|
import net.minecraft.entity.item.EntityFallingBlock;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
//import net.minecraft.util.AxisAlignedBB;
|
||||||
|
//import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
|
||||||
|
public class EntityShockwave extends Entity {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> SCALE = EntityDataManager.<Integer>createKey(EntityShockwave.class, DataSerializers.VARINT);
|
||||||
|
|
||||||
|
|
||||||
|
public int revProgress;
|
||||||
|
public int radProgress;
|
||||||
|
|
||||||
|
public EntityShockwave(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(0, 0);
|
||||||
|
//this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityShockwave(World p_i1582_1_, int maxAge) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(0, 0);
|
||||||
|
//this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - getScale() - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + getScale() - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - getScale() - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + getScale() - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - getScale() - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + getScale() - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos2 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos3 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos4 = new BlockPos.MutableBlockPos();
|
||||||
|
MutableBlockPos pos5 = new BlockPos.MutableBlockPos();
|
||||||
|
for(int i = 0; i < 512; i++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(radProgress * 0.5, 0, 0);
|
||||||
|
double circum = radProgress * 2 * Math.PI * 2;
|
||||||
|
|
||||||
|
///
|
||||||
|
if(circum == 0)
|
||||||
|
circum = 1;
|
||||||
|
///
|
||||||
|
|
||||||
|
double part = 360D / circum;
|
||||||
|
|
||||||
|
vec.rotateAroundY((float) (part * revProgress));
|
||||||
|
|
||||||
|
int x = (int) (posX + vec.xCoord);
|
||||||
|
int z = (int) (posZ + vec.zCoord);
|
||||||
|
|
||||||
|
double dist = radProgress * 100 / getScale() * 0.5;
|
||||||
|
pos.setPos(x, posY, z);
|
||||||
|
pos2.setPos(x-1, posY, z);
|
||||||
|
pos3.setPos(x+1, posY, z);
|
||||||
|
pos4.setPos(x, posY, z-1);
|
||||||
|
pos5.setPos(x, posY, z-1);
|
||||||
|
blast(pos, dist);
|
||||||
|
blast(pos2, dist);
|
||||||
|
blast(pos3, dist);
|
||||||
|
blast(pos4, dist);
|
||||||
|
blast(pos5, dist);
|
||||||
|
|
||||||
|
revProgress++;
|
||||||
|
|
||||||
|
if(revProgress > circum) {
|
||||||
|
revProgress = 0;
|
||||||
|
radProgress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radProgress > getScale() * 2D) {
|
||||||
|
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void blast(MutableBlockPos pos, double dist) {
|
||||||
|
|
||||||
|
int depth = 0;
|
||||||
|
|
||||||
|
int topBlock =world.getTopSolidOrLiquidBlock(pos).getY();
|
||||||
|
|
||||||
|
for(int y = (topBlock-8); y <= topBlock+48; y++) {
|
||||||
|
pos.setY(y);
|
||||||
|
IBlockState b = world.getBlockState(pos);
|
||||||
|
//int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BlockPos left = new BlockPos(pos.getX()+1,pos.getY(),pos.getZ());
|
||||||
|
BlockPos right = new BlockPos(pos.getX()-1,pos.getY(),pos.getZ());
|
||||||
|
BlockPos up = new BlockPos(pos.getX(),pos.getY()+1,pos.getZ());
|
||||||
|
//BlockPos down = pos.add(0, -1, 0);
|
||||||
|
BlockPos down2 = new BlockPos(pos.getX(),pos.getY()-1,pos.getZ());
|
||||||
|
BlockPos front = pos.add(0, 0, 1);
|
||||||
|
BlockPos back = pos.add(0, 0, -1);
|
||||||
|
|
||||||
|
boolean LR = (world.isAirBlock(left) && world.isAirBlock(right));
|
||||||
|
//boolean UD = (world.isAirBlock(up) && world.isAirBlock(down));
|
||||||
|
boolean FB = (world.isAirBlock(front) && world.isAirBlock(back));
|
||||||
|
|
||||||
|
IBlockState bd = world.getBlockState(down2);
|
||||||
|
|
||||||
|
if((b.getMaterial() != Material.AIR || (b.getBlock()instanceof BlockFluidClassic)) && bd.getMaterial() == Material.AIR)
|
||||||
|
{
|
||||||
|
if(b.getBlock().getExplosionResistance(null)<=100)
|
||||||
|
{
|
||||||
|
//EntityFallingBlock dislodged = new EntityFallingBlock(world, (double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, b);
|
||||||
|
//world.spawnEntity(dislodged);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b.getMaterial() != Material.AIR && (LR || FB))
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b.getMaterial() == Material.AIR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
//if(b.getMaterial() == Material.SNOW || b.getMaterial() == Material.CRAFTED_SNOW || b.getMaterial() == Material.ICE)
|
||||||
|
// world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(SCALE, Integer.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
setScale(p_70037_1_.getInteger("scale"));
|
||||||
|
revProgress = p_70037_1_.getInteger("revProgress");
|
||||||
|
radProgress = p_70037_1_.getInteger("radProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setInteger("scale", getScale());
|
||||||
|
p_70014_1_.setInteger("revProgress", revProgress);
|
||||||
|
p_70014_1_.setInteger("radProgress", radProgress);
|
||||||
|
|
||||||
|
}
|
||||||
|
public void setScale(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SCALE, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScale() {
|
||||||
|
|
||||||
|
int scale = this.dataManager.get(SCALE);
|
||||||
|
|
||||||
|
return scale == 0 ? 1 : scale;
|
||||||
|
}
|
||||||
|
}
|
364
src/main/java/trinity/entities/EntityThermalBlast.java
Normal file
364
src/main/java/trinity/entities/EntityThermalBlast.java
Normal file
|
@ -0,0 +1,364 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//import nc.init.NCBlocks;
|
||||||
|
//import com.hbm.explosion.NukeEnvironmentalEffect;
|
||||||
|
//import com.hbm.lib.Library;
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
//import com.hbm.potion.HbmPotion;
|
||||||
|
//import com.hbm.saveddata.AuxSavedData;
|
||||||
|
import nc.worldgen.biome.NCBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.BlockCactus;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.BlockSilverfish;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityWither;
|
||||||
|
import net.minecraft.init.Biomes;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
//import net.minecraft.util.AxisAlignedBB;
|
||||||
|
//import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeOcean;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
//import thaumcraft.api.aura.AuraHelper;
|
||||||
|
//import thaumcraft.api.blocks.BlocksTC;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.handler.INuclearEffect;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.world.TrinityBiomes;
|
||||||
|
|
||||||
|
public class EntityThermalBlast extends Entity implements INuclearEffect {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> SCALE = EntityDataManager.<Integer>createKey(EntityThermalBlast.class, DataSerializers.VARINT);
|
||||||
|
|
||||||
|
public int revProgress;
|
||||||
|
public int radProgress;
|
||||||
|
private boolean salted;
|
||||||
|
private boolean thermonuclear;
|
||||||
|
|
||||||
|
public EntityThermalBlast(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityThermalBlast(World p_i1582_1_, boolean salt) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
this.salted = salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityThermalBlast(World p_i1582_1_, int maxAge) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(4, 20);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - getScale() - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + getScale() - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - getScale() - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + getScale() - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - getScale() - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + getScale() - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
|
||||||
|
/*if (this.world.isRemote)
|
||||||
|
{
|
||||||
|
for (int x = (int) (this.posX-getScale()); this.posX < (int) (this.posX+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int z = (int) (this.posZ-getScale()); this.posZ < (int) (this.posZ+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; this.posY < 256; ++x)
|
||||||
|
{
|
||||||
|
this.world.spawnParticle(EnumParticleTypes.PORTAL, (double)x, (double)y, (double)z, x, y-0.5, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
for(int i = 0; i < 512; i++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(radProgress * 0.5, 0, 0);
|
||||||
|
double circum = radProgress * 2 * Math.PI * 2;
|
||||||
|
|
||||||
|
///
|
||||||
|
if(circum == 0)
|
||||||
|
circum = 1;
|
||||||
|
///
|
||||||
|
|
||||||
|
double part = 360D / circum;
|
||||||
|
|
||||||
|
vec.rotateAroundY((float) (part * revProgress));
|
||||||
|
|
||||||
|
int x = (int) (posX + vec.xCoord);
|
||||||
|
int z = (int) (posZ + vec.zCoord);
|
||||||
|
|
||||||
|
double dist = radProgress * 100 / getScale() * 0.5;
|
||||||
|
pos.setPos(x, posY, z);
|
||||||
|
//System.out.println("This is a thermal blast");
|
||||||
|
contaminate(pos, dist);
|
||||||
|
|
||||||
|
revProgress++;
|
||||||
|
|
||||||
|
if(revProgress > circum) {
|
||||||
|
revProgress = 0;
|
||||||
|
radProgress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radProgress > getScale() * 2D) {
|
||||||
|
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contaminate(MutableBlockPos pos, double dist) {
|
||||||
|
|
||||||
|
int depth = 0;
|
||||||
|
|
||||||
|
//int mult = 1;
|
||||||
|
|
||||||
|
int topBlock =world.getTopSolidOrLiquidBlock(pos).getY();
|
||||||
|
|
||||||
|
for(int y = topBlock+35; y >= (topBlock-10); y--) {
|
||||||
|
pos.setY(y);
|
||||||
|
IBlockState b = world.getBlockState(pos);
|
||||||
|
//int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
if(b.getMaterial() == Material.AIR)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if(b.getMaterial() == Material.SNOW || b.getMaterial() == Material.CRAFTED_SNOW || b.getMaterial() == Material.ICE)
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
|
||||||
|
if(b.getBlock().isFlammable(world, pos, EnumFacing.UP) && !(b.getMaterial()==Material.LEAVES) ) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
if(rand.nextInt(10) == 0)
|
||||||
|
world.setBlockState(pos.add(0, 1, 0), Blocks.FIRE.getDefaultState());
|
||||||
|
else
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
if(dist>65 && dist<70)
|
||||||
|
world.setBlockToAir(pos.add(0, 1, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b.getMaterial()==Material.LEAVES || b.getBlock() instanceof BlockBush) {
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
} else if(b.getMaterial() == Material.GRASS) {
|
||||||
|
BlockPos up = pos.add(0, 1, 0);
|
||||||
|
if(world.getBlockState(up).getMaterial()==Material.PLANTS)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(up);
|
||||||
|
}
|
||||||
|
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||||
|
return;
|
||||||
|
|
||||||
|
} else if(b.getBlock() == Blocks.MYCELIUM) {
|
||||||
|
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||||
|
return;
|
||||||
|
} else if(b.getMaterial() == Material.GROUND) {
|
||||||
|
depth++;
|
||||||
|
BlockPos up = pos.add(0, 1, 0);
|
||||||
|
world.setBlockState(pos, Blocks.DIRT.getDefaultState());
|
||||||
|
if(depth < 2)
|
||||||
|
if(world.getBlockState(up).getMaterial()==Material.PLANTS)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(up);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/*} else if(b.getBlock() == Blocks.SAND) {
|
||||||
|
if(dist<30)
|
||||||
|
{
|
||||||
|
BlockPos up = new BlockPos(pos.getX(),pos.getY()+1,pos.getZ());
|
||||||
|
if (world.isAirBlock(up))
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, ModBlocks.trinitite.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.CLAY && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.HARDENED_CLAY.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(Trinity.TCLoaded)
|
||||||
|
{
|
||||||
|
float vis=AuraHelper.getVis(world, pos);
|
||||||
|
float flux=AuraHelper.getFlux(world, pos);
|
||||||
|
AuraHelper.drainVis(world, pos, vis, false);
|
||||||
|
AuraHelper.drainFlux(world, pos, flux, false);
|
||||||
|
Block block = b.getBlock();
|
||||||
|
if(block==BlocksTC.crystalAir||block==BlocksTC.crystalEarth||block==BlocksTC.crystalEntropy||block==BlocksTC.crystalFire||block==BlocksTC.crystalOrder||block==BlocksTC.crystalTaint||block==BlocksTC.crystalWater)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
else if (b.getBlock() instanceof BlockFluidClassic) {
|
||||||
|
//world.setBlockState(pos, ModBlocks.radioactive_earth.getDefaultState());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.MOSSY_COBBLESTONE) {
|
||||||
|
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*else if (b.getBlock() == Blocks.MONSTER_EGG) {
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.COBBLESTONE)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.COBBLESTONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.STONE)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONE.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.STONEBRICK)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONEBRICK.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(b.getValue(BlockSilverfish.VARIANT)==BlockSilverfish.EnumType.MOSSY_STONEBRICK)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.STONEBRICK.getDefaultState());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.WOOD) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
if(rand.nextInt(10) == 0)
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
else
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
//world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
contaminate(pos, dist);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(dist>65 && dist<70)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.CACTUS && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getMaterial()==Material.GOURD) {
|
||||||
|
if(dist<65)
|
||||||
|
{
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() instanceof BlockCactus && dist<65) {
|
||||||
|
world.setBlockState(pos, Blocks.FIRE.getDefaultState());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (b.getBlock() == Blocks.BROWN_MUSHROOM_BLOCK || b.getBlock() == Blocks.RED_MUSHROOM_BLOCK) {
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(b.getBlock().isNormalCube(world.getBlockState(pos))) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(SCALE, Integer.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
setScale(p_70037_1_.getInteger("scale"));
|
||||||
|
revProgress = p_70037_1_.getInteger("revProgress");
|
||||||
|
radProgress = p_70037_1_.getInteger("radProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setInteger("scale", getScale());
|
||||||
|
p_70014_1_.setInteger("revProgress", revProgress);
|
||||||
|
p_70014_1_.setInteger("radProgress", radProgress);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SCALE, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScale() {
|
||||||
|
|
||||||
|
int scale = this.dataManager.get(SCALE);
|
||||||
|
|
||||||
|
return scale == 0 ? 1 : scale;
|
||||||
|
}
|
||||||
|
}
|
370
src/main/java/trinity/entities/EntityThermonuclearBlast.java
Normal file
370
src/main/java/trinity/entities/EntityThermonuclearBlast.java
Normal file
|
@ -0,0 +1,370 @@
|
||||||
|
package trinity.entities;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//import icbm.classic.api.ExplosiveRefs;
|
||||||
|
//import icbm.classic.content.blast.BlastEMP;
|
||||||
|
//import icbm.classic.content.blast.threaded.BlastNuclear;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.worldgen.biome.NCBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockBush;
|
||||||
|
import net.minecraft.block.BlockCactus;
|
||||||
|
import net.minecraft.block.BlockLeaves;
|
||||||
|
import net.minecraft.block.BlockLog;
|
||||||
|
import net.minecraft.block.BlockSilverfish;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.boss.EntityWither;
|
||||||
|
import net.minecraft.init.Biomes;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.network.datasync.DataParameter;
|
||||||
|
import net.minecraft.network.datasync.DataSerializers;
|
||||||
|
import net.minecraft.network.datasync.EntityDataManager;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
import net.minecraft.util.EnumParticleTypes;
|
||||||
|
import net.minecraft.util.SoundCategory;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeOcean;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
//import thaumcraft.api.aura.AuraHelper;
|
||||||
|
//import thaumcraft.api.blocks.BlocksTC;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.explosion.ExplosionThermonuclear;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.world.TrinityBiomes;
|
||||||
|
|
||||||
|
public class EntityThermonuclearBlast extends Entity {
|
||||||
|
|
||||||
|
private static final DataParameter<Integer> SCALE = EntityDataManager.<Integer>createKey(EntityThermonuclearBlast.class, DataSerializers.VARINT);
|
||||||
|
//private static final DataParameter<Boolean> SALTED = EntityDataManager.<Boolean>createKey(EntityThermonuclearBlast.class, DataSerializers.BOOLEAN);
|
||||||
|
//private static final DataParameter<Boolean> THERMONUCLEAR = EntityDataManager.<Boolean>createKey(EntityThermonuclearBlast.class, DataSerializers.BOOLEAN);
|
||||||
|
private static final DataParameter<Integer> INTENSITY = EntityDataManager.<Integer>createKey(EntityThermonuclearBlast.class, DataSerializers.VARINT);
|
||||||
|
|
||||||
|
//public int revProgress;
|
||||||
|
//public int radProgress;
|
||||||
|
public ExplosionThermonuclear exp;
|
||||||
|
|
||||||
|
public int age = 0;
|
||||||
|
public int destructionRange = 0;
|
||||||
|
//public ExplosionBalefire exp;
|
||||||
|
public int speed = 1;
|
||||||
|
public boolean did = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound nbt) {
|
||||||
|
age = nbt.getInteger("age");
|
||||||
|
destructionRange = nbt.getInteger("destructionRange");
|
||||||
|
speed = nbt.getInteger("speed");
|
||||||
|
did = nbt.getBoolean("did");
|
||||||
|
|
||||||
|
|
||||||
|
exp = new ExplosionThermonuclear((int)this.posX, (int)this.posY, (int)this.posZ, this.world, this.destructionRange);
|
||||||
|
exp.readFromNbt(nbt, "exp_");
|
||||||
|
|
||||||
|
this.did = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound nbt) {
|
||||||
|
nbt.setInteger("age", age);
|
||||||
|
nbt.setInteger("destructionRange", destructionRange);
|
||||||
|
nbt.setInteger("speed", speed);
|
||||||
|
nbt.setBoolean("did", did);
|
||||||
|
|
||||||
|
if(exp != null)
|
||||||
|
exp.saveToNbt(nbt, "exp_");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityThermonuclearBlast(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
super.onUpdate();
|
||||||
|
|
||||||
|
if(!this.did)
|
||||||
|
{
|
||||||
|
//if(GeneralConfig.enableExtendedLogging && !world.isRemote)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[NUKE] Initialized BF explosion at " + posX + " / " + posY + " / " + posZ + " with strength " + destructionRange + "!");
|
||||||
|
|
||||||
|
exp = new ExplosionThermonuclear((int)this.posX, (int)this.posY, (int)this.posZ, this.world, this.destructionRange);
|
||||||
|
|
||||||
|
this.did = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
speed += 1; //increase speed to keep up with expansion
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
|
||||||
|
for(int i = 0; i < this.speed; i++)
|
||||||
|
{
|
||||||
|
flag = exp.update();
|
||||||
|
|
||||||
|
if(flag) {
|
||||||
|
this.setDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rand.nextInt(5) == 0)
|
||||||
|
this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||||
|
|
||||||
|
if(!flag)
|
||||||
|
{
|
||||||
|
this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_LIGHTNING_THUNDER, SoundCategory.AMBIENT, 10000.0F, 0.8F + this.rand.nextFloat() * 0.2F);
|
||||||
|
ExplosionNukeGeneric.dealDamage(this.world, (int)this.posX, (int)this.posY, (int)this.posZ, this.destructionRange * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
age++;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() { }
|
||||||
|
/* public int speed = 1;
|
||||||
|
//private boolean salted;
|
||||||
|
//private boolean thermonuclear;
|
||||||
|
|
||||||
|
public EntityThermonuclearBlast(World p_i1582_1_) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(0, 0);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityThermonuclearBlast(World p_i1582_1_, boolean salt) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(0, 0);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
//this.salted = salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public EntityThermonuclearBlast(World p_i1582_1_, int maxAge) {
|
||||||
|
super(p_i1582_1_);
|
||||||
|
this.setSize(0, 0);
|
||||||
|
this.ignoreFrustumCheck = true;
|
||||||
|
this.isImmuneToFire = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public AxisAlignedBB getRenderBoundingBox()
|
||||||
|
{
|
||||||
|
double X = this.posX;
|
||||||
|
double X2 = MathHelper.floor(X - getScale() - 1.0D);
|
||||||
|
double X3 = MathHelper.floor(X + getScale() - 1.0D);
|
||||||
|
double Y = this.posY;
|
||||||
|
double Y2 = MathHelper.floor(Y - getScale() - 1.0D);
|
||||||
|
double Y3 = MathHelper.floor(Y + getScale() - 1.0D);
|
||||||
|
double Z = this.posZ;
|
||||||
|
double Z2 = MathHelper.floor(Z - getScale() - 1.0D);
|
||||||
|
double Z3 = MathHelper.floor(Z + getScale() - 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(X2,Y2,Z2,X3,Y3,Z3);
|
||||||
|
return bb;
|
||||||
|
//return this.getEntityBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpdate() {
|
||||||
|
boolean spawn = false;
|
||||||
|
|
||||||
|
/*if (this.world.isRemote)
|
||||||
|
{
|
||||||
|
for (int x = (int) (this.posX-getScale()); this.posX < (int) (this.posX+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int z = (int) (this.posZ-getScale()); this.posZ < (int) (this.posZ+getScale()); ++x)
|
||||||
|
{
|
||||||
|
for (int y = 0; this.posY < 256; ++x)
|
||||||
|
{
|
||||||
|
this.world.spawnParticle(EnumParticleTypes.PORTAL, (double)x, (double)y, (double)z, x, y-0.5, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!world.isRemote) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
for(int i = 0; i < 512; i++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(radProgress * 0.5, 0, 0);
|
||||||
|
double circum = radProgress * 2 * Math.PI * 2;
|
||||||
|
|
||||||
|
///
|
||||||
|
if(circum == 0)
|
||||||
|
circum = 1;
|
||||||
|
///
|
||||||
|
|
||||||
|
double part = 360D / circum;
|
||||||
|
|
||||||
|
vec.rotateAroundY((float) (part * revProgress));
|
||||||
|
|
||||||
|
int x = (int) (posX + vec.xCoord);
|
||||||
|
int z = (int) (posZ + vec.zCoord);
|
||||||
|
|
||||||
|
double dist = radProgress * 100 / getScale() * 0.5;
|
||||||
|
pos.setPos(x, posY, z);
|
||||||
|
contaminate(pos, dist);
|
||||||
|
|
||||||
|
revProgress++;
|
||||||
|
|
||||||
|
if(revProgress > circum) {
|
||||||
|
revProgress = 0;
|
||||||
|
radProgress++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(radProgress > getScale() * 2D) {
|
||||||
|
this.setDead();
|
||||||
|
if(!spawn)
|
||||||
|
{
|
||||||
|
spawn=true;
|
||||||
|
EntityShockwave shock = new EntityShockwave(this.world);
|
||||||
|
shock.posX = this.posX;
|
||||||
|
shock.posY = this.posY;
|
||||||
|
shock.posZ = this.posZ;
|
||||||
|
shock.setScale((int)(this.getScale() * 2) * 100 / 100);
|
||||||
|
this.world.spawnEntity(shock);
|
||||||
|
|
||||||
|
EntityFalloutRain fallout = new EntityFalloutRain(this.world);
|
||||||
|
fallout.posX = this.posX;
|
||||||
|
fallout.posY = this.posY;
|
||||||
|
fallout.posZ = this.posZ;
|
||||||
|
fallout.setScale((int)(this.getScale() * TrinityConfig.fallout_multiplier) * 100 / 100);
|
||||||
|
fallout.setThermonuclear(true);
|
||||||
|
fallout.setIntensity(this.getIntensity());
|
||||||
|
this.world.spawnEntity(fallout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void contaminate(MutableBlockPos pos, double dist) {
|
||||||
|
|
||||||
|
int depth = 0;
|
||||||
|
|
||||||
|
//int mult = 1;
|
||||||
|
int maxDepth = (int) (dist/10);
|
||||||
|
int topBlock =world.getTopSolidOrLiquidBlock(pos).getY();
|
||||||
|
|
||||||
|
for(int y = topBlock+35; y >= topBlock-maxDepth; y--) {
|
||||||
|
pos.setY(y);
|
||||||
|
IBlockState b = world.getBlockState(pos);
|
||||||
|
//int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
|
||||||
|
if(b.getBlock()!=Blocks.AIR && b.getBlock().getExplosionResistance(this)<=200) {
|
||||||
|
depth++;
|
||||||
|
if(depth<=dist/10)
|
||||||
|
{
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void entityInit() {
|
||||||
|
this.dataManager.register(SCALE, Integer.valueOf(0));
|
||||||
|
// this.dataManager.register(SALTED, Boolean.valueOf(false));
|
||||||
|
// this.dataManager.register(THERMONUCLEAR, Boolean.valueOf(false));
|
||||||
|
this.dataManager.register(INTENSITY, Integer.valueOf(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void readEntityFromNBT(NBTTagCompound p_70037_1_) {
|
||||||
|
setScale(p_70037_1_.getInteger("scale"));
|
||||||
|
// setSalted(p_70037_1_.getBoolean("salted"));
|
||||||
|
// setThermonuclear(p_70037_1_.getBoolean("thermonuclear"));
|
||||||
|
setIntensity(p_70037_1_.getInteger("intensity"));
|
||||||
|
revProgress = p_70037_1_.getInteger("revProgress");
|
||||||
|
radProgress = p_70037_1_.getInteger("radProgress");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void writeEntityToNBT(NBTTagCompound p_70014_1_) {
|
||||||
|
p_70014_1_.setInteger("scale", getScale());
|
||||||
|
// p_70014_1_.setBoolean("salted", getSalted());
|
||||||
|
// p_70014_1_.setBoolean("thermonuclear", getThermonuclear());
|
||||||
|
p_70014_1_.setInteger("intensity", getIntensity());
|
||||||
|
p_70014_1_.setInteger("revProgress", revProgress);
|
||||||
|
p_70014_1_.setInteger("radProgress", radProgress);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public void setSalted(boolean i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SALTED, Boolean.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getSalted() {
|
||||||
|
|
||||||
|
boolean salt = this.dataManager.get(SALTED);
|
||||||
|
|
||||||
|
return salt == false ? false : salt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setThermonuclear(boolean i) {
|
||||||
|
|
||||||
|
this.dataManager.set(THERMONUCLEAR, Boolean.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getThermonuclear() {
|
||||||
|
|
||||||
|
boolean thermo = this.dataManager.get(THERMONUCLEAR);
|
||||||
|
|
||||||
|
return thermo == false ? false : thermo;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
public void setIntensity(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(INTENSITY, Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIntensity() {
|
||||||
|
|
||||||
|
int intensity = this.dataManager.get(INTENSITY);
|
||||||
|
|
||||||
|
return intensity == 0 ? 1 : intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScale(int i) {
|
||||||
|
|
||||||
|
this.dataManager.set(SCALE, Integer.valueOf(i));
|
||||||
|
/*if(Trinity.ICBMLoaded)
|
||||||
|
{
|
||||||
|
new BlastEMP().setBlastWorld(this.world).setBlastSource(this).setBlastPosition(this.posX, this.posY, this.posZ)
|
||||||
|
.setBlastSize(i*2)
|
||||||
|
.setExplosiveData(ExplosiveRefs.EMP)
|
||||||
|
.buildBlast().runBlast();
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getScale() {
|
||||||
|
|
||||||
|
int scale = this.dataManager.get(SCALE);
|
||||||
|
|
||||||
|
return scale == 0 ? 1 : scale;
|
||||||
|
}
|
||||||
|
}
|
213
src/main/java/trinity/explosion/ExplosionNukeGeneric.java
Normal file
213
src/main/java/trinity/explosion/ExplosionNukeGeneric.java
Normal file
|
@ -0,0 +1,213 @@
|
||||||
|
package trinity.explosion;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.entity.IEntityRads;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.DamageSources;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
|
import net.minecraft.block.BlockSlab;
|
||||||
|
import net.minecraft.block.BlockStairs;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.enchantment.EnchantmentProtection;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.passive.EntityOcelot;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
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.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModDamageSources;
|
||||||
|
import trinity.init.ModEvents;
|
||||||
|
//import net.minecraft.world.WorldSettings.GameType;
|
||||||
|
//import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
/*import com.hbm.blocks.ModBlocks;
|
||||||
|
import com.hbm.blocks.generic.DecoBlockAlt;
|
||||||
|
import com.hbm.entity.effect.EntityBlackHole;
|
||||||
|
import com.hbm.entity.effect.EntityNukeCloudSmall;
|
||||||
|
import com.hbm.entity.grenade.EntityGrenadeASchrab;
|
||||||
|
import com.hbm.entity.grenade.EntityGrenadeNuclear;
|
||||||
|
import com.hbm.entity.missile.EntityMIRV;
|
||||||
|
import com.hbm.entity.projectile.EntityExplosiveBeam;
|
||||||
|
import com.hbm.entity.projectile.EntityMiniMIRV;
|
||||||
|
import com.hbm.entity.projectile.EntityMiniNuke;*/
|
||||||
|
//import com.hbm.interfaces.IConsumer;
|
||||||
|
//import com.hbm.interfaces.ISource;
|
||||||
|
//import com.hbm.items.ModItems;
|
||||||
|
//import com.hbm.lib.Library;
|
||||||
|
//import com.hbm.lib.ModDamageSource;
|
||||||
|
//import com.hbm.tileentity.bomb.TileEntityTurretBase;
|
||||||
|
//import com.hbm.tileentity.machine.TileEntityDummy;
|
||||||
|
|
||||||
|
//import cofh.api.energy.IEnergyProvider;
|
||||||
|
|
||||||
|
public class ExplosionNukeGeneric {
|
||||||
|
|
||||||
|
private final static Random random = new Random();
|
||||||
|
|
||||||
|
public static boolean isObstructed(World world, BlockPos pos1, BlockPos pos2) {
|
||||||
|
|
||||||
|
Vec3 vector = Vec3.createVectorHelper(pos2.getX() - pos1.getX(), pos2.getY() - pos1.getY(), pos2.getZ() - pos1.getZ());
|
||||||
|
double length = vector.lengthVector();
|
||||||
|
Vec3 nVec = vector.normalize();
|
||||||
|
for(float i = 0; i < length; i += 0.25F)
|
||||||
|
{
|
||||||
|
BlockPos pos3 = new BlockPos((int) Math.round(pos1.getX() + (nVec.xCoord * i)), (int) Math.round(pos1.getY() + (nVec.yCoord * i)), (int) Math.round(pos1.getZ() + (nVec.zCoord * i)));
|
||||||
|
if(world.getBlockState(pos3).getBlock() != Blocks.AIR &&
|
||||||
|
world.getBlockState(pos3).isNormalCube())
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void dealDamage(World world, int x, int y, int z, int bombStartStrength) {
|
||||||
|
float f = bombStartStrength;
|
||||||
|
HashSet hashset = new HashSet();
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
double d5;
|
||||||
|
double d6;
|
||||||
|
double d7;
|
||||||
|
double wat = bombStartStrength/** 2 */
|
||||||
|
;
|
||||||
|
boolean isOccupied = false;
|
||||||
|
|
||||||
|
// bombStartStrength *= 2.0F;
|
||||||
|
i = MathHelper.floor(x - wat - 1.0D);
|
||||||
|
j = MathHelper.floor(x + wat + 1.0D);
|
||||||
|
k = MathHelper.floor(y - wat - 1.0D);
|
||||||
|
int i2 = MathHelper.floor(y + wat + 1.0D);
|
||||||
|
int l = MathHelper.floor(z - wat - 1.0D);
|
||||||
|
int j2 = MathHelper.floor(z + wat + 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(i,k,l,j,i2,j2);
|
||||||
|
List list = world.getEntitiesWithinAABBExcludingEntity(null, bb);
|
||||||
|
Vec3d vec3 = new Vec3d(x, y, z);
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < list.size(); ++i1) {
|
||||||
|
Entity entity = (Entity) list.get(i1);
|
||||||
|
double d4 = entity.getDistance(x, y, z) / bombStartStrength;
|
||||||
|
|
||||||
|
if (d4 <= 1.0D) {
|
||||||
|
d5 = entity.posX - x;
|
||||||
|
d6 = entity.posY + entity.getEyeHeight() - y;
|
||||||
|
d7 = entity.posZ - z;
|
||||||
|
BlockPos pos1 = new BlockPos(x,y,z);
|
||||||
|
BlockPos pos2 = new BlockPos(entity.posX,entity.posY + entity.getEyeHeight(),entity.posZ);
|
||||||
|
double d9 = MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
|
||||||
|
if(!isObstructed(world, pos1, pos2))
|
||||||
|
{
|
||||||
|
if (d9 < wat && !(entity instanceof EntityPlayer)) {
|
||||||
|
/*
|
||||||
|
&& !(entity instanceof EntityPlayer && Library.checkArmor((EntityPlayer) entity, ModItems.euphemium_helmet,
|
||||||
|
ModItems.euphemium_plate, ModItems.euphemium_legs, ModItems.euphemium_boots))) {
|
||||||
|
*/
|
||||||
|
|
||||||
|
d5 /= d9;
|
||||||
|
d6 /= d9;
|
||||||
|
d7 /= d9;
|
||||||
|
double d11 = (1.0D - d4);// * d10;
|
||||||
|
if (!(entity instanceof EntityPlayerMP) || (entity instanceof EntityPlayerMP
|
||||||
|
&& !((EntityPlayerMP) entity).isCreative())) {
|
||||||
|
// entity.attackEntityFrom(DamageSource.generic,
|
||||||
|
// ((int)((d11 * d11 + d11) / 2.0D * 8.0D *
|
||||||
|
// bombStartStrength + 1.0D)));
|
||||||
|
double realisticDamage = 4*(bombStartStrength*bombStartStrength)/entity.getDistance(x, y, z);
|
||||||
|
double damage = entity.getDistance(x, y, z) / bombStartStrength * 250;
|
||||||
|
// entity.attackEntityFrom(ModDamageSource.nuclearBlast, (float)damage);
|
||||||
|
entity.attackEntityFrom(ModDamageSources.NUCLEAR_EXPLOSION, (float)damage);
|
||||||
|
entity.setFire(5);
|
||||||
|
if(entity instanceof EntityLivingBase)
|
||||||
|
{
|
||||||
|
double d8 = EnchantmentProtection.getBlastDamageReduction((EntityLivingBase)entity, d11);
|
||||||
|
entity.motionX += d5 * d8 * 0.2D;
|
||||||
|
entity.motionY += d6 * d8 * 0.2D;
|
||||||
|
entity.motionZ += d7 * d8 * 0.2D;
|
||||||
|
}
|
||||||
|
entity.motionX += d5 * 0.2D;
|
||||||
|
entity.motionY += d6 * 0.2D;
|
||||||
|
entity.motionZ += d7 * 0.2D;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bombStartStrength = (int) f;
|
||||||
|
}
|
||||||
|
public static void irradiate(World world, int x, int y, int z, int bombStartStrength) {
|
||||||
|
float f = bombStartStrength;
|
||||||
|
HashSet hashset = new HashSet();
|
||||||
|
int i;
|
||||||
|
int j;
|
||||||
|
int k;
|
||||||
|
double d5;
|
||||||
|
double d6;
|
||||||
|
double d7;
|
||||||
|
double wat = bombStartStrength/** 2 */
|
||||||
|
;
|
||||||
|
boolean isOccupied = false;
|
||||||
|
|
||||||
|
// bombStartStrength *= 2.0F;
|
||||||
|
i = MathHelper.floor(x - wat - 1.0D);
|
||||||
|
j = MathHelper.floor(x + wat + 1.0D);
|
||||||
|
k = MathHelper.floor(y - wat - 1.0D);
|
||||||
|
int i2 = MathHelper.floor(y + wat + 1.0D);
|
||||||
|
int l = MathHelper.floor(z - wat - 1.0D);
|
||||||
|
int j2 = MathHelper.floor(z + wat + 1.0D);
|
||||||
|
AxisAlignedBB bb = new AxisAlignedBB(i,k,l,j,i2,j2);
|
||||||
|
List list = world.getEntitiesWithinAABBExcludingEntity(null, bb);
|
||||||
|
Vec3d vec3 = new Vec3d(x, y, z);
|
||||||
|
|
||||||
|
for (int i1 = 0; i1 < list.size(); ++i1) {
|
||||||
|
Entity entity = (Entity) list.get(i1);
|
||||||
|
double d4 = entity.getDistance(x, y, z) / bombStartStrength;
|
||||||
|
|
||||||
|
if (d4 <= 1.0D) {
|
||||||
|
d5 = entity.posX - x;
|
||||||
|
d6 = entity.posY + entity.getEyeHeight() - y;
|
||||||
|
d7 = entity.posZ - z;
|
||||||
|
double d9 = MathHelper.sqrt(d5 * d5 + d6 * d6 + d7 * d7);
|
||||||
|
if (d9 < wat) {
|
||||||
|
d5 /= d9;
|
||||||
|
d6 /= d9;
|
||||||
|
d7 /= d9;
|
||||||
|
double d11 = (1.0D - d4);
|
||||||
|
double rads = 100*(Math.pow(bombStartStrength, 2))/Math.pow(entity.getDistance(x, y, z), 2);
|
||||||
|
|
||||||
|
if(entity instanceof EntityLivingBase)
|
||||||
|
{
|
||||||
|
IEntityRads eRads = RadiationHelper.getEntityRadiation((EntityLivingBase)entity);
|
||||||
|
eRads.setRadiationLevel(RadiationHelper.addRadsToEntity(eRads, ((EntityLivingBase)entity), rads, false, false, 1));
|
||||||
|
if(rads>=NCConfig.max_player_rads)
|
||||||
|
{
|
||||||
|
entity.setEntityInvulnerable(false);
|
||||||
|
entity.attackEntityFrom(DamageSources.FATAL_RADS, Float.MAX_VALUE);
|
||||||
|
//((EntityLivingBase) entity).onDeath(DamageSources.FATAL_RADS);
|
||||||
|
//((EntityLivingBase) entity).setHealth(0);
|
||||||
|
//entity.attackEntityFrom(DamageSources.FATAL_RADS, Float.MAX_VALUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bombStartStrength = (int) f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
333
src/main/java/trinity/explosion/ExplosionNukeRay.java
Normal file
333
src/main/java/trinity/explosion/ExplosionNukeRay.java
Normal file
|
@ -0,0 +1,333 @@
|
||||||
|
package trinity.explosion;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
|
||||||
|
//import com.hbm.main.MainRegistry;
|
||||||
|
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
//import net.minecraft.util.Vec3;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
//import net.minecraft.world.ChunkPosition;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
|
||||||
|
public class ExplosionNukeRay {
|
||||||
|
|
||||||
|
List<FloatTriplet> affectedBlocks = new ArrayList();
|
||||||
|
int posX;
|
||||||
|
int posY;
|
||||||
|
int posZ;
|
||||||
|
Random rand = new Random();
|
||||||
|
World world;
|
||||||
|
int strength;
|
||||||
|
int count;
|
||||||
|
int speed;
|
||||||
|
int processed;
|
||||||
|
int length;
|
||||||
|
int startY;
|
||||||
|
int startCir;
|
||||||
|
boolean hyperspace;
|
||||||
|
public boolean isAusf3Complete = false;
|
||||||
|
|
||||||
|
public ExplosionNukeRay(World world, int x, int y, int z, int strength, int count, int speed, int length, boolean hyperspace) {
|
||||||
|
this.world = world;
|
||||||
|
this.posX = x;
|
||||||
|
this.posY = y;
|
||||||
|
this.posZ = z;
|
||||||
|
this.strength = strength;
|
||||||
|
this.count = count;
|
||||||
|
this.speed = speed;
|
||||||
|
this.length = length;
|
||||||
|
this.hyperspace = hyperspace;
|
||||||
|
//Ausf3, must be double
|
||||||
|
//this.startY = strength;
|
||||||
|
//Mk 4.5, must be int32
|
||||||
|
this.startY = 0;
|
||||||
|
this.startCir = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processTip(int count) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
int processedBlocks = 0;
|
||||||
|
int braker = 0;
|
||||||
|
|
||||||
|
for(int l = 0; l < Integer.MAX_VALUE; l++) {
|
||||||
|
|
||||||
|
if(processedBlocks >= count)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(braker >= count * 50)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(l > affectedBlocks.size() - 1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if(affectedBlocks.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
int in = affectedBlocks.size() - 1;
|
||||||
|
|
||||||
|
float x = affectedBlocks.get(in).xCoord;
|
||||||
|
float y = affectedBlocks.get(in).yCoord;
|
||||||
|
float z = affectedBlocks.get(in).zCoord;
|
||||||
|
pos.setPos(x, y, z);
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(x - this.posX, y - this.posY, z - this.posZ);
|
||||||
|
double pX = vec.xCoord / vec.lengthVector();
|
||||||
|
double pY = vec.yCoord / vec.lengthVector();
|
||||||
|
double pZ = vec.zCoord / vec.lengthVector();
|
||||||
|
|
||||||
|
for(int i = 0; i < vec.lengthVector(); i ++) {
|
||||||
|
int x0 = (int)(posX + pX * i);
|
||||||
|
int y0 = (int)(posY + pY * i);
|
||||||
|
int z0 = (int)(posZ + pZ * i);
|
||||||
|
pos.setPos(x0, y0, z0);
|
||||||
|
if(!world.isAirBlock(pos)) {
|
||||||
|
//Chunk chunk = world.getChunk(pos);
|
||||||
|
/*if (chunk != null || chunk.hasCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null))
|
||||||
|
{
|
||||||
|
IRadiationSource chunkRadation = chunk.getCapability(IRadiationSource.CAPABILITY_RADIATION_SOURCE, null);
|
||||||
|
if (chunkRadation != null)
|
||||||
|
{
|
||||||
|
double promptRads = 0.001;
|
||||||
|
if (chunkRadation.getRadiationBuffer() < (promptRads)) {
|
||||||
|
chunkRadation.setRadiationBuffer(promptRads);
|
||||||
|
} else {
|
||||||
|
chunkRadation.setRadiationBuffer(chunkRadation.getRadiationLevel() + promptRads);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
world.setBlockToAir(pos);
|
||||||
|
processedBlocks++;
|
||||||
|
}
|
||||||
|
|
||||||
|
braker++;
|
||||||
|
}
|
||||||
|
|
||||||
|
affectedBlocks.remove(in);
|
||||||
|
}
|
||||||
|
|
||||||
|
processed += count;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void collectTip(int count) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
for(int k = 0; k < count; k++) {
|
||||||
|
double phi = rand.nextDouble() * (Math.PI * 2);
|
||||||
|
double costheta = rand.nextDouble() * 2 - 1;
|
||||||
|
double theta = Math.acos(costheta);
|
||||||
|
double x = Math.sin(theta) * Math.cos(phi);
|
||||||
|
double y = Math.sin(theta) * Math.sin(phi);
|
||||||
|
double z = Math.cos(theta);
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(x, y, z);
|
||||||
|
int length = (int)Math.ceil(strength);
|
||||||
|
|
||||||
|
float res = strength;
|
||||||
|
|
||||||
|
FloatTriplet lastPos = null;
|
||||||
|
|
||||||
|
for(int i = 0; i < length; i ++) {
|
||||||
|
|
||||||
|
if(i > this.length)
|
||||||
|
break;
|
||||||
|
|
||||||
|
float x0 = (float) (posX + (vec.xCoord * i));
|
||||||
|
float y0 = (float) (posY + (vec.yCoord * i));
|
||||||
|
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||||
|
pos.setPos(x0, y0, z0);
|
||||||
|
if(!hyperspace)
|
||||||
|
{
|
||||||
|
if(!world.getBlockState(pos).getMaterial().isLiquid())
|
||||||
|
res -= Math.pow(world.getBlockState(pos).getBlock().getExplosionResistance(world, pos, null, null), 1.25);
|
||||||
|
else
|
||||||
|
res -= Math.pow(Blocks.AIR.getExplosionResistance(world, pos, null, null), 1.25);
|
||||||
|
}
|
||||||
|
if(res > 0 && world.getBlockState(pos).getBlock() != Blocks.AIR) {
|
||||||
|
lastPos = new FloatTriplet(x0, y0, z0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res <= 0 || i + 1 >= this.length) {
|
||||||
|
if(affectedBlocks.size() < Integer.MAX_VALUE - 100 && lastPos != null)
|
||||||
|
affectedBlocks.add(new FloatTriplet(lastPos.xCoord, lastPos.yCoord, lastPos.zCoord));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void collectTipExperimental(int count) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
for(int k = 0; k < count; k++) {
|
||||||
|
double phi = rand.nextDouble() * (Math.PI * 2);
|
||||||
|
double costheta = rand.nextDouble() * 2 - 1;
|
||||||
|
double theta = Math.acos(costheta);
|
||||||
|
double x = Math.sin(theta) * Math.cos(phi);
|
||||||
|
double y = Math.sin(theta) * Math.sin(phi);
|
||||||
|
double z = Math.cos(theta);
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(x, y, z);
|
||||||
|
int length = (int)Math.ceil(strength);
|
||||||
|
|
||||||
|
float res = strength;
|
||||||
|
|
||||||
|
FloatTriplet lastPos = null;
|
||||||
|
|
||||||
|
for(int i = 0; i < length; i ++) {
|
||||||
|
|
||||||
|
if(i > this.length)
|
||||||
|
break;
|
||||||
|
|
||||||
|
float x0 = (float) (posX + (vec.xCoord * i));
|
||||||
|
float y0 = (float) (posY + (vec.yCoord * i));
|
||||||
|
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||||
|
pos.setPos(x0, y0, z0);
|
||||||
|
double fac = 100 - ((double) i) / ((double) length) * 100;
|
||||||
|
fac *= 0.07D;
|
||||||
|
|
||||||
|
if(!hyperspace)
|
||||||
|
{
|
||||||
|
if(!world.getBlockState(pos).getMaterial().isLiquid())
|
||||||
|
res -= Math.pow(world.getBlockState(pos).getBlock().getExplosionResistance(world, pos, null, null), 7.5D - fac);
|
||||||
|
else
|
||||||
|
res -= Math.pow(Blocks.AIR.getExplosionResistance(world, pos, null, null), 7.5D - fac);
|
||||||
|
}
|
||||||
|
if(res > 0 && world.getBlockState(pos).getBlock() != Blocks.AIR) {
|
||||||
|
lastPos = new FloatTriplet(x0, y0, z0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res <= 0 || i + 1 >= this.length) {
|
||||||
|
if(affectedBlocks.size() < Integer.MAX_VALUE - 100 && lastPos != null)
|
||||||
|
affectedBlocks.add(new FloatTriplet(lastPos.xCoord, lastPos.yCoord, lastPos.zCoord));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void collectTipMk4_5(int count) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
int amountProcessed = 0;
|
||||||
|
|
||||||
|
double bow = Math.PI * this.strength;
|
||||||
|
double bowCount = Math.ceil(bow);
|
||||||
|
|
||||||
|
//Axial
|
||||||
|
//StartY starts at this.length
|
||||||
|
for(int v = startY; v <= bowCount; v++) {
|
||||||
|
|
||||||
|
float part = (float) (Math.PI/bow);
|
||||||
|
float rot = part * -v;
|
||||||
|
|
||||||
|
Vec3 heightVec = Vec3.createVectorHelper(0, -strength, 0);
|
||||||
|
heightVec.rotateAroundZ(rot);
|
||||||
|
|
||||||
|
double y = heightVec.yCoord;
|
||||||
|
|
||||||
|
double sectionRad = Math.sqrt(Math.pow(strength, 2) - Math.pow(y, 2));
|
||||||
|
double circumference = 2 * Math.PI * sectionRad;
|
||||||
|
|
||||||
|
//if(y < 2 && y > -2)
|
||||||
|
// circumference *= 1.25D;
|
||||||
|
|
||||||
|
//circumference = Math.ceil(circumference);
|
||||||
|
|
||||||
|
//Radial
|
||||||
|
//StartCir starts at circumference
|
||||||
|
for(int r = startCir; r < circumference; r ++) {
|
||||||
|
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(sectionRad, y, 0);
|
||||||
|
vec = vec.normalize();
|
||||||
|
/*if(y > 0)
|
||||||
|
vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);*/
|
||||||
|
/*if(y < 0)
|
||||||
|
vec.rotateAroundZ((float) (y / sectionRad) * 0.15F);*/
|
||||||
|
vec.rotateAroundY((float) (360 / circumference * r));
|
||||||
|
|
||||||
|
int length = (int)Math.ceil(strength);
|
||||||
|
|
||||||
|
float res = strength;
|
||||||
|
|
||||||
|
FloatTriplet lastPos = null;
|
||||||
|
|
||||||
|
for(int i = 0; i < length; i ++) {
|
||||||
|
|
||||||
|
if(i > this.length)
|
||||||
|
break;
|
||||||
|
|
||||||
|
float x0 = (float) (posX + (vec.xCoord * i));
|
||||||
|
float y0 = (float) (posY + (vec.yCoord * i));
|
||||||
|
float z0 = (float) (posZ + (vec.zCoord * i));
|
||||||
|
pos.setPos(x0, y0, z0);
|
||||||
|
double fac = 100 - ((double) i) / ((double) length) * 100;
|
||||||
|
fac *= 0.07D;
|
||||||
|
|
||||||
|
if(!hyperspace)
|
||||||
|
{
|
||||||
|
if(!world.getBlockState(pos).getMaterial().isLiquid())
|
||||||
|
res -= Math.pow(world.getBlockState(pos).getBlock().getExplosionResistance(world, pos, null, null), 7.5D - fac);
|
||||||
|
else
|
||||||
|
res -= Math.pow(Blocks.AIR.getExplosionResistance(world, pos, null, null), 7.5D - fac);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res > 0 && world.getBlockState(pos).getBlock() != Blocks.AIR) {
|
||||||
|
lastPos = new FloatTriplet(x0, y0, z0);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(res <= 0 || i + 1 >= this.length) {
|
||||||
|
if(affectedBlocks.size() < Integer.MAX_VALUE - 100 && lastPos != null) {
|
||||||
|
affectedBlocks.add(new FloatTriplet(lastPos.xCoord, lastPos.yCoord, lastPos.zCoord));
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
amountProcessed++;
|
||||||
|
|
||||||
|
if(amountProcessed >= count) {
|
||||||
|
startY = v;
|
||||||
|
startCir = startCir + 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
isAusf3Complete = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteStorage() {
|
||||||
|
this.affectedBlocks.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStoredSize() {
|
||||||
|
return this.affectedBlocks.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getProgress() {
|
||||||
|
return this.processed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FloatTriplet {
|
||||||
|
public float xCoord;
|
||||||
|
public float yCoord;
|
||||||
|
public float zCoord;
|
||||||
|
|
||||||
|
public FloatTriplet(float x, float y, float z) {
|
||||||
|
xCoord = x;
|
||||||
|
yCoord = y;
|
||||||
|
zCoord = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
154
src/main/java/trinity/explosion/ExplosionThermonuclear.java
Normal file
154
src/main/java/trinity/explosion/ExplosionThermonuclear.java
Normal file
|
@ -0,0 +1,154 @@
|
||||||
|
package trinity.explosion;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.capability.radiation.entity.IEntityRads;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.DamageSources;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockLiquid;
|
||||||
|
import net.minecraft.block.BlockSlab;
|
||||||
|
import net.minecraft.block.BlockStairs;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.enchantment.EnchantmentProtection;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.item.EntityItem;
|
||||||
|
import net.minecraft.entity.passive.EntityOcelot;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.AxisAlignedBB;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.init.ModDamageSources;
|
||||||
|
import trinity.init.ModEvents;
|
||||||
|
|
||||||
|
public class ExplosionThermonuclear {
|
||||||
|
|
||||||
|
private final static Random random = new Random();
|
||||||
|
|
||||||
|
public int posX;
|
||||||
|
public int posY;
|
||||||
|
public int posZ;
|
||||||
|
public int lastposX = 0;
|
||||||
|
public int lastposZ = 0;
|
||||||
|
public int radius;
|
||||||
|
public int radius2;
|
||||||
|
public World worldObj;
|
||||||
|
private int n = 1;
|
||||||
|
private int nlimit;
|
||||||
|
private int shell;
|
||||||
|
private int leg;
|
||||||
|
private int element;
|
||||||
|
|
||||||
|
public void saveToNbt(NBTTagCompound nbt, String name) {
|
||||||
|
nbt.setInteger(name + "posX", posX);
|
||||||
|
nbt.setInteger(name + "posY", posY);
|
||||||
|
nbt.setInteger(name + "posZ", posZ);
|
||||||
|
nbt.setInteger(name + "lastposX", lastposX);
|
||||||
|
nbt.setInteger(name + "lastposZ", lastposZ);
|
||||||
|
nbt.setInteger(name + "radius", radius);
|
||||||
|
nbt.setInteger(name + "radius2", radius2);
|
||||||
|
nbt.setInteger(name + "n", n);
|
||||||
|
nbt.setInteger(name + "nlimit", nlimit);
|
||||||
|
nbt.setInteger(name + "shell", shell);
|
||||||
|
nbt.setInteger(name + "leg", leg);
|
||||||
|
nbt.setInteger(name + "element", element);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNbt(NBTTagCompound nbt, String name) {
|
||||||
|
posX = nbt.getInteger(name + "posX");
|
||||||
|
posY = nbt.getInteger(name + "posY");
|
||||||
|
posZ = nbt.getInteger(name + "posZ");
|
||||||
|
lastposX = nbt.getInteger(name + "lastposX");
|
||||||
|
lastposZ = nbt.getInteger(name + "lastposZ");
|
||||||
|
radius = nbt.getInteger(name + "radius");
|
||||||
|
radius2 = nbt.getInteger(name + "radius2");
|
||||||
|
n = nbt.getInteger(name + "n");
|
||||||
|
nlimit = nbt.getInteger(name + "nlimit");
|
||||||
|
shell = nbt.getInteger(name + "shell");
|
||||||
|
leg = nbt.getInteger(name + "leg");
|
||||||
|
element = nbt.getInteger(name + "element");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ExplosionThermonuclear(int x, int y, int z, World world, int rad)
|
||||||
|
{
|
||||||
|
this.posX = x;
|
||||||
|
this.posY = y;
|
||||||
|
this.posZ = z;
|
||||||
|
|
||||||
|
this.worldObj = world;
|
||||||
|
|
||||||
|
this.radius = rad;
|
||||||
|
this.radius2 = this.radius * this.radius;
|
||||||
|
|
||||||
|
this.nlimit = this.radius2 * 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean update()
|
||||||
|
{
|
||||||
|
breakColumn(this.lastposX, this.lastposZ);
|
||||||
|
this.shell = (int) Math.floor((Math.sqrt(n) + 1) / 2);
|
||||||
|
int shell2 = this.shell * 2;
|
||||||
|
this.leg = (int) Math.floor((this.n - (shell2 - 1) * (shell2 - 1)) / shell2);
|
||||||
|
this.element = (this.n - (shell2 - 1) * (shell2 - 1)) - shell2 * this.leg - this.shell + 1;
|
||||||
|
this.lastposX = this.leg == 0 ? this.shell : this.leg == 1 ? -this.element : this.leg == 2 ? -this.shell : this.element;
|
||||||
|
this.lastposZ = this.leg == 0 ? this.element : this.leg == 1 ? this.shell : this.leg == 2 ? -this.element : -this.shell;
|
||||||
|
this.n++;
|
||||||
|
return this.n > this.nlimit;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void breakColumn(int x, int z)
|
||||||
|
{
|
||||||
|
int dist = (int) (radius - Math.sqrt(x * x + z * z));
|
||||||
|
|
||||||
|
if (dist > 0) {
|
||||||
|
MutableBlockPos pos = new MutableBlockPos();
|
||||||
|
int pX = posX + x;
|
||||||
|
int pZ = posZ + z;
|
||||||
|
|
||||||
|
int y = worldObj.getHeight(pX, pZ);
|
||||||
|
pos.setPos(pX, y, pZ);
|
||||||
|
int maxdepth = (int) (10 + radius * 0.0625);
|
||||||
|
int depth = (int) ((maxdepth * dist / radius) + (Math.sin(dist * 0.15 + 2) * 2));//
|
||||||
|
|
||||||
|
depth = Math.max(y - depth, 0);
|
||||||
|
|
||||||
|
while(y > depth) {
|
||||||
|
|
||||||
|
|
||||||
|
worldObj.setBlockToAir(pos);
|
||||||
|
|
||||||
|
y--;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(worldObj.rand.nextInt(10) == 0) {
|
||||||
|
worldObj.setBlock(pX, depth + 1, pZ, ModBlocks.balefire);
|
||||||
|
|
||||||
|
if(worldObj.getBlock(pX, y, pZ) == ModBlocks.block_schrabidium_cluster)
|
||||||
|
worldObj.setBlock(pX, y, pZ, ModBlocks.block_euphemium_cluster, worldObj.getBlockMetadata(pX, y, pZ), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = depth; i > depth - 5; i--) {
|
||||||
|
if(worldObj.getBlock(pX, i, pZ) == Blocks.stone)
|
||||||
|
worldObj.setBlock(pX, i, pZ, ModBlocks.sellafield_slaked);
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
19
src/main/java/trinity/fluid/FluidTrinity.java
Normal file
19
src/main/java/trinity/fluid/FluidTrinity.java
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
package trinity.fluid;
|
||||||
|
|
||||||
|
//import nc.fluid.FluidBase;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
|
public class FluidTrinity extends Fluid {
|
||||||
|
|
||||||
|
public FluidTrinity(String fluidName, ResourceLocation still, ResourceLocation flow, Integer colour) {
|
||||||
|
super(fluidName, still, flow, colour);
|
||||||
|
//setDensity(1200);
|
||||||
|
//setViscosity(1200);
|
||||||
|
//setTemperature(363);
|
||||||
|
FluidRegistry.addBucketForFluid(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
150
src/main/java/trinity/fluid/TrinityFluids.java
Normal file
150
src/main/java/trinity/fluid/TrinityFluids.java
Normal file
|
@ -0,0 +1,150 @@
|
||||||
|
package trinity.fluid;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
|
|
||||||
|
import nc.block.fluid.NCBlockFluid;
|
||||||
|
import nc.block.item.NCItemBlock;
|
||||||
|
import nc.enumm.FluidType;
|
||||||
|
import nc.util.ColorHelper;
|
||||||
|
import nc.util.NCUtil;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.init.SoundEvents;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.SoundEvent;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraftforge.fluids.Fluid;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
|
||||||
|
public class TrinityFluids {
|
||||||
|
|
||||||
|
public static FluidTrinity witherite_water;
|
||||||
|
public static FluidTrinity nitric_oxide;
|
||||||
|
public static FluidTrinity nitrogen_dioxide;
|
||||||
|
public static FluidTrinity nitric_acid;
|
||||||
|
public static FluidTrinity barium_nitrate_solution;
|
||||||
|
public static FluidTrinity tnt;
|
||||||
|
public static FluidTrinity baratol;
|
||||||
|
|
||||||
|
public static List<Pair<Fluid, NCBlockFluid>> fluidPairList = new ArrayList<Pair<Fluid, NCBlockFluid>>();
|
||||||
|
|
||||||
|
public static void registerFluids() {
|
||||||
|
//witherite_water = new FluidTrinity("witherite_water", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0x7179bf);
|
||||||
|
//nitric_oxide = new FluidTrinity("nitric_oxide", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0xB2C68A);
|
||||||
|
//nitrogen_dioxide = new FluidTrinity("nitrogen_dioxide", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0x381D05);
|
||||||
|
//nitric_acid = new FluidTrinity("nitric_acid", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0x0A8375);
|
||||||
|
//barium_nitrate_solution = new FluidTrinity("barium_nitrate_solution", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0x5b65be);
|
||||||
|
tnt = new FluidTrinity("tnt", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0xFD2800);
|
||||||
|
baratol = new FluidTrinity("baratol", new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"), new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"), 0xFB8D56);
|
||||||
|
|
||||||
|
//FluidRegistry.registerFluid(witherite_water);
|
||||||
|
//FluidRegistry.registerFluid(nitric_oxide);
|
||||||
|
//FluidRegistry.registerFluid(nitrogen_dioxide);
|
||||||
|
//FluidRegistry.registerFluid(nitric_acid);
|
||||||
|
//FluidRegistry.registerFluid(barium_nitrate_solution);
|
||||||
|
FluidRegistry.registerFluid(tnt);
|
||||||
|
FluidRegistry.registerFluid(baratol);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private static <T extends Fluid, V extends NCBlockFluid> void addFluidPair(FluidType fluidType, Object... fluidArgs)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
T fluid = NCUtil.newInstance(fluidType.getFluidClass(), fluidArgs);
|
||||||
|
V block = NCUtil.newInstance(fluidType.getBlockClass(), fluid);
|
||||||
|
fluidPairList.add(Pair.of(fluid, block));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void init()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
addFluidPair(FluidType.SALT_SOLUTION, "witherite_water", waterBlend(0xC4C1A2));
|
||||||
|
addFluidPair(FluidType.GAS, "nitric_oxide", 0xB2C68A);
|
||||||
|
addFluidPair(FluidType.GAS, "nitrogen_dioxide", 0x381D05);
|
||||||
|
addFluidPair(FluidType.ACID, "nitric_acid", 0x0A8375);
|
||||||
|
addFluidPair(FluidType.SALT_SOLUTION, "barium_nitrate_solution", waterBlend(0xBFBFBF));
|
||||||
|
addFluidPair(FluidType.GAS, "deuterium-tritium_mixture", deuteriumBlend(0x5DBBD6, 0.5F));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void renderFluids() {
|
||||||
|
//blockTNT.render();
|
||||||
|
//blockBaratol.render();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register()
|
||||||
|
{
|
||||||
|
for (Pair<Fluid, NCBlockFluid> fluidPair : fluidPairList)
|
||||||
|
{
|
||||||
|
Fluid fluid = fluidPair.getLeft();
|
||||||
|
|
||||||
|
boolean defaultFluid = FluidRegistry.registerFluid(fluid);
|
||||||
|
if (!defaultFluid)
|
||||||
|
fluid = FluidRegistry.getFluid(fluid.getName());
|
||||||
|
|
||||||
|
//if(!(fluidPair.getRight() instanceof BlockFluidExotic))
|
||||||
|
//{
|
||||||
|
FluidRegistry.addBucketForFluid(fluid);
|
||||||
|
//}
|
||||||
|
registerBlock(fluidPair.getRight());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerBlock(NCBlockFluid block)
|
||||||
|
{
|
||||||
|
ForgeRegistries.BLOCKS.register(withName(block));
|
||||||
|
ForgeRegistries.ITEMS.register(new NCItemBlock(block, TextFormatting.AQUA).setRegistryName(block.getRegistryName()));
|
||||||
|
Trinity.proxy.registerFluidBlockRendering(block, block.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T extends NCBlockFluid> Block withName(T block)
|
||||||
|
{
|
||||||
|
return block.setTranslationKey(Global.MOD_ID + "." + block.name).setRegistryName(new ResourceLocation(Global.MOD_ID, block.name));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static int waterBlend(int soluteColor, float blendRatio)
|
||||||
|
{
|
||||||
|
return ColorHelper.blend(0x2F43F4, soluteColor, blendRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int deuteriumBlend(int soluteColor, float blendRatio)
|
||||||
|
{
|
||||||
|
return ColorHelper.blend(0x9E6FEF, soluteColor, blendRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int waterBlend(int soluteColor)
|
||||||
|
{
|
||||||
|
return waterBlend(soluteColor, 0.5F);
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
NCFluids.fluidPairList.add(NCFluids.fluidPair(FluidType.GAS, "nitric_oxide", 0xB2C68A));
|
||||||
|
NCFluids.fluidPairList.add(NCFluids.fluidPair(FluidType.GAS, "nitrogen_dioxide", 0x381D05));
|
||||||
|
NCFluids.fluidPairList.add(NCFluids.fluidPair(FluidType.ACID, "nitric_acid", 0x0A8375));
|
||||||
|
NCFluids.fluidPairList.add(fluidPair(TrinityFluidType.EXPLOSIVE, "TNT", 0xFD2800));
|
||||||
|
NCFluids.fluidPairList.add(fluidPair(TrinityFluidType.EXPLOSIVE, "baratol", 0xFB8D56));
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
149
src/main/java/trinity/gui/ContainerBasic.java
Normal file
149
src/main/java/trinity/gui/ContainerBasic.java
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
package trinity.gui;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* The container is used to link the client side gui to the server side inventory and it is where
|
||||||
|
* you add the slots to your gui. It can also be used to sync server side data with the client but
|
||||||
|
* that will be covered in a later tutorial
|
||||||
|
*/
|
||||||
|
public class ContainerBasic extends Container {
|
||||||
|
|
||||||
|
// Stores a reference to the tile entity instance for later use
|
||||||
|
private TileEntityShieldedContainer tileEntityInventoryBasic;
|
||||||
|
|
||||||
|
// must assign a slot number to each of the slots used by the GUI.
|
||||||
|
// For this container, we can see both the tile inventory's slots as well as the player inventory slots and the hotbar.
|
||||||
|
// Each time we add a Slot to the container, it automatically increases the slotIndex, which means
|
||||||
|
// 0 - 8 = hotbar slots (which will map to the InventoryPlayer slot numbers 0 - 8)
|
||||||
|
// 9 - 35 = player inventory slots (which map to the InventoryPlayer slot numbers 9 - 35)
|
||||||
|
// 36 - 44 = TileInventory slots, which map to our TileEntity slot numbers 0 - 8)
|
||||||
|
|
||||||
|
private final int HOTBAR_SLOT_COUNT = 9;
|
||||||
|
private final int PLAYER_INVENTORY_ROW_COUNT = 3;
|
||||||
|
private final int PLAYER_INVENTORY_COLUMN_COUNT = 9;
|
||||||
|
private final int PLAYER_INVENTORY_SLOT_COUNT = PLAYER_INVENTORY_COLUMN_COUNT * PLAYER_INVENTORY_ROW_COUNT;
|
||||||
|
private final int VANILLA_SLOT_COUNT = HOTBAR_SLOT_COUNT + PLAYER_INVENTORY_SLOT_COUNT;
|
||||||
|
|
||||||
|
private final int VANILLA_FIRST_SLOT_INDEX = 0;
|
||||||
|
private final int TE_INVENTORY_FIRST_SLOT_INDEX = VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT;
|
||||||
|
private final int TE_INVENTORY_SLOT_COUNT = 9;
|
||||||
|
|
||||||
|
public ContainerBasic(InventoryPlayer invPlayer, TileEntityShieldedContainer tileEntityInventoryBasic) {
|
||||||
|
this.tileEntityInventoryBasic = tileEntityInventoryBasic;
|
||||||
|
|
||||||
|
final int SLOT_X_SPACING = 18;
|
||||||
|
final int SLOT_Y_SPACING = 18;
|
||||||
|
final int HOTBAR_XPOS = 8;
|
||||||
|
final int HOTBAR_YPOS = 145;
|
||||||
|
// Add the players hotbar to the gui - the [xpos, ypos] location of each item
|
||||||
|
for (int x = 0; x < HOTBAR_SLOT_COUNT; x++) {
|
||||||
|
int slotNumber = x;
|
||||||
|
addSlotToContainer(new Slot(invPlayer, slotNumber, HOTBAR_XPOS + SLOT_X_SPACING * x, HOTBAR_YPOS));
|
||||||
|
}
|
||||||
|
|
||||||
|
final int PLAYER_INVENTORY_XPOS = 8;
|
||||||
|
final int PLAYER_INVENTORY_YPOS = 87;
|
||||||
|
// Add the rest of the players inventory to the gui
|
||||||
|
for (int y = 0; y < PLAYER_INVENTORY_ROW_COUNT; y++) {
|
||||||
|
for (int x = 0; x < PLAYER_INVENTORY_COLUMN_COUNT; x++) {
|
||||||
|
int slotNumber = HOTBAR_SLOT_COUNT + y * PLAYER_INVENTORY_COLUMN_COUNT + x;
|
||||||
|
int xpos = PLAYER_INVENTORY_XPOS + x * SLOT_X_SPACING;
|
||||||
|
int ypos = PLAYER_INVENTORY_YPOS + y * SLOT_Y_SPACING;
|
||||||
|
addSlotToContainer(new Slot(invPlayer, slotNumber, xpos, ypos));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (TE_INVENTORY_SLOT_COUNT != tileEntityInventoryBasic.getSizeInventory()) {
|
||||||
|
System.err.println("Mismatched slot count in ContainerBasic(" + TE_INVENTORY_SLOT_COUNT
|
||||||
|
+ ") and TileInventory (" + tileEntityInventoryBasic.getSizeInventory()+")");
|
||||||
|
}
|
||||||
|
final int TILE_INVENTORY_XPOS = 62;
|
||||||
|
final int TILE_INVENTORY_YPOS_1 = 20;
|
||||||
|
final int TILE_INVENTORY_YPOS_2 = 38;
|
||||||
|
final int TILE_INVENTORY_YPOS_3 = 56;
|
||||||
|
// Add the tile inventory container to the gui
|
||||||
|
/*for (int x = 0; x < TE_INVENTORY_SLOT_COUNT; x++) {
|
||||||
|
int slotNumber = x;
|
||||||
|
addSlotToContainer(new SlotShielded(tileEntityInventoryBasic, slotNumber, TILE_INVENTORY_XPOS + SLOT_X_SPACING * x, TILE_INVENTORY_YPOS_1));
|
||||||
|
}*/
|
||||||
|
for (int x = 0; x < 3; x++) {
|
||||||
|
int slotNumber = x;
|
||||||
|
addSlotToContainer(new SlotShielded(tileEntityInventoryBasic, slotNumber, TILE_INVENTORY_XPOS + SLOT_X_SPACING * x, TILE_INVENTORY_YPOS_1));
|
||||||
|
}
|
||||||
|
for (int x = 3; x < 6; x++) {
|
||||||
|
int slotNumber = x;
|
||||||
|
addSlotToContainer(new SlotShielded(tileEntityInventoryBasic, slotNumber, TILE_INVENTORY_XPOS + SLOT_X_SPACING * (x-3), TILE_INVENTORY_YPOS_2));
|
||||||
|
}
|
||||||
|
for (int x = 6; x < 9; x++) {
|
||||||
|
int slotNumber = x;
|
||||||
|
addSlotToContainer(new SlotShielded(tileEntityInventoryBasic, slotNumber, TILE_INVENTORY_XPOS + SLOT_X_SPACING * (x-6), TILE_INVENTORY_YPOS_3));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Vanilla calls this method every tick to make sure the player is still able to access the inventory, and if not closes the gui
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer player)
|
||||||
|
{
|
||||||
|
return tileEntityInventoryBasic.isUsableByPlayer(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is where you specify what happens when a player shift clicks a slot in the gui
|
||||||
|
// (when you shift click a slot in the TileEntity Inventory, it moves it to the first available position in the hotbar and/or
|
||||||
|
// player inventory. When you you shift-click a hotbar or player inventory item, it moves it to the first available
|
||||||
|
// position in the TileEntity inventory)
|
||||||
|
// At the very least you must override this and return EMPTY_ITEM or the game will crash when the player shift clicks a slot
|
||||||
|
// returns EMPTY_ITEM if the source slot is empty, or if none of the the source slot items could be moved
|
||||||
|
// otherwise, returns a copy of the source stack
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int sourceSlotIndex)
|
||||||
|
{
|
||||||
|
Slot sourceSlot = (Slot)inventorySlots.get(sourceSlotIndex);
|
||||||
|
if (sourceSlot == null || !sourceSlot.getHasStack()) return ItemStack.EMPTY; //EMPTY_ITEM
|
||||||
|
ItemStack sourceStack = sourceSlot.getStack();
|
||||||
|
ItemStack copyOfSourceStack = sourceStack.copy();
|
||||||
|
|
||||||
|
// Check if the slot clicked is one of the vanilla container slots
|
||||||
|
if (sourceSlotIndex >= VANILLA_FIRST_SLOT_INDEX && sourceSlotIndex < VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT) {
|
||||||
|
// This is a vanilla container slot so merge the stack into the tile inventory
|
||||||
|
if (!mergeItemStack(sourceStack, TE_INVENTORY_FIRST_SLOT_INDEX, TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT, false)){
|
||||||
|
return ItemStack.EMPTY; // EMPTY_ITEM
|
||||||
|
}
|
||||||
|
} else if (sourceSlotIndex >= TE_INVENTORY_FIRST_SLOT_INDEX && sourceSlotIndex < TE_INVENTORY_FIRST_SLOT_INDEX + TE_INVENTORY_SLOT_COUNT) {
|
||||||
|
// This is a TE slot so merge the stack into the players inventory
|
||||||
|
if (!mergeItemStack(sourceStack, VANILLA_FIRST_SLOT_INDEX, VANILLA_FIRST_SLOT_INDEX + VANILLA_SLOT_COUNT, false)) {
|
||||||
|
return ItemStack.EMPTY; // EMPTY_ITEM
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.err.print("Invalid slotIndex:" + sourceSlotIndex);
|
||||||
|
return ItemStack.EMPTY; // EMPTY_ITEM
|
||||||
|
}
|
||||||
|
|
||||||
|
// If stack size == 0 (the entire stack was moved) set slot contents to null
|
||||||
|
if (sourceStack.getCount() == 0) { // getStackSize
|
||||||
|
sourceSlot.putStack(ItemStack.EMPTY); // EMPTY_ITEM
|
||||||
|
} else {
|
||||||
|
sourceSlot.onSlotChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSlot.onTake(player, sourceStack); //onPickupFromSlot()
|
||||||
|
return copyOfSourceStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
// pass the close container message to the tileEntityInventory (not strictly needed for this example)
|
||||||
|
// see ContainerChest and TileEntityChest
|
||||||
|
@Override
|
||||||
|
public void onContainerClosed(EntityPlayer playerIn)
|
||||||
|
{
|
||||||
|
super.onContainerClosed(playerIn);
|
||||||
|
this.tileEntityInventoryBasic.closeInventory(playerIn);
|
||||||
|
}
|
||||||
|
}
|
55
src/main/java/trinity/gui/GuiHandlerRegistry.java
Normal file
55
src/main/java/trinity/gui/GuiHandlerRegistry.java
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package trinity.gui;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* This class is used to create the client and server gui elements when a player opens a gui. There can only be one gui handler registered per mod,
|
||||||
|
* so each GUI is given a unique GuiID which is used to create the correct element.
|
||||||
|
* The GuiHandlerRegistry is registered with Forge using
|
||||||
|
* NetworkRegistry.INSTANCE.registerGuiHandler(ReferenceMod.instance, new GuiHandlerRegistry());
|
||||||
|
* Each of the examples, with its own GuiHandler, registers itself with the GuiHandlerRegistry.
|
||||||
|
* When GuiHandlerRegistry receives a call from Forge, it passes it to the appropriate example's GuiHandler.
|
||||||
|
*/
|
||||||
|
public class GuiHandlerRegistry implements IGuiHandler {
|
||||||
|
|
||||||
|
public void registerGuiHandler(IGuiHandler handler, int guiID)
|
||||||
|
{
|
||||||
|
registeredHandlers.put(guiID, handler);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static GuiHandlerRegistry getInstance() {return guiHandlerRegistry;}
|
||||||
|
|
||||||
|
private HashMap<Integer, IGuiHandler> registeredHandlers = new HashMap<Integer, IGuiHandler>();
|
||||||
|
private static GuiHandlerRegistry guiHandlerRegistry = new GuiHandlerRegistry();
|
||||||
|
|
||||||
|
// Gets the server side element for the given gui id- this should return a container
|
||||||
|
@Override
|
||||||
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
IGuiHandler handler = registeredHandlers.get(ID);
|
||||||
|
if (handler != null) {
|
||||||
|
return handler.getServerGuiElement(ID, player, world, x, y, z);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the client side element for the given gui id- this should return a gui
|
||||||
|
@Override
|
||||||
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
IGuiHandler handler = registeredHandlers.get(ID);
|
||||||
|
if (handler != null) {
|
||||||
|
return handler.getClientGuiElement(ID, player, world, x, y, z);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
53
src/main/java/trinity/gui/GuiHandlerTrinity.java
Normal file
53
src/main/java/trinity/gui/GuiHandlerTrinity.java
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
package trinity.gui;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* This class is used to get the client and server gui elements when a player opens a gui. There can only be one registered
|
||||||
|
* IGuiHandler instance handler per mod.
|
||||||
|
*/
|
||||||
|
public class GuiHandlerTrinity implements IGuiHandler {
|
||||||
|
private static final int GUIID_MBE_30 = 30;
|
||||||
|
public static int getGuiID() {return GUIID_MBE_30;}
|
||||||
|
|
||||||
|
// Gets the server side element for the given gui id- this should return a container
|
||||||
|
@Override
|
||||||
|
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
if (ID != getGuiID()) {
|
||||||
|
System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockPos xyz = new BlockPos(x, y, z);
|
||||||
|
TileEntity tileEntity = world.getTileEntity(xyz);
|
||||||
|
if (tileEntity instanceof TileEntityShieldedContainer) {
|
||||||
|
TileEntityShieldedContainer tileEntityInventoryBasic = (TileEntityShieldedContainer) tileEntity;
|
||||||
|
return new ContainerBasic(player.inventory, tileEntityInventoryBasic);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the client side element for the given gui id- this should return a gui
|
||||||
|
@Override
|
||||||
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||||
|
if (ID != getGuiID()) {
|
||||||
|
System.err.println("Invalid ID: expected " + getGuiID() + ", received " + ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockPos xyz = new BlockPos(x, y, z);
|
||||||
|
TileEntity tileEntity = world.getTileEntity(xyz);
|
||||||
|
if (tileEntity instanceof TileEntityShieldedContainer) {
|
||||||
|
TileEntityShieldedContainer tileEntityInventoryBasic = (TileEntityShieldedContainer) tileEntity;
|
||||||
|
return new GuiShieldedContainer(player.inventory, tileEntityInventoryBasic);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
60
src/main/java/trinity/gui/GuiShieldedContainer.java
Normal file
60
src/main/java/trinity/gui/GuiShieldedContainer.java
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
package trinity.gui;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* GuiInventoryBasic is a simple gui that does nothing but draw a background image and a line of text on the screen
|
||||||
|
* everything else is handled by the vanilla container code
|
||||||
|
*/
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class GuiShieldedContainer extends GuiContainer {
|
||||||
|
|
||||||
|
// This is the resource location for the background image for the GUI
|
||||||
|
private static final ResourceLocation texture = new ResourceLocation("trinity", "textures/gui/nuclear_pig.png");
|
||||||
|
private TileEntityShieldedContainer tileEntityInventoryBasic;
|
||||||
|
|
||||||
|
public GuiShieldedContainer(InventoryPlayer invPlayer, TileEntityShieldedContainer tile) {
|
||||||
|
super(new ContainerBasic(invPlayer, tile));
|
||||||
|
tileEntityInventoryBasic = tile;
|
||||||
|
// Set the width and height of the gui. Should match the size of the texture!
|
||||||
|
xSize = 176;
|
||||||
|
ySize = 169;
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the background for the GUI - rendered first
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int x, int y) {
|
||||||
|
// Bind the image texture of our custom container
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
// Draw the image
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the foreground for the GUI - rendered after the slots, but before the dragged items and tooltips
|
||||||
|
// renders relative to the top left corner of the background
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||||
|
final int LABEL_XPOS = 5;
|
||||||
|
final int LABEL_YPOS = 5;
|
||||||
|
fontRenderer.drawString(tileEntityInventoryBasic.getDisplayName().getUnformattedText(), LABEL_XPOS, LABEL_YPOS, Color.darkGray.getRGB());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
||||||
|
this.drawDefaultBackground();
|
||||||
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||||
|
this.renderHoveredToolTip(mouseX, mouseY);
|
||||||
|
}
|
||||||
|
}
|
59
src/main/java/trinity/gui/SlotShielded.java
Normal file
59
src/main/java/trinity/gui/SlotShielded.java
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
package trinity.gui;
|
||||||
|
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import trinity.Trinity;
|
||||||
|
//import trinity.items.RadioactiveSource;
|
||||||
|
import trinity.items.RadioactiveSource2;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* The container is used to link the client side gui to the server side inventory and it is where
|
||||||
|
* you add the slots to your gui. It can also be used to sync server side data with the client but
|
||||||
|
* that will be covered in a later tutorial
|
||||||
|
*/
|
||||||
|
public class SlotShielded extends Slot {
|
||||||
|
|
||||||
|
public SlotShielded(IInventory inventory, int par2, int par3, int par4) {
|
||||||
|
|
||||||
|
super(inventory, par2, par3, par4);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isItemValid(ItemStack itemstack) {
|
||||||
|
|
||||||
|
IRadiationSource stackSource = RadiationHelper.getRadiationSource(itemstack);
|
||||||
|
/*if(Trinity.QMDLoaded)
|
||||||
|
{
|
||||||
|
if(itemstack.getItem()instanceof RadioactiveSource)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if(stackSource !=null || itemstack.getItem()instanceof RadioactiveSource2)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
|
||||||
|
public int getSlotStackLimit() {
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
5
src/main/java/trinity/handler/INuclearEffect.java
Normal file
5
src/main/java/trinity/handler/INuclearEffect.java
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
package trinity.handler;
|
||||||
|
|
||||||
|
public interface INuclearEffect {
|
||||||
|
|
||||||
|
}
|
85
src/main/java/trinity/handler/OredictHandler.java
Normal file
85
src/main/java/trinity/handler/OredictHandler.java
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
package trinity.handler;
|
||||||
|
|
||||||
|
import nc.radiation.RadArmor;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
import net.minecraft.client.util.RecipeItemHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class OredictHandler {
|
||||||
|
|
||||||
|
public static void registerOres(){
|
||||||
|
OreDictionary.registerOre("gemWitherite", new ItemStack(ModItems.gem_witherite, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustWitherite", new ItemStack(ModItems.gem_dust_witherite, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustBarium", new ItemStack(ModItems.barium, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustBarium137", new ItemStack(ModItems.barium, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustBariumNitrate", new ItemStack(ModItems.compound_barium_nitrate, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustBariumOxide", new ItemStack(ModItems.compound_barium_oxide, 1, 0));
|
||||||
|
OreDictionary.registerOre("ingotLithium6Deuteride", new ItemStack(ModItems.compound_lithium_deuteride, 1, 0));
|
||||||
|
OreDictionary.registerOre("ingotGold198", new ItemStack(ModItems.ingot_au_198, 1, 0));
|
||||||
|
OreDictionary.registerOre("dustGold198", new ItemStack(ModItems.dust_au_198, 1, 0));
|
||||||
|
|
||||||
|
/*OreDictionary.registerOre("sphereUranium233", new ItemStack(ModItems.bomb_pit_u233, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereUranium235", new ItemStack(ModItems.bomb_pit_u235, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereNeptunium237", new ItemStack(ModItems.bomb_pit_np237, 1, 0));
|
||||||
|
OreDictionary.registerOre("spherePlutonium239", new ItemStack(ModItems.bomb_pit_pu239, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereAmericium242", new ItemStack(ModItems.bomb_pit_am242, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereCurium247", new ItemStack(ModItems.bomb_pit_cm247, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereBerkelium248", new ItemStack(ModItems.bomb_pit_bk248, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereCalifornium249", new ItemStack(ModItems.bomb_pit_cf249, 1, 0));
|
||||||
|
OreDictionary.registerOre("sphereCalifornium251", new ItemStack(ModItems.bomb_pit_cf251, 1, 0));
|
||||||
|
|
||||||
|
OreDictionary.registerOre("coreUranium233", new ItemStack(ModBlocks.core_u233, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreUranium235", new ItemStack(ModBlocks.core_u235, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreNeptunium237", new ItemStack(ModBlocks.core_np237, 1, 0));
|
||||||
|
OreDictionary.registerOre("corePlutonium239", new ItemStack(ModBlocks.core_pu239, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreAmericium242", new ItemStack(ModBlocks.core_am242, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreCurium247", new ItemStack(ModBlocks.core_cm247, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreBerkelium248", new ItemStack(ModBlocks.core_bk248, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreCalifornium249", new ItemStack(ModBlocks.core_cf249, 1, 0));
|
||||||
|
OreDictionary.registerOre("coreCalifornium251", new ItemStack(ModBlocks.core_cf251, 1, 0));
|
||||||
|
|
||||||
|
OreDictionary.registerOre("saltedCoreUranium233", new ItemStack(ModBlocks.salted_core_u233, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreUranium235", new ItemStack(ModBlocks.salted_core_u235, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreNeptunium237", new ItemStack(ModBlocks.salted_core_np237, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCorePlutonium239", new ItemStack(ModBlocks.salted_core_pu239, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreAmericium242", new ItemStack(ModBlocks.salted_core_am242, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreCurium247", new ItemStack(ModBlocks.salted_core_cm247, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreBerkelium248", new ItemStack(ModBlocks.salted_core_bk248, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreCalifornium249", new ItemStack(ModBlocks.salted_core_cf249, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedCoreCalifornium251", new ItemStack(ModBlocks.salted_core_cf251, 1, 0));
|
||||||
|
|
||||||
|
OreDictionary.registerOre("bombUranium233", new ItemStack(ModBlocks.bomb_u233, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombUranium235", new ItemStack(ModBlocks.bomb_u235, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombNeptunium237", new ItemStack(ModBlocks.bomb_np237, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombPlutonium239", new ItemStack(ModBlocks.bomb_pu239, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombAmericium242", new ItemStack(ModBlocks.bomb_am242, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombCurium247", new ItemStack(ModBlocks.bomb_cm247, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombBerkelium248", new ItemStack(ModBlocks.bomb_bk248, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombCalifornium249", new ItemStack(ModBlocks.bomb_cf249, 1, 0));
|
||||||
|
OreDictionary.registerOre("bombCalifornium251", new ItemStack(ModBlocks.bomb_cf251, 1, 0));
|
||||||
|
|
||||||
|
OreDictionary.registerOre("saltedBombUranium233", new ItemStack(ModBlocks.salted_bomb_u233, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombUranium235", new ItemStack(ModBlocks.salted_bomb_u235, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombNeptunium237", new ItemStack(ModBlocks.salted_bomb_np237, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombPlutonium239", new ItemStack(ModBlocks.salted_bomb_pu239, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombAmericium242", new ItemStack(ModBlocks.salted_bomb_am242, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombCurium247", new ItemStack(ModBlocks.salted_bomb_cm247, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombBerkelium248", new ItemStack(ModBlocks.salted_bomb_bk248, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombCalifornium249", new ItemStack(ModBlocks.salted_bomb_cf249, 1, 0));
|
||||||
|
OreDictionary.registerOre("saltedBombCalifornium251", new ItemStack(ModBlocks.salted_bomb_cf251, 1, 0));*/
|
||||||
|
|
||||||
|
OreDictionary.registerOre("blockRadioactiveEarth", new ItemStack(ModBlocks.radioactive_earth, 1, 0));
|
||||||
|
OreDictionary.registerOre("blockRadioactiveSand", new ItemStack(ModBlocks.salted_sand, 1, 0));
|
||||||
|
OreDictionary.registerOre("blockHighlyRadioactiveEarth", new ItemStack(ModBlocks.radioactive_earth2, 1, 0));
|
||||||
|
OreDictionary.registerOre("blockHighlyRadioactiveSand", new ItemStack(ModBlocks.salted_sand2, 1, 0));
|
||||||
|
OreDictionary.registerOre("oreTrinitite", new ItemStack(ModBlocks.trinitite, 1, 0));
|
||||||
|
OreDictionary.registerOre("blockTrinitite", new ItemStack(ModBlocks.solid_trinitite, 1, 0));
|
||||||
|
OreDictionary.registerOre("gemTrinitite", new ItemStack(ModItems.trinitite, 1, 0));
|
||||||
|
|
||||||
|
//OreDictionary.registerOre("dirtyBomb", new ItemStack(ModBlocks.dirty_bomb, 1, 0));
|
||||||
|
//OreDictionary.registerOre("thermonuclearCore", new ItemStack(ModBlocks.thermonuclear_core_pu239, 1, 0));
|
||||||
|
}
|
||||||
|
}
|
255
src/main/java/trinity/handler/Vec3.java
Normal file
255
src/main/java/trinity/handler/Vec3.java
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
package trinity.handler;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
|
public class Vec3
|
||||||
|
{
|
||||||
|
/** X coordinate of Vec3D */
|
||||||
|
public double xCoord;
|
||||||
|
/** Y coordinate of Vec3D */
|
||||||
|
public double yCoord;
|
||||||
|
/** Z coordinate of Vec3D */
|
||||||
|
public double zCoord;
|
||||||
|
private static final String __OBFID = "CL_00000612";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other static
|
||||||
|
* method which creates and places it in the list.
|
||||||
|
*/
|
||||||
|
public static Vec3 createVectorHelper(double p_72443_0_, double p_72443_2_, double p_72443_4_)
|
||||||
|
{
|
||||||
|
return new Vec3(p_72443_0_, p_72443_2_, p_72443_4_);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Vec3(double p_i1108_1_, double p_i1108_3_, double p_i1108_5_)
|
||||||
|
{
|
||||||
|
if (p_i1108_1_ == -0.0D)
|
||||||
|
{
|
||||||
|
p_i1108_1_ = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_i1108_3_ == -0.0D)
|
||||||
|
{
|
||||||
|
p_i1108_3_ = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_i1108_5_ == -0.0D)
|
||||||
|
{
|
||||||
|
p_i1108_5_ = 0.0D;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.xCoord = p_i1108_1_;
|
||||||
|
this.yCoord = p_i1108_3_;
|
||||||
|
this.zCoord = p_i1108_5_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the x,y,z components of the vector as specified.
|
||||||
|
*/
|
||||||
|
protected Vec3 setComponents(double p_72439_1_, double p_72439_3_, double p_72439_5_)
|
||||||
|
{
|
||||||
|
this.xCoord = p_72439_1_;
|
||||||
|
this.yCoord = p_72439_3_;
|
||||||
|
this.zCoord = p_72439_5_;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new vector with the result of the specified vector minus this.
|
||||||
|
*/
|
||||||
|
public Vec3 subtract(Vec3 p_72444_1_)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other
|
||||||
|
* static method which creates and places it in the list.
|
||||||
|
*/
|
||||||
|
return createVectorHelper(p_72444_1_.xCoord - this.xCoord, p_72444_1_.yCoord - this.yCoord, p_72444_1_.zCoord - this.zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalizes the vector to a length of 1 (except if it is the zero vector)
|
||||||
|
*/
|
||||||
|
public Vec3 normalize()
|
||||||
|
{
|
||||||
|
double d0 = (double)MathHelper.sqrt(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord);
|
||||||
|
return d0 < 1.0E-4D ? createVectorHelper(0.0D, 0.0D, 0.0D) : createVectorHelper(this.xCoord / d0, this.yCoord / d0, this.zCoord / d0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public double dotProduct(Vec3 p_72430_1_)
|
||||||
|
{
|
||||||
|
return this.xCoord * p_72430_1_.xCoord + this.yCoord * p_72430_1_.yCoord + this.zCoord * p_72430_1_.zCoord;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new vector with the result of this vector x the specified vector.
|
||||||
|
*/
|
||||||
|
public Vec3 crossProduct(Vec3 p_72431_1_)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other
|
||||||
|
* static method which creates and places it in the list.
|
||||||
|
*/
|
||||||
|
return createVectorHelper(this.yCoord * p_72431_1_.zCoord - this.zCoord * p_72431_1_.yCoord, this.zCoord * p_72431_1_.xCoord - this.xCoord * p_72431_1_.zCoord, this.xCoord * p_72431_1_.yCoord - this.yCoord * p_72431_1_.xCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the specified x,y,z vector components to this vector and returns the resulting vector. Does not change this
|
||||||
|
* vector.
|
||||||
|
*/
|
||||||
|
public Vec3 addVector(double p_72441_1_, double p_72441_3_, double p_72441_5_)
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Static method for creating a new Vec3D given the three x,y,z values. This is only called from the other
|
||||||
|
* static method which creates and places it in the list.
|
||||||
|
*/
|
||||||
|
return createVectorHelper(this.xCoord + p_72441_1_, this.yCoord + p_72441_3_, this.zCoord + p_72441_5_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Euclidean distance between this and the specified vector, returned as double.
|
||||||
|
*/
|
||||||
|
public double distanceTo(Vec3 p_72438_1_)
|
||||||
|
{
|
||||||
|
double d0 = p_72438_1_.xCoord - this.xCoord;
|
||||||
|
double d1 = p_72438_1_.yCoord - this.yCoord;
|
||||||
|
double d2 = p_72438_1_.zCoord - this.zCoord;
|
||||||
|
return (double)MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The square of the Euclidean distance between this and the specified vector.
|
||||||
|
*/
|
||||||
|
public double squareDistanceTo(Vec3 p_72436_1_)
|
||||||
|
{
|
||||||
|
double d0 = p_72436_1_.xCoord - this.xCoord;
|
||||||
|
double d1 = p_72436_1_.yCoord - this.yCoord;
|
||||||
|
double d2 = p_72436_1_.zCoord - this.zCoord;
|
||||||
|
return d0 * d0 + d1 * d1 + d2 * d2;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The square of the Euclidean distance between this and the vector of x,y,z components passed in.
|
||||||
|
*/
|
||||||
|
public double squareDistanceTo(double p_72445_1_, double p_72445_3_, double p_72445_5_)
|
||||||
|
{
|
||||||
|
double d3 = p_72445_1_ - this.xCoord;
|
||||||
|
double d4 = p_72445_3_ - this.yCoord;
|
||||||
|
double d5 = p_72445_5_ - this.zCoord;
|
||||||
|
return d3 * d3 + d4 * d4 + d5 * d5;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the length of the vector.
|
||||||
|
*/
|
||||||
|
public double lengthVector()
|
||||||
|
{
|
||||||
|
return (double)MathHelper.sqrt(this.xCoord * this.xCoord + this.yCoord * this.yCoord + this.zCoord * this.zCoord);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new vector with x value equal to the second parameter, along the line between this vector and the
|
||||||
|
* passed in vector, or null if not possible.
|
||||||
|
*/
|
||||||
|
public Vec3 getIntermediateWithXValue(Vec3 p_72429_1_, double p_72429_2_)
|
||||||
|
{
|
||||||
|
double d1 = p_72429_1_.xCoord - this.xCoord;
|
||||||
|
double d2 = p_72429_1_.yCoord - this.yCoord;
|
||||||
|
double d3 = p_72429_1_.zCoord - this.zCoord;
|
||||||
|
|
||||||
|
if (d1 * d1 < 1.0000000116860974E-7D)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double d4 = (p_72429_2_ - this.xCoord) / d1;
|
||||||
|
return d4 >= 0.0D && d4 <= 1.0D ? createVectorHelper(this.xCoord + d1 * d4, this.yCoord + d2 * d4, this.zCoord + d3 * d4) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new vector with y value equal to the second parameter, along the line between this vector and the
|
||||||
|
* passed in vector, or null if not possible.
|
||||||
|
*/
|
||||||
|
public Vec3 getIntermediateWithYValue(Vec3 p_72435_1_, double p_72435_2_)
|
||||||
|
{
|
||||||
|
double d1 = p_72435_1_.xCoord - this.xCoord;
|
||||||
|
double d2 = p_72435_1_.yCoord - this.yCoord;
|
||||||
|
double d3 = p_72435_1_.zCoord - this.zCoord;
|
||||||
|
|
||||||
|
if (d2 * d2 < 1.0000000116860974E-7D)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double d4 = (p_72435_2_ - this.yCoord) / d2;
|
||||||
|
return d4 >= 0.0D && d4 <= 1.0D ? createVectorHelper(this.xCoord + d1 * d4, this.yCoord + d2 * d4, this.zCoord + d3 * d4) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a new vector with z value equal to the second parameter, along the line between this vector and the
|
||||||
|
* passed in vector, or null if not possible.
|
||||||
|
*/
|
||||||
|
public Vec3 getIntermediateWithZValue(Vec3 p_72434_1_, double p_72434_2_)
|
||||||
|
{
|
||||||
|
double d1 = p_72434_1_.xCoord - this.xCoord;
|
||||||
|
double d2 = p_72434_1_.yCoord - this.yCoord;
|
||||||
|
double d3 = p_72434_1_.zCoord - this.zCoord;
|
||||||
|
|
||||||
|
if (d3 * d3 < 1.0000000116860974E-7D)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double d4 = (p_72434_2_ - this.zCoord) / d3;
|
||||||
|
return d4 >= 0.0D && d4 <= 1.0D ? createVectorHelper(this.xCoord + d1 * d4, this.yCoord + d2 * d4, this.zCoord + d3 * d4) : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return "(" + this.xCoord + ", " + this.yCoord + ", " + this.zCoord + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates the vector around the x axis by the specified angle.
|
||||||
|
*/
|
||||||
|
public void rotateAroundX(float p_72440_1_)
|
||||||
|
{
|
||||||
|
float f1 = MathHelper.cos(p_72440_1_);
|
||||||
|
float f2 = MathHelper.sin(p_72440_1_);
|
||||||
|
double d0 = this.xCoord;
|
||||||
|
double d1 = this.yCoord * (double)f1 + this.zCoord * (double)f2;
|
||||||
|
double d2 = this.zCoord * (double)f1 - this.yCoord * (double)f2;
|
||||||
|
this.setComponents(d0, d1, d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates the vector around the y axis by the specified angle.
|
||||||
|
*/
|
||||||
|
public void rotateAroundY(float p_72442_1_)
|
||||||
|
{
|
||||||
|
float f1 = MathHelper.cos(p_72442_1_);
|
||||||
|
float f2 = MathHelper.sin(p_72442_1_);
|
||||||
|
double d0 = this.xCoord * (double)f1 + this.zCoord * (double)f2;
|
||||||
|
double d1 = this.yCoord;
|
||||||
|
double d2 = this.zCoord * (double)f1 - this.xCoord * (double)f2;
|
||||||
|
this.setComponents(d0, d1, d2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rotates the vector around the z axis by the specified angle.
|
||||||
|
*/
|
||||||
|
public void rotateAroundZ(float p_72446_1_)
|
||||||
|
{
|
||||||
|
float f1 = MathHelper.cos(p_72446_1_);
|
||||||
|
float f2 = MathHelper.sin(p_72446_1_);
|
||||||
|
double d0 = this.xCoord * (double)f1 + this.yCoord * (double)f2;
|
||||||
|
double d1 = this.yCoord * (double)f1 - this.xCoord * (double)f2;
|
||||||
|
double d2 = this.zCoord;
|
||||||
|
this.setComponents(d0, d1, d2);
|
||||||
|
}
|
||||||
|
}
|
478
src/main/java/trinity/init/ModBlocks.java
Normal file
478
src/main/java/trinity/init/ModBlocks.java
Normal file
|
@ -0,0 +1,478 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.enumm.FluidType;
|
||||||
|
import nc.init.NCFissionFluids;
|
||||||
|
import nc.init.NCFluids;
|
||||||
|
import trinity.blocks.AntimatterBomb;
|
||||||
|
import trinity.blocks.BasicBlock;
|
||||||
|
import trinity.blocks.DirtyBomb;
|
||||||
|
import trinity.blocks.ExoticBomb;
|
||||||
|
import trinity.blocks.ExplosiveCharge;
|
||||||
|
import trinity.blocks.FallingRadioactiveBlock;
|
||||||
|
import trinity.blocks.NuclearCore;
|
||||||
|
import trinity.blocks.RadioactiveBlock;
|
||||||
|
import trinity.blocks.ShieldedContainer;
|
||||||
|
import trinity.blocks.ThermonuclearCore;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.fluid.TrinityFluids;
|
||||||
|
import trinity.items.ShieldedContainerItem;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.SoundType;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid=Reference.MODID)
|
||||||
|
public class ModBlocks {
|
||||||
|
|
||||||
|
public static Block core_u233;
|
||||||
|
public static Block core_u235;
|
||||||
|
public static Block core_np237;
|
||||||
|
public static Block core_pu239;
|
||||||
|
public static Block core_am242;
|
||||||
|
public static Block core_cm247;
|
||||||
|
public static Block core_bk248;
|
||||||
|
public static Block core_cf249;
|
||||||
|
public static Block core_cf251;
|
||||||
|
public static Block core_custom_1;
|
||||||
|
public static Block core_custom_2;
|
||||||
|
public static Block core_custom_3;
|
||||||
|
public static Block core_custom_4;
|
||||||
|
|
||||||
|
public static Block salted_core_u233;
|
||||||
|
public static Block salted_core_u235;
|
||||||
|
public static Block salted_core_np237;
|
||||||
|
public static Block salted_core_pu239;
|
||||||
|
public static Block salted_core_am242;
|
||||||
|
public static Block salted_core_cm247;
|
||||||
|
public static Block salted_core_bk248;
|
||||||
|
public static Block salted_core_cf249;
|
||||||
|
public static Block salted_core_cf251;
|
||||||
|
public static Block salted_core_custom_1;
|
||||||
|
public static Block salted_core_custom_2;
|
||||||
|
public static Block salted_core_custom_3;
|
||||||
|
public static Block salted_core_custom_4;
|
||||||
|
|
||||||
|
// public static Block thermonuclear_core_u233;
|
||||||
|
// public static Block thermonuclear_core_u235;
|
||||||
|
// public static Block thermonuclear_core_np237;
|
||||||
|
public static Block thermonuclear_core_pu239;
|
||||||
|
// public static Block thermonuclear_core_am242;
|
||||||
|
// public static Block thermonuclear_core_cm247;
|
||||||
|
// public static Block thermonuclear_core_bk248;
|
||||||
|
// public static Block thermonuclear_core_cf249;
|
||||||
|
// public static Block thermonuclear_core_cf251;
|
||||||
|
|
||||||
|
public static Block bomb_u233;
|
||||||
|
public static Block bomb_u235;
|
||||||
|
public static Block bomb_np237;
|
||||||
|
public static Block bomb_pu239;
|
||||||
|
public static Block bomb_am242;
|
||||||
|
public static Block bomb_cm247;
|
||||||
|
public static Block bomb_bk248;
|
||||||
|
public static Block bomb_cf249;
|
||||||
|
public static Block bomb_cf251;
|
||||||
|
public static Block bomb_custom1;
|
||||||
|
public static Block bomb_custom2;
|
||||||
|
public static Block bomb_custom3;
|
||||||
|
public static Block bomb_custom4;
|
||||||
|
public static Block bomb_antimatter;
|
||||||
|
//public static Block bomb_wormhole;
|
||||||
|
|
||||||
|
public static Block salted_bomb_u233;
|
||||||
|
public static Block salted_bomb_u235;
|
||||||
|
public static Block salted_bomb_np237;
|
||||||
|
public static Block salted_bomb_pu239;
|
||||||
|
public static Block salted_bomb_am242;
|
||||||
|
public static Block salted_bomb_cm247;
|
||||||
|
public static Block salted_bomb_bk248;
|
||||||
|
public static Block salted_bomb_cf249;
|
||||||
|
public static Block salted_bomb_cf251;
|
||||||
|
public static Block salted_bomb_custom1;
|
||||||
|
public static Block salted_bomb_custom2;
|
||||||
|
public static Block salted_bomb_custom3;
|
||||||
|
public static Block salted_bomb_custom4;
|
||||||
|
|
||||||
|
public static Block dirty_bomb;
|
||||||
|
public static Block fusion_bomb;
|
||||||
|
public static Block empty_fusion_bomb;
|
||||||
|
public static Block gold_bomb;
|
||||||
|
|
||||||
|
//public static Block type1_fallout;
|
||||||
|
//public static Block type2_fallout;
|
||||||
|
public static Block radioactive_earth;
|
||||||
|
public static Block radioactive_earth2;
|
||||||
|
public static Block trinitite;
|
||||||
|
public static Block solid_trinitite;
|
||||||
|
public static Block salted_sand;
|
||||||
|
public static Block salted_sand2;
|
||||||
|
//public static Block red_trinitite;
|
||||||
|
public static Block baratol;
|
||||||
|
public static Block compression_charge;
|
||||||
|
public static Block light_container;
|
||||||
|
public static Block medium_container;
|
||||||
|
public static Block heavy_container;
|
||||||
|
|
||||||
|
public static void init() {
|
||||||
|
light_container = new ShieldedContainer("light_container", Material.IRON, NCConfig.radiation_shielding_level[0]);
|
||||||
|
medium_container = new ShieldedContainer("medium_container", Material.IRON, NCConfig.radiation_shielding_level[1]);
|
||||||
|
heavy_container = new ShieldedContainer("heavy_container", Material.IRON, NCConfig.radiation_shielding_level[2]);
|
||||||
|
|
||||||
|
salted_core_u233 = new BasicBlock("salted_core_u233", Material.IRON);
|
||||||
|
salted_core_u235 = new BasicBlock("salted_core_u235", Material.IRON);
|
||||||
|
salted_core_np237 = new BasicBlock("salted_core_np237", Material.IRON);
|
||||||
|
salted_core_pu239 = new BasicBlock("salted_core_pu239", Material.IRON);
|
||||||
|
salted_core_am242 = new BasicBlock("salted_core_am242", Material.IRON);
|
||||||
|
salted_core_cm247 = new BasicBlock("salted_core_cm247", Material.IRON);
|
||||||
|
salted_core_bk248 = new BasicBlock("salted_core_bk248", Material.IRON);
|
||||||
|
salted_core_cf249 = new BasicBlock("salted_core_cf249", Material.IRON);
|
||||||
|
salted_core_cf251 = new BasicBlock("salted_core_cf251", Material.IRON);
|
||||||
|
salted_core_custom_1 = new BasicBlock("salted_core_custom_1", Material.IRON);
|
||||||
|
salted_core_custom_2 = new BasicBlock("salted_core_custom_2", Material.IRON);
|
||||||
|
salted_core_custom_3 = new BasicBlock("salted_core_custom_3", Material.IRON);
|
||||||
|
salted_core_custom_4 = new BasicBlock("salted_core_custom_4", Material.IRON);
|
||||||
|
|
||||||
|
core_u233 = new BasicBlock("core_u233", Material.IRON);
|
||||||
|
core_u235 = new BasicBlock("core_u235", Material.IRON);
|
||||||
|
core_np237 = new BasicBlock("core_np237", Material.IRON);
|
||||||
|
core_pu239 = new BasicBlock("core_pu239", Material.IRON);
|
||||||
|
core_am242 = new BasicBlock("core_am242", Material.IRON);
|
||||||
|
core_cm247 = new BasicBlock("core_cm247", Material.IRON);
|
||||||
|
core_bk248 = new BasicBlock("core_bk248", Material.IRON);
|
||||||
|
core_cf249 = new BasicBlock("core_cf249", Material.IRON);
|
||||||
|
core_cf251 = new BasicBlock("core_cf251", Material.IRON);
|
||||||
|
core_custom_1 = new BasicBlock("core_custom_1", Material.IRON);
|
||||||
|
core_custom_2 = new BasicBlock("core_custom_2", Material.IRON);
|
||||||
|
core_custom_3 = new BasicBlock("core_custom_3", Material.IRON);
|
||||||
|
core_custom_4 = new BasicBlock("core_custom_4", Material.IRON);
|
||||||
|
|
||||||
|
thermonuclear_core_pu239 = new ThermonuclearCore("thermonuclear_core_pu239", Material.IRON);
|
||||||
|
|
||||||
|
compression_charge = new ExplosiveCharge("compression_charge", Material.TNT);
|
||||||
|
baratol = new ExplosiveCharge("solid_baratol", Material.TNT);
|
||||||
|
|
||||||
|
//blockTNT = new BlockFluidExplosive(ModFluids.tnt);
|
||||||
|
//blockBaratol = new BlockFluidExplosive(ModFluids.baratol);
|
||||||
|
|
||||||
|
bomb_u233 = new NuclearCore("bomb_u233", Material.IRON, TrinityConfig.u233_radius, false);
|
||||||
|
bomb_u235 = new NuclearCore("bomb_u235", Material.IRON, TrinityConfig.u235_radius, false);
|
||||||
|
bomb_np237 = new NuclearCore("bomb_np237", Material.IRON, TrinityConfig.np237_radius, false);
|
||||||
|
bomb_pu239 = new NuclearCore("bomb_pu239", Material.IRON, TrinityConfig.pu239_radius, false);
|
||||||
|
bomb_am242 = new NuclearCore("bomb_am242", Material.IRON, TrinityConfig.am242_radius, false);
|
||||||
|
bomb_cm247 = new NuclearCore("bomb_cm247", Material.IRON, TrinityConfig.cm247_radius, false);
|
||||||
|
bomb_bk248 = new NuclearCore("bomb_bk248", Material.IRON, TrinityConfig.bk248_radius, false);
|
||||||
|
bomb_cf249 = new NuclearCore("bomb_cf249", Material.IRON, TrinityConfig.cf249_radius, false);
|
||||||
|
bomb_cf251 = new NuclearCore("bomb_cf251", Material.IRON, TrinityConfig.cf251_radius, false);
|
||||||
|
bomb_custom1 = new NuclearCore("bomb_custom_1", Material.IRON, TrinityConfig.custom_1_radius, false);
|
||||||
|
bomb_custom2 = new NuclearCore("bomb_custom_2", Material.IRON, TrinityConfig.custom_2_radius, false);
|
||||||
|
bomb_custom3 = new NuclearCore("bomb_custom_3", Material.IRON, TrinityConfig.custom_3_radius, false);
|
||||||
|
bomb_custom4 = new NuclearCore("bomb_custom_4", Material.IRON, TrinityConfig.custom_4_radius, false);
|
||||||
|
bomb_antimatter = new ExoticBomb("bomb_antimatter", Material.IRON, TrinityConfig.antimatter_radius);
|
||||||
|
//bomb_wormhole = new ExoticBomb("bomb_exotic", Material.IRON, TrinityConfig.antimatter_radius);
|
||||||
|
|
||||||
|
salted_bomb_u233 = new NuclearCore("salted_bomb_u233", Material.IRON, TrinityConfig.u233_radius, true);
|
||||||
|
salted_bomb_u235 = new NuclearCore("salted_bomb_u235", Material.IRON, TrinityConfig.u235_radius, true);
|
||||||
|
salted_bomb_np237 = new NuclearCore("salted_bomb_np237", Material.IRON, TrinityConfig.np237_radius, true);
|
||||||
|
salted_bomb_pu239 = new NuclearCore("salted_bomb_pu239", Material.IRON, TrinityConfig.pu239_radius, true);
|
||||||
|
salted_bomb_am242 = new NuclearCore("salted_bomb_am242", Material.IRON, TrinityConfig.am242_radius, true);
|
||||||
|
salted_bomb_cm247 = new NuclearCore("salted_bomb_cm247", Material.IRON, TrinityConfig.cm247_radius, true);
|
||||||
|
salted_bomb_bk248 = new NuclearCore("salted_bomb_bk248", Material.IRON, TrinityConfig.bk248_radius, true);
|
||||||
|
salted_bomb_cf249 = new NuclearCore("salted_bomb_cf249", Material.IRON, TrinityConfig.cf249_radius, true);
|
||||||
|
salted_bomb_cf251 = new NuclearCore("salted_bomb_cf251", Material.IRON, TrinityConfig.cf251_radius, true);
|
||||||
|
salted_bomb_custom1 = new NuclearCore("salted_bomb_custom_1", Material.IRON, TrinityConfig.custom_1_radius, false);
|
||||||
|
salted_bomb_custom2 = new NuclearCore("salted_bomb_custom_2", Material.IRON, TrinityConfig.custom_2_radius, false);
|
||||||
|
salted_bomb_custom3 = new NuclearCore("salted_bomb_custom_3", Material.IRON, TrinityConfig.custom_3_radius, false);
|
||||||
|
salted_bomb_custom4 = new NuclearCore("salted_bomb_custom_4", Material.IRON, TrinityConfig.custom_4_radius, false);
|
||||||
|
|
||||||
|
trinitite = new BasicBlock("trinitite", Material.ROCK);
|
||||||
|
solid_trinitite = new BasicBlock("solid_trinitite", Material.GLASS);
|
||||||
|
radioactive_earth = new RadioactiveBlock("radioactive_earth", Material.ROCK);
|
||||||
|
radioactive_earth2 = new RadioactiveBlock("radioactive_earth2", Material.ROCK);
|
||||||
|
salted_sand = new FallingRadioactiveBlock("salted_sand", Material.SAND);
|
||||||
|
salted_sand2 = new FallingRadioactiveBlock("salted_sand2", Material.SAND);
|
||||||
|
|
||||||
|
dirty_bomb = new DirtyBomb("dirty_bomb", Material.TNT, SoundType.PLANT);
|
||||||
|
gold_bomb = new DirtyBomb("gold_bomb", Material.TNT, SoundType.PLANT);
|
||||||
|
fusion_bomb = new DirtyBomb("fusion_bomb", Material.IRON, SoundType.METAL);
|
||||||
|
empty_fusion_bomb = new BasicBlock("empty_fusion_bomb", Material.IRON);
|
||||||
|
|
||||||
|
//Creative Tab
|
||||||
|
core_u233.setCreativeTab(null);
|
||||||
|
core_u235.setCreativeTab(null);
|
||||||
|
core_np237.setCreativeTab(null);
|
||||||
|
core_pu239.setCreativeTab(null);
|
||||||
|
core_am242.setCreativeTab(null);
|
||||||
|
core_cm247.setCreativeTab(null);
|
||||||
|
core_bk248.setCreativeTab(null);
|
||||||
|
core_cf249.setCreativeTab(null);
|
||||||
|
core_cf251.setCreativeTab(null);
|
||||||
|
core_custom_1.setCreativeTab(null);
|
||||||
|
core_custom_2.setCreativeTab(null);
|
||||||
|
core_custom_3.setCreativeTab(null);
|
||||||
|
core_custom_4.setCreativeTab(null);
|
||||||
|
|
||||||
|
salted_core_u233.setCreativeTab(null);
|
||||||
|
salted_core_u235.setCreativeTab(null);
|
||||||
|
salted_core_np237.setCreativeTab(null);
|
||||||
|
salted_core_pu239.setCreativeTab(null);
|
||||||
|
salted_core_am242.setCreativeTab(null);
|
||||||
|
salted_core_cm247.setCreativeTab(null);
|
||||||
|
salted_core_bk248.setCreativeTab(null);
|
||||||
|
salted_core_cf249.setCreativeTab(null);
|
||||||
|
salted_core_cf251.setCreativeTab(null);
|
||||||
|
salted_core_custom_1.setCreativeTab(null);
|
||||||
|
salted_core_custom_2.setCreativeTab(null);
|
||||||
|
salted_core_custom_3.setCreativeTab(null);
|
||||||
|
salted_core_custom_4.setCreativeTab(null);
|
||||||
|
|
||||||
|
thermonuclear_core_pu239.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
compression_charge.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
baratol.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
dirty_bomb.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
gold_bomb.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
fusion_bomb.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
empty_fusion_bomb.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
light_container.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
medium_container.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
heavy_container.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
bomb_u233.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_u235.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_np237.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pu239.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_am242.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_cm247.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_bk248.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_cf249.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_cf251.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
if(TrinityConfig.custom_nukes)
|
||||||
|
{
|
||||||
|
bomb_custom1.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_custom2.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_custom3.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_custom4.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
salted_bomb_custom1.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_custom2.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_custom3.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_custom4.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
}
|
||||||
|
bomb_antimatter.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
salted_bomb_u233.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_u235.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_np237.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_pu239.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_am242.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_cm247.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_bk248.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_cf249.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_bomb_cf251.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
trinitite.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
solid_trinitite.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
salted_sand.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
radioactive_earth.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
radioactive_earth2.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
|
||||||
|
registerBlock2(light_container);
|
||||||
|
registerBlock2(medium_container);
|
||||||
|
registerBlock2(heavy_container);
|
||||||
|
registerBlock(compression_charge);
|
||||||
|
registerBlock(baratol);
|
||||||
|
registerBlock(dirty_bomb);
|
||||||
|
registerBlock(fusion_bomb);
|
||||||
|
registerBlock(empty_fusion_bomb);
|
||||||
|
registerBlock(gold_bomb);
|
||||||
|
registerBlock(core_u233);
|
||||||
|
registerBlock(core_u235);
|
||||||
|
registerBlock(core_np237);
|
||||||
|
registerBlock(core_pu239);
|
||||||
|
registerBlock(core_am242);
|
||||||
|
registerBlock(core_cm247);
|
||||||
|
registerBlock(core_bk248);
|
||||||
|
registerBlock(core_cf249);
|
||||||
|
registerBlock(core_cf251);
|
||||||
|
|
||||||
|
registerBlock(salted_core_u233);
|
||||||
|
registerBlock(salted_core_u235);
|
||||||
|
registerBlock(salted_core_np237);
|
||||||
|
registerBlock(salted_core_pu239);
|
||||||
|
registerBlock(salted_core_am242);
|
||||||
|
registerBlock(salted_core_cm247);
|
||||||
|
registerBlock(salted_core_bk248);
|
||||||
|
registerBlock(salted_core_cf249);
|
||||||
|
registerBlock(salted_core_cf251);
|
||||||
|
|
||||||
|
registerBlock(thermonuclear_core_pu239);
|
||||||
|
|
||||||
|
registerBlock(bomb_u233);
|
||||||
|
registerBlock(bomb_u235);
|
||||||
|
registerBlock(bomb_np237);
|
||||||
|
registerBlock(bomb_pu239);
|
||||||
|
registerBlock(bomb_am242);
|
||||||
|
registerBlock(bomb_cm247);
|
||||||
|
registerBlock(bomb_bk248);
|
||||||
|
registerBlock(bomb_cf249);
|
||||||
|
registerBlock(bomb_cf251);
|
||||||
|
|
||||||
|
registerBlock(salted_bomb_u233);
|
||||||
|
registerBlock(salted_bomb_u235);
|
||||||
|
registerBlock(salted_bomb_np237);
|
||||||
|
registerBlock(salted_bomb_pu239);
|
||||||
|
registerBlock(salted_bomb_am242);
|
||||||
|
registerBlock(salted_bomb_cm247);
|
||||||
|
registerBlock(salted_bomb_bk248);
|
||||||
|
registerBlock(salted_bomb_cf249);
|
||||||
|
registerBlock(salted_bomb_cf251);
|
||||||
|
|
||||||
|
registerBlock(bomb_antimatter);
|
||||||
|
|
||||||
|
registerBlock(salted_sand);
|
||||||
|
registerBlock(salted_sand2);
|
||||||
|
registerBlock(radioactive_earth);
|
||||||
|
registerBlock(radioactive_earth2);
|
||||||
|
registerBlock(trinitite);
|
||||||
|
registerBlock(solid_trinitite);
|
||||||
|
|
||||||
|
if(TrinityConfig.custom_nukes)
|
||||||
|
{
|
||||||
|
registerBlock(core_custom_1);
|
||||||
|
registerBlock(core_custom_2);
|
||||||
|
registerBlock(core_custom_3);
|
||||||
|
registerBlock(core_custom_4);
|
||||||
|
|
||||||
|
registerBlock(salted_core_custom_1);
|
||||||
|
registerBlock(salted_core_custom_2);
|
||||||
|
registerBlock(salted_core_custom_3);
|
||||||
|
registerBlock(salted_core_custom_4);
|
||||||
|
|
||||||
|
registerBlock(bomb_custom1);
|
||||||
|
registerBlock(bomb_custom2);
|
||||||
|
registerBlock(bomb_custom3);
|
||||||
|
registerBlock(bomb_custom4);
|
||||||
|
|
||||||
|
registerBlock(salted_bomb_custom1);
|
||||||
|
registerBlock(salted_bomb_custom2);
|
||||||
|
registerBlock(salted_bomb_custom3);
|
||||||
|
registerBlock(salted_bomb_custom4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRenders() {
|
||||||
|
registerRender(light_container);
|
||||||
|
registerRender(medium_container);
|
||||||
|
registerRender(heavy_container);
|
||||||
|
registerRender(compression_charge);
|
||||||
|
registerRender(baratol);
|
||||||
|
registerRender(dirty_bomb);
|
||||||
|
registerRender(fusion_bomb);
|
||||||
|
registerRender(empty_fusion_bomb);
|
||||||
|
registerRender(gold_bomb);
|
||||||
|
registerRender(core_u233);
|
||||||
|
registerRender(core_u235);
|
||||||
|
registerRender(core_np237);
|
||||||
|
registerRender(core_pu239);
|
||||||
|
registerRender(core_am242);
|
||||||
|
registerRender(core_cm247);
|
||||||
|
registerRender(core_bk248);
|
||||||
|
registerRender(core_cf249);
|
||||||
|
registerRender(core_cf251);
|
||||||
|
|
||||||
|
registerRender(salted_core_u233);
|
||||||
|
registerRender(salted_core_u235);
|
||||||
|
registerRender(salted_core_np237);
|
||||||
|
registerRender(salted_core_pu239);
|
||||||
|
registerRender(salted_core_am242);
|
||||||
|
registerRender(salted_core_cm247);
|
||||||
|
registerRender(salted_core_bk248);
|
||||||
|
registerRender(salted_core_cf249);
|
||||||
|
registerRender(salted_core_cf251);
|
||||||
|
|
||||||
|
registerRender(thermonuclear_core_pu239);
|
||||||
|
|
||||||
|
registerRender(bomb_u233);
|
||||||
|
registerRender(bomb_u235);
|
||||||
|
registerRender(bomb_np237);
|
||||||
|
registerRender(bomb_pu239);
|
||||||
|
registerRender(bomb_am242);
|
||||||
|
registerRender(bomb_cm247);
|
||||||
|
registerRender(bomb_bk248);
|
||||||
|
registerRender(bomb_cf249);
|
||||||
|
registerRender(bomb_cf251);
|
||||||
|
|
||||||
|
registerRender(salted_bomb_u233);
|
||||||
|
registerRender(salted_bomb_u235);
|
||||||
|
registerRender(salted_bomb_np237);
|
||||||
|
registerRender(salted_bomb_pu239);
|
||||||
|
registerRender(salted_bomb_am242);
|
||||||
|
registerRender(salted_bomb_cm247);
|
||||||
|
registerRender(salted_bomb_bk248);
|
||||||
|
registerRender(salted_bomb_cf249);
|
||||||
|
registerRender(salted_bomb_cf251);
|
||||||
|
registerRender(bomb_antimatter);
|
||||||
|
registerRender(radioactive_earth);
|
||||||
|
registerRender(radioactive_earth2);
|
||||||
|
registerRender(trinitite);
|
||||||
|
registerRender(solid_trinitite);
|
||||||
|
registerRender(salted_sand);
|
||||||
|
registerRender(salted_sand2);
|
||||||
|
|
||||||
|
if(TrinityConfig.custom_nukes)
|
||||||
|
{
|
||||||
|
registerRender(core_custom_1);
|
||||||
|
registerRender(core_custom_2);
|
||||||
|
registerRender(core_custom_3);
|
||||||
|
registerRender(core_custom_4);
|
||||||
|
|
||||||
|
registerRender(salted_core_custom_1);
|
||||||
|
registerRender(salted_core_custom_2);
|
||||||
|
registerRender(salted_core_custom_3);
|
||||||
|
registerRender(salted_core_custom_4);
|
||||||
|
|
||||||
|
registerRender(bomb_custom1);
|
||||||
|
registerRender(bomb_custom2);
|
||||||
|
registerRender(bomb_custom3);
|
||||||
|
registerRender(bomb_custom4);
|
||||||
|
|
||||||
|
registerRender(salted_bomb_custom1);
|
||||||
|
registerRender(salted_bomb_custom2);
|
||||||
|
registerRender(salted_bomb_custom3);
|
||||||
|
registerRender(salted_bomb_custom4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRender(Block block) {
|
||||||
|
ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerBlock(Block block) {
|
||||||
|
ForgeRegistries.BLOCKS.register(block);
|
||||||
|
ForgeRegistries.ITEMS.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerBlock2(Block block) {
|
||||||
|
ForgeRegistries.BLOCKS.register(block);
|
||||||
|
ForgeRegistries.ITEMS.register(new ShieldedContainerItem(block).setRegistryName(block.getRegistryName()));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
43
src/main/java/trinity/init/ModDamageSources.java
Normal file
43
src/main/java/trinity/init/ModDamageSources.java
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import nc.init.NCFissionFluids;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.blocks.BasicBlock;
|
||||||
|
//import trinity.blocks.BasicBlock2;
|
||||||
|
import trinity.blocks.ExplosiveCharge;
|
||||||
|
import trinity.blocks.NuclearCore;
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
//import nca.blocks.MoissaniteBlock;
|
||||||
|
//import nca.blocks.bunkerblocks.BunkerBlocks;
|
||||||
|
//import nca.blocks.bunkerblocks.MoissaniteOre;
|
||||||
|
//import nca.blocks.bunkerblocks.TritiumLamp;
|
||||||
|
//import nca.blocks.bunkerblocks.TritiumLightFrame;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.util.DamageSource;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.event.RenderBlockOverlayEvent;
|
||||||
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid=Reference.MODID)
|
||||||
|
public class ModDamageSources {
|
||||||
|
|
||||||
|
public static final DamageSource NUCLEAR_EXPLOSION = new DamageSource("nuclear_explosion");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
258
src/main/java/trinity/init/ModEvents.java
Normal file
258
src/main/java/trinity/init/ModEvents.java
Normal file
|
@ -0,0 +1,258 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
//import icbm.classic.api.EnumTier;
|
||||||
|
//import icbm.classic.api.ExplosiveRefs;
|
||||||
|
//import icbm.classic.content.blast.BlastEMP;
|
||||||
|
//import icbm.classic.content.blast.threaded.BlastAntimatter;
|
||||||
|
//import icbm.classic.content.blast.threaded.BlastNuclear;
|
||||||
|
//import icbm.classic.content.blocks.explosive.ItemBlockExplosive;
|
||||||
|
//import icbm.classic.content.items.ItemMissile;
|
||||||
|
//import icbm.classic.lib.explosive.ExplosiveHandler;
|
||||||
|
import nc.capability.radiation.entity.IEntityRads;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.init.NCFissionFluids;
|
||||||
|
import nc.network.PacketHandler;
|
||||||
|
import nc.network.radiation.PlayerRadsUpdatePacket;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.blocks.BasicBlock;
|
||||||
|
//import trinity.blocks.BasicBlock2;
|
||||||
|
import trinity.blocks.ExplosiveCharge;
|
||||||
|
import trinity.blocks.NuclearCore;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.explosion.ExplosionNukeGeneric;
|
||||||
|
import trinity.handler.INuclearEffect;
|
||||||
|
//import trinity.items.RadioactiveSource;
|
||||||
|
import trinity.items.RadioactiveSource2;
|
||||||
|
import trinity.items.ShieldedContainerItem;
|
||||||
|
import trinity.radiation.FalloutSavedData;
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
//import nca.blocks.MoissaniteBlock;
|
||||||
|
//import nca.blocks.bunkerblocks.BunkerBlocks;
|
||||||
|
//import nca.blocks.bunkerblocks.MoissaniteOre;
|
||||||
|
//import nca.blocks.bunkerblocks.TritiumLamp;
|
||||||
|
//import nca.blocks.bunkerblocks.TritiumLightFrame;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.TextFormatting;
|
||||||
|
import net.minecraft.world.Explosion;
|
||||||
|
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.event.entity.player.ItemTooltipEvent;
|
||||||
|
import net.minecraftforge.event.world.ExplosionEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.gameevent.TickEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid=Reference.MODID)
|
||||||
|
public class ModEvents {
|
||||||
|
|
||||||
|
private static boolean renderingNukeEffects = false;
|
||||||
|
public static String Pu_238 = "c95fdfd3-bea7-4255-a44b-d21bc3df95e3";
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void textureStitch(TextureStitchEvent.Pre evt) {
|
||||||
|
evt.getMap().registerSprite(new ResourceLocation(Global.MOD_ID, "blocks/liquid_still"));
|
||||||
|
evt.getMap().registerSprite(new ResourceLocation(Global.MOD_ID, "blocks/liquid_flow"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority=EventPriority.LOW)
|
||||||
|
public void sealedRadiationSources(TickEvent.PlayerTickEvent event) {
|
||||||
|
|
||||||
|
if (!NCConfig.radiation_enabled_public) { return; }
|
||||||
|
|
||||||
|
if (event.phase != TickEvent.Phase.START ||
|
||||||
|
((event.player.world.getTotalWorldTime() + event.player.getUniqueID().hashCode()) %
|
||||||
|
NCConfig.radiation_player_tick_rate) != 0) { return; }
|
||||||
|
|
||||||
|
if (event.side == Side.SERVER && event.player instanceof EntityPlayerMP) {
|
||||||
|
EntityPlayerMP player = (EntityPlayerMP)event.player;
|
||||||
|
|
||||||
|
IEntityRads playerRads = RadiationHelper.getEntityRadiation(player);
|
||||||
|
|
||||||
|
if (player.getUniqueID().toString().equals(Pu_238) )
|
||||||
|
{
|
||||||
|
if(playerRads.getInternalRadiationResistance()<500)
|
||||||
|
{
|
||||||
|
playerRads.setInternalRadiationResistance(2800);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double radiationLevel = 0D;
|
||||||
|
FalloutSavedData data = FalloutSavedData.getData(event.player.world);
|
||||||
|
if(data.worldObj == null) {
|
||||||
|
data.worldObj = event.player.world;
|
||||||
|
}
|
||||||
|
|
||||||
|
radiationLevel += data.getRadNumFromCoord((int)player.posX, (int)player.posZ);
|
||||||
|
List Tes = player.world.loadedTileEntityList;
|
||||||
|
for (int i = 0; i < Tes.size(); ++i)
|
||||||
|
{
|
||||||
|
TileEntity tile = (TileEntity) Tes.get(i);
|
||||||
|
int tileDim = tile.getWorld().provider.getDimension();
|
||||||
|
int playerDim = player.getEntityWorld().provider.getDimension();
|
||||||
|
if(tile instanceof TileEntityShieldedContainer && (tileDim == playerDim))
|
||||||
|
{
|
||||||
|
TileEntityShieldedContainer te = ((TileEntityShieldedContainer)tile);
|
||||||
|
double X = player.posX;
|
||||||
|
double Y = player.posY;
|
||||||
|
double Z = player.posZ;
|
||||||
|
double dist = te.getDistanceSq(X, Y, Z);
|
||||||
|
radiationLevel += Math.min(te.getRadiation(), (te.getRadiation()/dist));
|
||||||
|
//System.out.println("Radioactivity: "+te.getRadioactivity()+" Rad/t");
|
||||||
|
}
|
||||||
|
//if(event.player.world.getTileEntity(pos))
|
||||||
|
}
|
||||||
|
if (!player.getUniqueID().toString().equals(Pu_238))
|
||||||
|
{
|
||||||
|
List entities = player.world.playerEntities;
|
||||||
|
for (int i = 0; i < entities.size(); ++i)
|
||||||
|
{
|
||||||
|
EntityPlayer p = (EntityPlayer) entities.get(i);
|
||||||
|
if (p.getUniqueID().toString().equals(Pu_238) )
|
||||||
|
{
|
||||||
|
double X = player.posX;
|
||||||
|
double Y = player.posY;
|
||||||
|
double Z = player.posZ;
|
||||||
|
double dist = p.getDistanceSq(X, Y, Z);
|
||||||
|
radiationLevel += Math.min(RadSources.PLUTONIUM_238, (RadSources.PLUTONIUM_238/dist));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InventoryPlayer inventory = player.inventory;
|
||||||
|
for (ItemStack stack : inventory.mainInventory) {
|
||||||
|
if (!stack.isEmpty()) {
|
||||||
|
Item item = stack.getItem();
|
||||||
|
/*if(Trinity.QMDLoaded)
|
||||||
|
{
|
||||||
|
if(item instanceof RadioactiveSource)
|
||||||
|
{
|
||||||
|
radiationLevel += (((RadioactiveSource)item).rads)*stack.getCount();
|
||||||
|
//System.out.println("Radioactivity: "+radiationLevel);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
if(item instanceof RadioactiveSource2)
|
||||||
|
{
|
||||||
|
radiationLevel += (((RadioactiveSource2)item).rads)*stack.getCount();
|
||||||
|
//System.out.println("Radioactivity: "+radiationLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(item instanceof ShieldedContainerItem)
|
||||||
|
{
|
||||||
|
radiationLevel += (((ShieldedContainerItem)item).getRadiation(stack))*stack.getCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
double appliedRads = RadiationHelper.addRadsToEntity(playerRads, player, radiationLevel, false, false, NCConfig.radiation_player_tick_rate);
|
||||||
|
playerRads.setRadiationLevel(playerRads.getRadiationLevel() + appliedRads);
|
||||||
|
//System.out.println("Radiation: "+playerRads.getRadiationLevel()+" Rad/t");
|
||||||
|
//System.out.println("Adjusted Radiation: "+playerRads.getRadiationLevel()/3+" Rad/t");
|
||||||
|
PacketHandler.instance.sendTo(new PlayerRadsUpdatePacket(playerRads), player);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*@SubscribeEvent
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addAdditionalTooltips(ItemTooltipEvent event) {
|
||||||
|
if(Trinity.ICBMLoaded)
|
||||||
|
{
|
||||||
|
ItemStack stack = event.getItemStack();
|
||||||
|
Item item = stack.getItem();
|
||||||
|
if(item instanceof ItemBlockExplosive || item instanceof ItemMissile)
|
||||||
|
{
|
||||||
|
if(stack.getItemDamage() == ExplosiveRefs.NUCLEAR.getRegistryID())
|
||||||
|
{
|
||||||
|
addNukeTooltip(event.getToolTip(), stack);
|
||||||
|
}
|
||||||
|
//if(((ItemBlockExplosive)item).
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
private static void addNukeTooltip(List<String> tooltip, ItemStack stack) {
|
||||||
|
tooltip.add(TextFormatting.RED+"Warning: Trinity installed. ICBM nuclear explosives cause Trinity's explosions instead of ICBM's");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@SubscribeEvent
|
||||||
|
public void explosion(ExplosionEvent.Start event)
|
||||||
|
{
|
||||||
|
if(Trinity.ICBMLoaded)
|
||||||
|
{
|
||||||
|
Explosion exp = event.getExplosion();
|
||||||
|
if(exp instanceof BlastNuclear)
|
||||||
|
{
|
||||||
|
if(((BlastNuclear)exp).getExplosiveData().getTier()==EnumTier.THREE)
|
||||||
|
{
|
||||||
|
event.setCanceled(true);
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(exp.world, 1000, (Math.min(TrinityConfig.icbm_radius,TrinityConfig.max_radius)*2) * 0.005F);
|
||||||
|
entity2.posX = exp.x;
|
||||||
|
entity2.posY = exp.y;
|
||||||
|
entity2.posZ = exp.z;
|
||||||
|
exp.world.spawnEntity(entity2);
|
||||||
|
// exp.world.setBlockToAir(pos);
|
||||||
|
new BlastEMP().setBlastWorld(event.getWorld()).setBlastSource(exp.exploder).setBlastPosition(((BlastNuclear) exp).location.x(), ((BlastNuclear) exp).location.y(), ((BlastNuclear) exp).location.z())
|
||||||
|
.setBlastSize(((BlastNuclear) exp).getBlastRadius()*2)
|
||||||
|
.setExplosiveData(ExplosiveRefs.EMP)
|
||||||
|
.buildBlast().runBlast();
|
||||||
|
ExplosionNukeGeneric.irradiate(exp.world, (int)exp.x, (int)exp.y, (int)exp.z, Math.min(TrinityConfig.icbm_radius,TrinityConfig.max_radius)*2);
|
||||||
|
exp.world.spawnEntity(EntityNuclearExplosion.statFac(exp.world, Math.min(TrinityConfig.icbm_radius,TrinityConfig.max_radius), exp.x + 0.0, exp.y + 0.0, exp.z + 0.0));
|
||||||
|
//System.out.println("If you are seeing this line, this means your blast detector is at least partially working.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*else if(exp instanceof BlastAntimatter)
|
||||||
|
{
|
||||||
|
//if(((BlastNuclear)exp).getExplosiveData().getTier()==EnumTier.THREE)
|
||||||
|
//{
|
||||||
|
event.setCanceled(true);
|
||||||
|
EntityNuclearCloud entity2 = new EntityNuclearCloud(exp.world, 1000, (Math.min(TrinityConfig.antimatter_radius,TrinityConfig.max_radius)*2) * 0.005F);
|
||||||
|
entity2.posX = exp.x;
|
||||||
|
entity2.posY = exp.y;
|
||||||
|
entity2.posZ = exp.z;
|
||||||
|
exp.world.spawnEntity(entity2);
|
||||||
|
// exp.world.setBlockToAir(pos);
|
||||||
|
ExplosionNukeGeneric.irradiate(exp.world, (int)exp.x, (int)exp.y, (int)exp.z, Math.min(TrinityConfig.antimatter_radius,TrinityConfig.max_radius)*6);
|
||||||
|
exp.world.spawnEntity(EntityNuclearExplosion.statFacAntimatter(exp.world, Math.min(TrinityConfig.antimatter_radius,TrinityConfig.max_radius), exp.x + 0.0, exp.y + 0.0, exp.z + 0.0));
|
||||||
|
new BlastEMP().setBlastWorld(event.getWorld()).setBlastSource(exp.exploder).setBlastPosition(((BlastNuclear) exp).location.x(), ((BlastNuclear) exp).location.y(), ((BlastNuclear) exp).location.z())
|
||||||
|
.setBlastSize(((BlastNuclear) exp).getBlastRadius()*2)
|
||||||
|
.setExplosiveData(ExplosiveRefs.EMP)
|
||||||
|
.buildBlast().runBlast();
|
||||||
|
//System.out.println("If you are seeing this line, this means your blast detector is at least partially working.");
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
221
src/main/java/trinity/init/ModItems.java
Normal file
221
src/main/java/trinity/init/ModItems.java
Normal file
|
@ -0,0 +1,221 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
//import nc.enumm.MetaEnums;
|
||||||
|
import nc.init.NCItems;
|
||||||
|
import nc.item.NCItemMeta;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.tab.NCTabs;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import trinity.items.BasicItem;
|
||||||
|
import trinity.items.ItemDetonator;
|
||||||
|
//import trinity.items.RadioactiveSource;
|
||||||
|
import trinity.items.RadioactiveSource2;
|
||||||
|
import trinity.items.ShieldedContainer;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
//import trinity.items.RadioactiveSource;
|
||||||
|
import trinity.tabs.TrinityTab;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.init.MobEffects;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.potion.PotionEffect;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid = Reference.MODID)
|
||||||
|
public class ModItems {
|
||||||
|
|
||||||
|
public static Item gem_witherite;
|
||||||
|
public static Item gem_dust_witherite;
|
||||||
|
public static Item barium;
|
||||||
|
public static Item compound_barium_nitrate;
|
||||||
|
public static Item compound_barium_oxide;
|
||||||
|
public static Item compound_lithium_deuteride;
|
||||||
|
public static Item dust_au_198;
|
||||||
|
public static Item ingot_au_198;
|
||||||
|
public static Item source_au_198;
|
||||||
|
|
||||||
|
public static Item bomb_pit_u233;
|
||||||
|
public static Item bomb_pit_u235;
|
||||||
|
public static Item bomb_pit_np237;
|
||||||
|
public static Item bomb_pit_pu239;
|
||||||
|
public static Item bomb_pit_am242;
|
||||||
|
public static Item bomb_pit_cm247;
|
||||||
|
public static Item bomb_pit_bk248;
|
||||||
|
public static Item bomb_pit_cf249;
|
||||||
|
public static Item bomb_pit_cf251;
|
||||||
|
|
||||||
|
public static Item detonator;
|
||||||
|
public static Item trinitite;
|
||||||
|
|
||||||
|
public static Item neutron_initiator;
|
||||||
|
|
||||||
|
public static Item light_shielded_pig;
|
||||||
|
public static Item medium_shielded_pig;
|
||||||
|
public static Item heavy_shielded_pig;
|
||||||
|
|
||||||
|
// Initialize
|
||||||
|
public static void init() {
|
||||||
|
|
||||||
|
light_shielded_pig = new ShieldedContainer("light_shielded_pig", 0.1);
|
||||||
|
light_shielded_pig.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
medium_shielded_pig = new ShieldedContainer("medium_shielded_pig", 1);
|
||||||
|
medium_shielded_pig.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
medium_shielded_pig = new ShieldedContainer("heavy_shielded_pig", 10);
|
||||||
|
medium_shielded_pig.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
trinitite = new BasicItem("trinitite_shard");
|
||||||
|
trinitite.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
gem_witherite = new BasicItem("gem_witherite");
|
||||||
|
gem_witherite.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
gem_dust_witherite = new BasicItem("gem_dust_witherite");
|
||||||
|
gem_dust_witherite.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
barium = new BasicItem("barium");
|
||||||
|
barium.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
compound_barium_nitrate = new BasicItem("compound_barium_nitrate");
|
||||||
|
compound_barium_nitrate.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
compound_barium_oxide = new BasicItem("compound_barium_oxide");
|
||||||
|
compound_barium_oxide.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
compound_lithium_deuteride = new BasicItem("compound_lithium_deuteride");
|
||||||
|
compound_lithium_deuteride.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
dust_au_198 = new BasicItem("dust_au_198");
|
||||||
|
dust_au_198.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
|
||||||
|
ingot_au_198 = new BasicItem("ingot_au_198");
|
||||||
|
ingot_au_198.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
//if(Trinity.QMDLoaded)
|
||||||
|
//{
|
||||||
|
// source_au_198 = new RadioactiveSource("source_au_198", RadiationHandler.GOLD_198/2);
|
||||||
|
// source_au_198.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
//}
|
||||||
|
//else if(!Trinity.QMDLoaded)
|
||||||
|
//{
|
||||||
|
source_au_198 = new RadioactiveSource2("source_au_198", RadiationHandler.GOLD_198/2);
|
||||||
|
source_au_198.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
//}
|
||||||
|
bomb_pit_u233 = new BasicItem("u233_pit");
|
||||||
|
bomb_pit_u233.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_u233.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_u235 = new BasicItem("u235_pit");
|
||||||
|
bomb_pit_u235.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_u235.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_np237 = new BasicItem("np237_pit");
|
||||||
|
bomb_pit_np237.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_np237.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_pu239 = new BasicItem("pu239_pit");
|
||||||
|
bomb_pit_pu239.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_pu239.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_am242 = new BasicItem("am242_pit");
|
||||||
|
bomb_pit_am242.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_am242.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_cm247 = new BasicItem("cm247_pit");
|
||||||
|
bomb_pit_cm247.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_cm247.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_bk248 = new BasicItem("bk248_pit");
|
||||||
|
bomb_pit_bk248.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_bk248.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_cf249 = new BasicItem("cf249_pit");
|
||||||
|
bomb_pit_cf249.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_cf249.setMaxStackSize(1);
|
||||||
|
|
||||||
|
bomb_pit_cf251 = new BasicItem("cf251_pit");
|
||||||
|
bomb_pit_cf251.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
bomb_pit_cf251.setMaxStackSize(1);
|
||||||
|
|
||||||
|
detonator = new ItemDetonator("detonator");
|
||||||
|
detonator.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
detonator.setMaxStackSize(1);
|
||||||
|
|
||||||
|
neutron_initiator = new RadioactiveSource2("neutron_initiator",RadiationHandler.INITIATOR);
|
||||||
|
neutron_initiator.setCreativeTab(TrinityTab.TRINITY_TAB);
|
||||||
|
neutron_initiator.setMaxStackSize(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
public static void register() {
|
||||||
|
registerItem(trinitite);
|
||||||
|
registerItem(gem_witherite);
|
||||||
|
registerItem(gem_dust_witherite);
|
||||||
|
registerItem(barium);
|
||||||
|
registerItem(compound_barium_nitrate);
|
||||||
|
registerItem(compound_barium_oxide);
|
||||||
|
registerItem(compound_lithium_deuteride);
|
||||||
|
registerItem(dust_au_198);
|
||||||
|
registerItem(ingot_au_198);
|
||||||
|
registerItem(source_au_198);
|
||||||
|
|
||||||
|
registerItem(bomb_pit_u233);
|
||||||
|
registerItem(bomb_pit_u235);
|
||||||
|
registerItem(bomb_pit_np237);
|
||||||
|
registerItem(bomb_pit_pu239);
|
||||||
|
registerItem(bomb_pit_am242);
|
||||||
|
registerItem(bomb_pit_cm247);
|
||||||
|
registerItem(bomb_pit_bk248);
|
||||||
|
registerItem(bomb_pit_cf249);
|
||||||
|
registerItem(bomb_pit_cf251);
|
||||||
|
|
||||||
|
registerItem(detonator);
|
||||||
|
registerItem(neutron_initiator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRenders() {
|
||||||
|
registerRender(trinitite);
|
||||||
|
registerRender(gem_witherite);
|
||||||
|
registerRender(gem_dust_witherite);
|
||||||
|
registerRender(barium);
|
||||||
|
registerRender(compound_barium_nitrate);
|
||||||
|
registerRender(compound_barium_oxide);
|
||||||
|
registerRender(compound_lithium_deuteride);
|
||||||
|
registerRender(dust_au_198);
|
||||||
|
registerRender(ingot_au_198);
|
||||||
|
registerRender(source_au_198);
|
||||||
|
|
||||||
|
registerRender(bomb_pit_u233);
|
||||||
|
registerRender(bomb_pit_u235);
|
||||||
|
registerRender(bomb_pit_np237);
|
||||||
|
registerRender(bomb_pit_pu239);
|
||||||
|
registerRender(bomb_pit_am242);
|
||||||
|
registerRender(bomb_pit_cm247);
|
||||||
|
registerRender(bomb_pit_bk248);
|
||||||
|
registerRender(bomb_pit_cf249);
|
||||||
|
registerRender(bomb_pit_cf251);
|
||||||
|
|
||||||
|
registerRender(detonator);
|
||||||
|
registerRender(neutron_initiator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerItem(Item item) {
|
||||||
|
ForgeRegistries.ITEMS.register(item);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void registerRender(Item item ) {
|
||||||
|
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation( item.getRegistryName(), "inventory"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public static void registerRender(Item item, int meta, String fileName) {
|
||||||
|
ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(new ResourceLocation(Reference.MODID, fileName), "inventory"));
|
||||||
|
}*/
|
||||||
|
}
|
30
src/main/java/trinity/init/TrinityEntities.java
Normal file
30
src/main/java/trinity/init/TrinityEntities.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.entities.EntityBlackHole;
|
||||||
|
import trinity.entities.EntityDirtyBomb;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityNuclearExplosion;
|
||||||
|
import trinity.entities.EntityShockwave;
|
||||||
|
import trinity.entities.EntityThermalBlast;
|
||||||
|
import trinity.entities.EntityThermonuclearBlast;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.common.registry.EntityRegistry;
|
||||||
|
|
||||||
|
public class TrinityEntities {
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
// EntityRegistry.registerModEntity("entity_nuke_mk4", EntityNukeExplosionMK4.class, 89, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_nuclear_blast"), EntityNuclearExplosion.class, "entity_nuclear_blast", 0, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_nuclear_cloud"), EntityNuclearCloud.class, "entity_nuclear_cloud", 1, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_fallout"), EntityFalloutRain.class, "entity_fallout", 2, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_shockwave"), EntityShockwave.class, "entity_shockwave", 3, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_dirty_bomb"), EntityDirtyBomb.class, "entity_dirty_bomb", 4, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_thermonuclear_blast"), EntityThermonuclearBlast.class, "entity_thermonuclear_blast", 5, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_thermal_blast"), EntityThermalBlast.class, "entity_thermal_blast", 6, Trinity.instance, 1000, 1, true);
|
||||||
|
EntityRegistry.registerModEntity(new ResourceLocation(Global.MOD_ID, "entity_black_hole"), EntityBlackHole.class, "entity_black_hole", 7, Trinity.instance, 1000, 1, true);
|
||||||
|
}
|
||||||
|
}
|
286
src/main/java/trinity/init/TrinityRecipes.java
Normal file
286
src/main/java/trinity/init/TrinityRecipes.java
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
package trinity.init;
|
||||||
|
|
||||||
|
import static nc.config.NCConfig.fission_irradiator_efficiency;
|
||||||
|
import static nc.config.NCConfig.fission_irradiator_heat_per_flux;
|
||||||
|
import static nc.util.FluidStackHelper.INGOT_VOLUME;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
|
||||||
|
//import lach_01298.qmd.recipes.QMDRecipes;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.init.NCItems;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.recipe.NCRecipes;
|
||||||
|
import nc.recipe.RecipeHelper;
|
||||||
|
import nc.recipe.ingredient.FluidIngredient;
|
||||||
|
import nc.recipe.ingredient.OreIngredient;
|
||||||
|
import nc.recipe.vanilla.CraftingRecipeHandler;
|
||||||
|
import nc.util.FluidRegHelper;
|
||||||
|
import nc.util.FluidStackHelper;
|
||||||
|
import nc.util.NCUtil;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.fluid.TrinityFluids;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||||
|
|
||||||
|
public class TrinityRecipes {
|
||||||
|
|
||||||
|
private static boolean initialized = false;
|
||||||
|
|
||||||
|
public static FluidIngredient fluidStack(String fluidName, int stackSize) {
|
||||||
|
if (!FluidRegHelper.fluidExists(fluidName)) return null;
|
||||||
|
return new FluidIngredient(fluidName, stackSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOW)
|
||||||
|
public void registerRecipes(RegistryEvent.Register<IRecipe> event) {
|
||||||
|
if (initialized) return;
|
||||||
|
|
||||||
|
NCRecipes.chemical_reactor.addRecipe(fluidStack("witherite_water", FluidStackHelper.BUCKET_VOLUME), fluidStack("nitric_acid", FluidStackHelper.BUCKET_VOLUME*2), fluidStack("barium_nitrate_solution", FluidStackHelper.BUCKET_VOLUME), fluidStack("carbon_dioxide", FluidStackHelper.BUCKET_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.chemical_reactor.addRecipe(fluidStack("nitrogen", FluidStackHelper.BUCKET_VOLUME), fluidStack("oxygen", FluidStackHelper.BUCKET_VOLUME), fluidStack("nitric_oxide", FluidStackHelper.BUCKET_VOLUME*2), NCRecipes.chemical_reactor.emptyFluidStack(), 1D, 1D);
|
||||||
|
NCRecipes.chemical_reactor.addRecipe(fluidStack("nitric_oxide", FluidStackHelper.BUCKET_VOLUME*2), fluidStack("oxygen", FluidStackHelper.BUCKET_VOLUME), fluidStack("nitrogen_dioxide", FluidStackHelper.BUCKET_VOLUME*2), NCRecipes.chemical_reactor.emptyFluidStack(), 1D, 1D);
|
||||||
|
NCRecipes.chemical_reactor.addRecipe(fluidStack("nitrogen_dioxide", FluidStackHelper.BUCKET_VOLUME*3), fluidStack("water", FluidStackHelper.BUCKET_VOLUME), fluidStack("nitric_acid", FluidStackHelper.BUCKET_VOLUME*2),fluidStack("nitric_oxide", FluidStackHelper.BUCKET_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.electrolyzer.addRecipe(fluidStack("nitric_oxide", FluidStackHelper.BUCKET_VOLUME), fluidStack("nitrogen", FluidStackHelper.BUCKET_VOLUME/2), fluidStack("oxygen", FluidStackHelper.BUCKET_VOLUME/2), NCRecipes.electrolyzer.emptyFluidStack(), NCRecipes.electrolyzer.emptyFluidStack(), 1D, 0.5D);
|
||||||
|
NCRecipes.enricher.addRecipe("dustWitherite", fluidStack("water", FluidStackHelper.BUCKET_VOLUME), fluidStack("witherite_water", FluidStackHelper.GEM_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.enricher.addRecipe("dustBariumOxide", fluidStack("nitric_acid", FluidStackHelper.GEM_VOLUME*2), fluidStack("barium_nitrate_solution", FluidStackHelper.GEM_VOLUME*2), 1D, 1D);
|
||||||
|
NCRecipes.enricher.addRecipe("dustBariumNitrate", fluidStack("water", FluidStackHelper.BUCKET_VOLUME), fluidStack("barium_nitrate_solution", FluidStackHelper.GEM_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.enricher.addRecipe("dustBariumNitrate", fluidStack("tnt", FluidStackHelper.BUCKET_VOLUME/5), fluidStack("baratol", FluidStackHelper.BUCKET_VOLUME/5), 1D, 1D);
|
||||||
|
NCRecipes.infuser.addRecipe("ingotLithium6", fluidStack("deuterium", FluidStackHelper.BUCKET_VOLUME), "ingotLithium6Deuteride", 1D, 1D);
|
||||||
|
NCRecipes.infuser.addRecipe("dustBarium", fluidStack("oxygen", FluidStackHelper.BUCKET_VOLUME), "dustBariumOxide", 1D, 1D);
|
||||||
|
NCRecipes.infuser.addRecipe(ModBlocks.empty_fusion_bomb, fluidStack("deuterium-tritium_mixture", FluidStackHelper.BUCKET_VOLUME), ModBlocks.fusion_bomb, 1D, 1D);
|
||||||
|
NCRecipes.crystallizer.addRecipe(fluidStack("barium_nitrate_solution", FluidStackHelper.GEM_VOLUME), "dustBariumNitrate", 1D, 1D);
|
||||||
|
NCRecipes.crystallizer.addRecipe(fluidStack("witherite_water", FluidStackHelper.GEM_VOLUME), "dustWitherite", 1D, 1D);
|
||||||
|
NCRecipes.ingot_former.addRecipe(fluidStack("baratol", FluidStackHelper.BUCKET_VOLUME), ModBlocks.baratol, 1D, 1D);
|
||||||
|
NCRecipes.fission_irradiator.addRecipe(Lists.newArrayList("ingotGold", "dustGold"), "dustGold198", 1600000, 0, 0);
|
||||||
|
NCRecipes.salt_mixer.addRecipe(fluidStack("deuterium", FluidStackHelper.BUCKET_VOLUME/2), fluidStack("tritium", FluidStackHelper.BUCKET_VOLUME/2), fluidStack("deuterium-tritium_mixture", FluidStackHelper.BUCKET_VOLUME), 0.5D, 0.5D);
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.light_container, 1, 0), new Object[] {"SSS", "SCS", "SSS", 'S', new ItemStack(NCItems.rad_shielding, 1, 0), 'C', Blocks.CHEST});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.medium_container, 1, 0), new Object[] {"SSS", "SCS", "SSS", 'S', new ItemStack(NCItems.rad_shielding, 1, 1), 'C', Blocks.CHEST});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.heavy_container, 1, 0), new Object[] {"SSS", "SCS", "SSS", 'S', new ItemStack(NCItems.rad_shielding, 1, 2), 'C', Blocks.CHEST});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.solid_trinitite, 1, 0), new Object[] {"TTT", "TTT", "TTT", 'T', ModItems.trinitite});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.detonator, 1, 0), new Object[] {"TP ", "PBP", " P ", 'T', Blocks.REDSTONE_TORCH, 'P', "ingotPlutonium242", 'B', Blocks.STONE_BUTTON});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.compression_charge, 1, 0), new Object[] {"STB", "TB ", "STB", 'S', "ingotLead", 'T', Blocks.TNT, 'B', ModBlocks.baratol});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "dustPolonium", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "ingotPolonium", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "dustPolonium210", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "ingotPolonium210", 'B', "ingotBeryllium"});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.empty_fusion_bomb, 1, 0), new Object[] {"CCC", "M M", "CCC", 'C', ModBlocks.compression_charge, 'M', "solenoidCopper"});
|
||||||
|
|
||||||
|
//CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.source_au_198, 1, 0), new Object[] {"BBB", "BSB", "BBB", 'S', "ingotGold198",'B', "bioplastic"});
|
||||||
|
//CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.source_au_198, 1, 0), new Object[] {"BBB", "BSB", "BBB", 'S', "dustGold198",'B', "bioplastic"});
|
||||||
|
|
||||||
|
//if(Trinity.QMDLoaded)
|
||||||
|
//{
|
||||||
|
// QMDRecipes.irradiator_fuel.addRecipe(new ItemStack(ModItems.source_au_198, 1, 0), 20D);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(TrinityConfig.thermonuclear)
|
||||||
|
{
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.thermonuclear_core_pu239, 1, 0), new Object[] {"LLL", "PPP", "LLL", 'L', "ingotLithium6Deuteride", 'P', "ingotPlutonium239"});
|
||||||
|
}
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_antimatter, 1, 0), new Object[] {"ESE", "SAS", "ESE", 'A', "cellAntimatter", 'E', "plateElite", 'S', "solenoidCopper"});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_u233, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_u233});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_u235, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_u235});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_np237, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_np237});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_pu239, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_pu239});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_am242, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_am242});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cm247, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cm247});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_bk248, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_bk248});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cf249, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cf249});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cf251, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cf251});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_u233, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_u233});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_u235, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_u235});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_np237, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_np237});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_pu239, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_pu239});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_am242, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_am242});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cm247, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cm247});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_bk248, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_bk248});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cf249, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cf249});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cf251, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cf251});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotUranium233", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotUranium235", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotNeptunium237", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotPlutonium239", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotAmericium242", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCurium247", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotBerkelium248", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCalifornium249", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCalifornium251", 'N', ModItems.neutron_initiator});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u233, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u235, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_np237, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_pu239, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_am242, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cm247, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_bk248, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf249, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf251, 'F', "ingotUranium238"});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u233, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u235, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_np237, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_pu239, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_am242, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cm247, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_bk248, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf249, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf251, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_thorium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_uranium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_neptunium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_plutonium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_americium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_curium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_berkelium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_californium});
|
||||||
|
CraftingRecipeHandler.addShapelessOreRecipe(new ItemStack(ModBlocks.gold_bomb, 1, 0), Blocks.TNT, "dustGold198");
|
||||||
|
CraftingRecipeHandler.addShapelessOreRecipe(new ItemStack(ModBlocks.gold_bomb, 1, 0), Blocks.TNT, "ingotGold198");
|
||||||
|
GameRegistry.addSmelting(ModItems.dust_au_198, new ItemStack(ModItems.ingot_au_198, 1, 0), 0);
|
||||||
|
if(TrinityConfig.custom_nukes)
|
||||||
|
{
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom1, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_1});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom2, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_2});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom3, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_3});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom4, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_4});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom1, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_1});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom2, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_2});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom3, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_3});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom4, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_4});
|
||||||
|
}
|
||||||
|
NCRecipes.melter.addRecipe(Blocks.TNT, fluidStack("tnt", FluidStackHelper.BUCKET_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.pressurizer.addRecipe(ModItems.gem_dust_witherite, ModItems.gem_witherite, 1D, 1D);
|
||||||
|
NCRecipes.manufactory.addRecipe(ModItems.gem_witherite, ModItems.gem_dust_witherite, 1.5D, 1.5D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("obsidian"), 1), NCRecipes.rock_crusher.chanceOreStack("dustSulfur", 2, 45), NCRecipes.rock_crusher.chanceOreStack("dustWitherite", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustMagnesium", 1, 30), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockTrinitite"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 10), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 10), NCRecipes.rock_crusher.chanceOreStack("dustMolybdenum", 1, 5), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockRadioactiveEarth"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 50), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 10), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockRadioactiveSand"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 50), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 10), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockHighlyRadioactiveEarth"), 1), NCRecipes.rock_crusher.chanceOreStack("dustEuropium155", 1, 20), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustGold198", 1, 1), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockHighlyRadioactiveSand"), 1), NCRecipes.rock_crusher.chanceOreStack("dustEuropium155", 1, 20), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustGold198", 1, 1), 1D, 1D);
|
||||||
|
|
||||||
|
initialized = true;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
/*public static void init() {
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.solid_trinitite, 1, 0), new Object[] {"TTT", "TTT", "TTT", 'T', ModItems.trinitite});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.detonator, 1, 0), new Object[] {"TP ", "PBP", " P ", 'T', Blocks.REDSTONE_TORCH, 'P', "ingotPlutonium242", 'B', Blocks.STONE_BUTTON});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.compression_charge, 1, 0), new Object[] {"STB", "TB ", "STB", 'S', "ingotLead", 'T', Blocks.TNT, 'B', ModBlocks.baratol});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "dustPolonium", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "ingotPolonium", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "dustPolonium210", 'B', "ingotBeryllium"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.neutron_initiator, 1, 0), new Object[] {" B ", "BPB", " B ", 'P', "ingotPolonium210", 'B', "ingotBeryllium"});
|
||||||
|
|
||||||
|
if(TrinityConfig.thermonuclear)
|
||||||
|
{
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.thermonuclear_core_pu239, 1, 0), new Object[] {"LLL", "PPP", "LLL", 'L', "ingotLithium6Deuteride", 'P', "ingotPlutonium239"});
|
||||||
|
}
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_antimatter, 1, 0), new Object[] {"ESE", "SAS", "EPE", 'A', "cellAntimatter", 'E', "plateElite", 'S', "solenoidCopper", 'P', NCBlocks.rtg_plutonium});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_u233, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_u233});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_u235, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_u235});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_np237, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_np237});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_pu239, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_pu239});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_am242, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_am242});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cm247, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cm247});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_bk248, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_bk248});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cf249, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cf249});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_cf251, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_cf251});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_u233, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_u233});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_u235, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_u235});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_np237, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_np237});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_pu239, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_pu239});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_am242, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_am242});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cm247, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cm247});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_bk248, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_bk248});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cf249, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cf249});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_cf251, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_cf251});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotUranium233", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotUranium235", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotNeptunium237", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotPlutonium239", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotAmericium242", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCurium247", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotBerkelium248", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCalifornium249", 'N', ModItems.neutron_initiator});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModItems.bomb_pit_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'F', "ingotCalifornium251", 'N', ModItems.neutron_initiator});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u233, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u235, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_np237, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_pu239, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_am242, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cm247, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_bk248, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf249, 'F', "ingotUranium238"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.core_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf251, 'F', "ingotUranium238"});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_u233, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u233, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_u235, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_u235, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_np237, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_np237, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_pu239, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_pu239, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_am242, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_am242, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cm247, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cm247, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_bk248, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_bk248, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cf249, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf249, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_core_cf251, 1, 0), new Object[] {"FFF", "FNF", "FFF", 'N', ModItems.bomb_pit_cf251, 'F', "ingotGold"});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_thorium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_uranium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_neptunium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_plutonium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_americium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_curium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_berkelium});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.dirty_bomb, 1, 0), new Object[] {"RRR", "RTR", "RRR", 'T', Blocks.TNT, 'R', NCItems.depleted_fuel_californium});
|
||||||
|
|
||||||
|
if(TrinityConfig.custom_nukes)
|
||||||
|
{
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom1, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_1});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom2, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_2});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom3, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_3});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.bomb_custom4, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.core_custom_4});
|
||||||
|
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom1, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_1});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom2, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_2});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom3, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_3});
|
||||||
|
CraftingRecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.salted_bomb_custom4, 1, 0), new Object[] {"CCC", "CNC", "CCC", 'C', ModBlocks.compression_charge, 'N', ModBlocks.salted_core_custom_4});
|
||||||
|
}
|
||||||
|
NCRecipes.melter.addRecipe(Blocks.TNT, fluidStack("tnt", FluidStackHelper.BUCKET_VOLUME), 1D, 1D);
|
||||||
|
NCRecipes.pressurizer.addRecipe(ModItems.gem_dust_witherite, ModItems.gem_witherite, 1D, 1D);
|
||||||
|
NCRecipes.manufactory.addRecipe(ModItems.gem_witherite, ModItems.gem_dust_witherite, 1.5D, 1.5D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("obsidian"), 1), NCRecipes.rock_crusher.chanceOreStack("dustSulfur", 2, 45), NCRecipes.rock_crusher.chanceOreStack("dustWitherite", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustMagnesium", 1, 30), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockTrinitite"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 10), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 10), NCRecipes.rock_crusher.chanceOreStack("dustMolybdenum", 1, 5), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockRadioactiveEarth"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 50), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 10), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockRadioactiveSand"), 1), NCRecipes.rock_crusher.chanceOreStack("dustCaesium137", 1, 50), NCRecipes.rock_crusher.chanceOreStack("dustStrontium90", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 10), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockHighlyRadioactiveEarth"), 1), NCRecipes.rock_crusher.chanceOreStack("dustEuropium155", 1, 20), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustRuthenium106", 1, 20), 1D, 1D);
|
||||||
|
NCRecipes.rock_crusher.addRecipe(NCRecipes.rock_crusher.oreStackList(Lists.newArrayList("blockHighlyRadioactiveSand"), 1), NCRecipes.rock_crusher.chanceOreStack("dustEuropium155", 1, 20), NCRecipes.rock_crusher.chanceOreStack("dustPromethium147", 1, 25), NCRecipes.rock_crusher.chanceOreStack("dustRuthenium106", 1, 20), 1D, 1D);
|
||||||
|
}*/
|
||||||
|
}
|
13
src/main/java/trinity/items/BasicItem.java
Normal file
13
src/main/java/trinity/items/BasicItem.java
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
package trinity.items;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class BasicItem extends Item{
|
||||||
|
|
||||||
|
public BasicItem(String nameIn) {
|
||||||
|
this.setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
this.setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
}
|
||||||
|
}
|
175
src/main/java/trinity/items/ItemDetonator.java
Normal file
175
src/main/java/trinity/items/ItemDetonator.java
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
package trinity.items;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ActionResult;
|
||||||
|
import net.minecraft.util.EnumActionResult;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
|
//import net.minecraft.util.ChatComponentText;
|
||||||
|
import net.minecraft.util.EnumHand;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.blocks.AntimatterBomb;
|
||||||
|
import trinity.blocks.DirtyBomb;
|
||||||
|
import trinity.blocks.ExoticBomb;
|
||||||
|
import trinity.blocks.ExplosiveCharge;
|
||||||
|
import trinity.blocks.NuclearCore;
|
||||||
|
|
||||||
|
public class ItemDetonator extends Item {
|
||||||
|
|
||||||
|
public ItemDetonator(String nameIn) {
|
||||||
|
this.setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
this.setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
tooltip.add("Sneak right-click to set position,");
|
||||||
|
tooltip.add("right-click to detonate!");
|
||||||
|
if(stack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
tooltip.add("No position set!");
|
||||||
|
} else {
|
||||||
|
tooltip.add("Set pos to " + stack.getTagCompound().getInteger("x") + ", " + stack.getTagCompound().getInteger("y") + ", " + stack.getTagCompound().getInteger("z"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
|
||||||
|
{
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
if(stack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
stack.setTagCompound(new NBTTagCompound());
|
||||||
|
}
|
||||||
|
//player.sendMessage(new TextComponentString("hitX: "+pos.getX()+"hitY: "+pos.getY()+"hitZ: "+pos.getZ()));
|
||||||
|
if(player.isSneaking())
|
||||||
|
{
|
||||||
|
stack.getTagCompound().setInteger("x", pos.getX());
|
||||||
|
stack.getTagCompound().setInteger("y", pos.getY());
|
||||||
|
stack.getTagCompound().setInteger("z", pos.getZ());
|
||||||
|
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Position set!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
|
||||||
|
|
||||||
|
return EnumActionResult.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EnumActionResult.FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
|
||||||
|
ItemStack stack = player.getHeldItem(hand);
|
||||||
|
if(!player.isSneaking())
|
||||||
|
{
|
||||||
|
if(stack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
if(world.isRemote)
|
||||||
|
player.sendMessage(new TextComponentString("Error: Position not set."));
|
||||||
|
} else {
|
||||||
|
int x = stack.getTagCompound().getInteger("x");
|
||||||
|
int y = stack.getTagCompound().getInteger("y");
|
||||||
|
int z = stack.getTagCompound().getInteger("z");
|
||||||
|
BlockPos bomb = new BlockPos(x,y,z);
|
||||||
|
if(world.getBlockState(bomb).getBlock() instanceof NuclearCore)
|
||||||
|
{
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
if(!world.isRemote)
|
||||||
|
{
|
||||||
|
((NuclearCore)world.getBlockState(bomb).getBlock()).AtomicBomb(world, bomb, ((NuclearCore)world.getBlockState(bomb).getBlock()).blastRadius,((NuclearCore)world.getBlockState(bomb).getBlock()).salted);
|
||||||
|
|
||||||
|
//if(MainRegistry.enableExtendedLogging)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||||
|
}
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Detonated!"));
|
||||||
|
}
|
||||||
|
}else if(world.getBlockState(bomb).getBlock() instanceof ExplosiveCharge)
|
||||||
|
{
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
if(!world.isRemote)
|
||||||
|
{
|
||||||
|
((ExplosiveCharge)world.getBlockState(bomb).getBlock()).Explode(world.getBlockState(bomb),world, bomb);
|
||||||
|
|
||||||
|
//if(MainRegistry.enableExtendedLogging)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||||
|
}
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Detonated!"));
|
||||||
|
}
|
||||||
|
}else if(world.getBlockState(bomb).getBlock() instanceof AntimatterBomb)
|
||||||
|
{
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
if(!world.isRemote)
|
||||||
|
{
|
||||||
|
((AntimatterBomb)world.getBlockState(bomb).getBlock()).AtomicBomb(world, bomb, ((AntimatterBomb)world.getBlockState(bomb).getBlock()).blastRadius);
|
||||||
|
|
||||||
|
//if(MainRegistry.enableExtendedLogging)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||||
|
}
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Detonated!"));
|
||||||
|
}
|
||||||
|
}else if(world.getBlockState(bomb).getBlock() instanceof ExoticBomb)
|
||||||
|
{
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
if(!world.isRemote)
|
||||||
|
{
|
||||||
|
((ExoticBomb)world.getBlockState(bomb).getBlock()).AtomicBomb(world, bomb, ((ExoticBomb)world.getBlockState(bomb).getBlock()).blastRadius);
|
||||||
|
|
||||||
|
//if(MainRegistry.enableExtendedLogging)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||||
|
}
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Detonated!"));
|
||||||
|
}
|
||||||
|
}else if(world.getBlockState(bomb).getBlock() instanceof DirtyBomb)
|
||||||
|
{
|
||||||
|
//world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
|
||||||
|
if(!world.isRemote)
|
||||||
|
{
|
||||||
|
((DirtyBomb)world.getBlockState(bomb).getBlock()).explode(world, bomb, true, player);
|
||||||
|
|
||||||
|
//if(MainRegistry.enableExtendedLogging)
|
||||||
|
// MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
|
||||||
|
}
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Detonated!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(world.isRemote)
|
||||||
|
{
|
||||||
|
player.sendMessage(new TextComponentString("Error: Target incompatible or too far away."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onItemRightClick( world, player, hand );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
56
src/main/java/trinity/items/RadioactiveSource2.java
Normal file
56
src/main/java/trinity/items/RadioactiveSource2.java
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
package trinity.items;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
//import lach_01298.qmd.enums.MaterialTypes.SourceType;
|
||||||
|
//import lach_01298.qmd.item.IItemAmount;
|
||||||
|
//import lach_01298.qmd.item.ItemSource;
|
||||||
|
import nc.capability.radiation.entity.IEntityRads;
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.item.NCItem;
|
||||||
|
import nc.radiation.RadiationHandler;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class RadioactiveSource2 extends Item{
|
||||||
|
|
||||||
|
public double rads;
|
||||||
|
|
||||||
|
private static final String RADIATION = Lang.localise("item.nuclearcraft.rads");
|
||||||
|
|
||||||
|
public RadioactiveSource2(String nameIn, double radioactivity) {
|
||||||
|
this.setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
this.rads = radioactivity;
|
||||||
|
this.setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
IRadiationSource stackSource = RadiationHelper.getRadiationSource(stack);
|
||||||
|
if(stackSource==null)
|
||||||
|
{
|
||||||
|
if(this.rads>NCConfig.radiation_lowest_rate)
|
||||||
|
{
|
||||||
|
tooltip.add(RadiationHelper.getRadiationTextColor(this.rads*stack.getCount()) + RADIATION + " " + RadiationHelper.radsPrefix(this.rads*stack.getCount(), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
src/main/java/trinity/items/ShieldedContainer.java
Normal file
60
src/main/java/trinity/items/ShieldedContainer.java
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
package trinity.items;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
|
||||||
|
import nc.capability.radiation.entity.IEntityRads;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.radiation.RadiationHandler;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class ShieldedContainer extends Item{
|
||||||
|
|
||||||
|
public static double rads;
|
||||||
|
private double resistance;
|
||||||
|
|
||||||
|
private static final String RADIATION = Lang.localise("item.nuclearcraft.rads");
|
||||||
|
|
||||||
|
public ShieldedContainer(String nameIn, double radioresistance) {
|
||||||
|
this.setTranslationKey(Global.MOD_ID + "." + nameIn);
|
||||||
|
this.resistance = radioresistance;
|
||||||
|
this.setRegistryName(new ResourceLocation(Global.MOD_ID, nameIn));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, @Nullable World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
if(this.rads>NCConfig.radiation_lowest_rate)
|
||||||
|
{
|
||||||
|
tooltip.add(RadiationHelper.getRadiationTextColor(this.rads*stack.getCount()) + RADIATION + " " + RadiationHelper.radsPrefix(this.rads*stack.getCount(), true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected)
|
||||||
|
{
|
||||||
|
EntityLivingBase living = ((EntityLivingBase)entity);
|
||||||
|
IEntityRads playerRads = RadiationHelper.getEntityRadiation(living);
|
||||||
|
playerRads.setRadiationLevel(RadiationHelper.addRadsToEntity(playerRads, living, playerRads.getRawRadiationLevel()+(this.rads*stack.getCount()), false, false, NCConfig.radiation_player_tick_rate/4));
|
||||||
|
//if(!world.isRemote)
|
||||||
|
//{
|
||||||
|
//RadiationHelper.transferRadsFromInventoryToPlayer(arg0, arg1, arg2)
|
||||||
|
//RadiationHelper.addRadsToEntity(playerRads, living, this.rads*stack.getCount(), false, false, NCConfig.radiation_player_tick_rate/4);
|
||||||
|
//RadiationHelper.addRadsToEntity(playerRads, living, this.rads, false, false, NCConfig.radiation_player_tick_rate/2));
|
||||||
|
//}
|
||||||
|
//if(world.isRemote)
|
||||||
|
//{
|
||||||
|
//playerRads.setRadiationLevel(this.rads*stack.getCount());
|
||||||
|
//}
|
||||||
|
}*/
|
||||||
|
}
|
84
src/main/java/trinity/items/ShieldedContainerItem.java
Normal file
84
src/main/java/trinity/items/ShieldedContainerItem.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
package trinity.items;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nullable;
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.Lang;
|
||||||
|
import nc.util.NCMath;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.client.util.ITooltipFlag;
|
||||||
|
import net.minecraft.item.ItemBlock;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import trinity.blocks.ShieldedContainer;
|
||||||
|
|
||||||
|
public class ShieldedContainerItem extends ItemBlock {
|
||||||
|
|
||||||
|
//public double rads;
|
||||||
|
private static final String RADIATION = Lang.localise("item.nuclearcraft.rads");
|
||||||
|
public ShieldedContainerItem(Block block) {
|
||||||
|
super(block);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@Override
|
||||||
|
//public int getItemBurnTime(ItemStack itemStack) {
|
||||||
|
// return 4000;
|
||||||
|
//}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn)
|
||||||
|
{
|
||||||
|
//rads = ShieldedContainer.rads;
|
||||||
|
double rads = getRadiation(stack);
|
||||||
|
if(rads > 0 && rads >= NCConfig.radiation_lowest_rate)
|
||||||
|
{
|
||||||
|
tooltip.add(RadiationHelper.getRadiationTextColor(rads*stack.getCount()) + RADIATION + " " + RadiationHelper.radsPrefix(rads*stack.getCount(), true));
|
||||||
|
}
|
||||||
|
//tooltip.add("Light Shielding: "+NCConfig.radiation_shielding_level[0]);
|
||||||
|
//tooltip.add("Medium Shielding: "+NCConfig.radiation_shielding_level[1]);
|
||||||
|
//tooltip.add("Heavy Shielding: "+NCConfig.radiation_shielding_level[2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadioactivity(ItemStack stack, double radioactivity)
|
||||||
|
{
|
||||||
|
if(stack.getTagCompound() == null)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadioactivity(ItemStack stack)
|
||||||
|
{
|
||||||
|
if(stack.hasTagCompound())
|
||||||
|
{
|
||||||
|
double radioactivity = stack.getTagCompound().getDouble("Radioactivity");
|
||||||
|
//System.out.println("Radioactivity: "+radioactivity);
|
||||||
|
return radioactivity;
|
||||||
|
}
|
||||||
|
else{//if(radioactivity != null)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getShielding()
|
||||||
|
{
|
||||||
|
Block block = this.block;
|
||||||
|
if(block instanceof ShieldedContainer)
|
||||||
|
{
|
||||||
|
ShieldedContainer shield = ((ShieldedContainer)block);
|
||||||
|
return shield.shielding;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadiation(ItemStack stack)
|
||||||
|
{
|
||||||
|
double rads = getRadioactivity(stack);
|
||||||
|
double shieldedRads = 0D;
|
||||||
|
shieldedRads = NCMath.sq(rads) / (rads + (Math.exp(getShielding())-1));
|
||||||
|
//System.out.println("Emitted Radiation: "+shieldedRads+" Rad/t");
|
||||||
|
return shieldedRads;
|
||||||
|
}
|
||||||
|
}
|
180
src/main/java/trinity/proxy/ClientProxy.java
Normal file
180
src/main/java/trinity/proxy/ClientProxy.java
Normal file
|
@ -0,0 +1,180 @@
|
||||||
|
package trinity.proxy;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.handler.TooltipHandler;
|
||||||
|
import nc.render.BlockHighlightHandler;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityBlackHole;
|
||||||
|
import trinity.entities.EntityDirtyBomb;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.entities.EntityThermalBlast;
|
||||||
|
import trinity.fluid.TrinityFluids;
|
||||||
|
import trinity.handler.INuclearEffect;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModEvents;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
import trinity.render.AdvancedModelLoader;
|
||||||
|
import trinity.render.HmfModelLoader;
|
||||||
|
import trinity.render.entity.RenderBlackHole;
|
||||||
|
import trinity.render.entity.RenderFallout;
|
||||||
|
import trinity.render.entity.RenderFalloutRainFactory;
|
||||||
|
import trinity.render.entity.RenderNuclearExplosion;
|
||||||
|
import trinity.render.entity.RenderPrimedDirtyBomb;
|
||||||
|
import trinity.render.entity.RenderThermalBlastFactory;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelBakery;
|
||||||
|
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||||
|
import net.minecraft.client.renderer.block.statemap.StateMapperBase;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
|
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.common.eventhandler.EventPriority;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
|
||||||
|
public class ClientProxy extends CommonProxy {
|
||||||
|
|
||||||
|
private final Minecraft mc = Minecraft.getMinecraft();
|
||||||
|
//private boolean nukeEffects = false;
|
||||||
|
@Override
|
||||||
|
public void preInit(FMLPreInitializationEvent preEvent) {
|
||||||
|
super.preInit(preEvent);
|
||||||
|
|
||||||
|
TrinityConfig.clientPreInit();
|
||||||
|
|
||||||
|
ModItems.registerRenders();
|
||||||
|
ModBlocks.registerRenders();
|
||||||
|
MinecraftForge.EVENT_BUS.register(new ModEvents());
|
||||||
|
//MinecraftForge.EVENT_BUS.register(new ICBMEvents());
|
||||||
|
TrinityFluids.renderFluids();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerRenderInfo()
|
||||||
|
{
|
||||||
|
MinecraftForge.EVENT_BUS.register(new NuclearRender());
|
||||||
|
AdvancedModelLoader.registerModelHandler(new HmfModelLoader());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityNuclearCloud.class, new RenderSmallNukeMK3Factory());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityFalloutRain.class, new RenderFalloutRainFactory());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityDirtyBomb.class, new RenderDirtyBombFactory());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityThermalBlast.class, new RenderThermalBlastFactory());
|
||||||
|
RenderingRegistry.registerEntityRenderingHandler(EntityBlackHole.class, new RenderBlackHoleFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(FMLInitializationEvent event) {
|
||||||
|
super.init(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void postInit(FMLPostInitializationEvent postEvent) {
|
||||||
|
super.postInit(postEvent);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class RenderSmallNukeMK3Factory implements IRenderFactory<EntityNuclearCloud> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Render<? super EntityNuclearCloud> createRenderFor(RenderManager manager) {
|
||||||
|
return new RenderNuclearExplosion(manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class RenderBlackHoleFactory implements IRenderFactory<EntityBlackHole> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Render<? super EntityBlackHole> createRenderFor(RenderManager manager) {
|
||||||
|
return new RenderBlackHole(manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public class RenderDirtyBombFactory implements IRenderFactory<EntityDirtyBomb> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Render<? super EntityDirtyBomb> createRenderFor(RenderManager manager) {
|
||||||
|
return new RenderPrimedDirtyBomb(manager);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class NuclearRender
|
||||||
|
{
|
||||||
|
@SubscribeEvent(priority = EventPriority.LOWEST)
|
||||||
|
public void renderNuclearEffects(RenderWorldLastEvent event)
|
||||||
|
{
|
||||||
|
List<Entity> list = Minecraft.getMinecraft().world.loadedEntityList;
|
||||||
|
//nukeEffects = true;
|
||||||
|
for(Entity entity : list) {
|
||||||
|
if(entity instanceof INuclearEffect)
|
||||||
|
{
|
||||||
|
float partialTicks = Minecraft.getMinecraft().getRenderPartialTicks();
|
||||||
|
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
|
||||||
|
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double) partialTicks;
|
||||||
|
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double) partialTicks;
|
||||||
|
float f = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
|
||||||
|
Entity entity2 = Minecraft.getMinecraft().getRenderViewEntity();
|
||||||
|
double d3 = entity2.lastTickPosX + (entity2.posX - entity2.lastTickPosX) * (double) partialTicks;
|
||||||
|
double d4 = entity2.lastTickPosY + (entity2.posY - entity2.lastTickPosY) * (double) partialTicks;
|
||||||
|
double d5 = entity2.lastTickPosZ + (entity2.posZ - entity2.lastTickPosZ) * (double) partialTicks;
|
||||||
|
|
||||||
|
Render<Entity> render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(entity);
|
||||||
|
render.doRender(entity, d0 - d3, d1 - d4, d2 - d5, f, partialTicks);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//nukeEffects = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerFluidBlockRendering(Block block, String name)
|
||||||
|
{
|
||||||
|
super.registerFluidBlockRendering(block, name);
|
||||||
|
FluidStateMapper mapper = new FluidStateMapper(name);
|
||||||
|
|
||||||
|
Item item = Item.getItemFromBlock(block);
|
||||||
|
ModelBakery.registerItemVariants(item);
|
||||||
|
ModelLoader.setCustomMeshDefinition(item, mapper);
|
||||||
|
|
||||||
|
// ModelLoader.setCustomStateMapper(block, new
|
||||||
|
// StateMap.Builder().ignore(block.LEVEL).build());
|
||||||
|
ModelLoader.setCustomStateMapper(block, mapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class FluidStateMapper extends StateMapperBase implements ItemMeshDefinition
|
||||||
|
{
|
||||||
|
public final ModelResourceLocation location;
|
||||||
|
|
||||||
|
public FluidStateMapper(String name)
|
||||||
|
{
|
||||||
|
location = new ModelResourceLocation(Global.MOD_ID + ":fluids", name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ModelResourceLocation getModelResourceLocation(IBlockState state)
|
||||||
|
{
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||||
|
{
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
89
src/main/java/trinity/proxy/CommonProxy.java
Normal file
89
src/main/java/trinity/proxy/CommonProxy.java
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
package trinity.proxy;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import com.google.common.collect.Ordering;
|
||||||
|
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import nc.recipe.NCRecipes;
|
||||||
|
import nc.recipe.ingredient.OreIngredient;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.fluid.TrinityFluids;
|
||||||
|
import trinity.gui.GuiHandlerRegistry;
|
||||||
|
import trinity.gui.GuiHandlerTrinity;
|
||||||
|
//import trinity.fluid.TrinityFluids;
|
||||||
|
import trinity.handler.OredictHandler;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
import trinity.init.TrinityEntities;
|
||||||
|
import trinity.init.TrinityRecipes;
|
||||||
|
import trinity.radiation.RadiationHandler;
|
||||||
|
import trinity.tiles.TileEntityShieldedContainer;
|
||||||
|
import trinity.world.TrinityBiomes;
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fluids.FluidRegistry;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLModIdMappingEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
|
||||||
|
import net.minecraftforge.fml.common.network.IGuiHandler;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||||
|
|
||||||
|
public class CommonProxy {
|
||||||
|
|
||||||
|
public void preInit(FMLPreInitializationEvent preEvent) {
|
||||||
|
ModItems.init();
|
||||||
|
TrinityFluids.registerFluids();
|
||||||
|
TrinityFluids.init();
|
||||||
|
TrinityFluids.register();
|
||||||
|
ModBlocks.init();
|
||||||
|
ModItems.register();
|
||||||
|
ModBlocks.register();
|
||||||
|
OredictHandler.registerOres();
|
||||||
|
MinecraftForge.EVENT_BUS.register(new TrinityRecipes());
|
||||||
|
GuiHandlerRegistry.getInstance().registerGuiHandler(new GuiHandlerTrinity(), GuiHandlerTrinity.getGuiID());
|
||||||
|
GameRegistry.registerTileEntity(TileEntityShieldedContainer.class, "trinity:tile_inventory_basic");
|
||||||
|
//TrinityRecipes.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerRenderInfo()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void init(FMLInitializationEvent event) {
|
||||||
|
RadiationHandler.radiation();
|
||||||
|
//TrinityRecipes.init();
|
||||||
|
TrinityEntities.register();
|
||||||
|
TrinityBiomes.initBiomeManagerAndDictionary();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void postInit(FMLPostInitializationEvent postEvent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onIdMapping(FMLModIdMappingEvent idMappingEvent)
|
||||||
|
{
|
||||||
|
//QMDRecipes.refreshRecipeCaches();
|
||||||
|
RadiationHandler.radiation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerRenders() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerFluidBlockRendering(Block block, String name)
|
||||||
|
{
|
||||||
|
name = name.toLowerCase(Locale.ROOT);
|
||||||
|
}
|
||||||
|
}
|
26
src/main/java/trinity/radiation/FalloutEffects.java
Normal file
26
src/main/java/trinity/radiation/FalloutEffects.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package trinity.radiation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.recipe.ProcessorRecipeHandler;
|
||||||
|
|
||||||
|
public class FalloutEffects extends ProcessorRecipeHandler {
|
||||||
|
|
||||||
|
public FalloutEffects() {
|
||||||
|
super("falloutEffects", 1, 0, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecipes() {
|
||||||
|
addRecipe("dirt", NCBlocks.wasteland_earth, 0, 100, 1, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List fixExtras(List extras) {
|
||||||
|
List fixed = new ArrayList(1);
|
||||||
|
fixed.add(extras.size() > 0 && extras.get(0) instanceof Double ? (double) extras.get(0) : 0D);
|
||||||
|
return fixed;
|
||||||
|
}
|
||||||
|
}
|
26
src/main/java/trinity/radiation/FalloutHandler.java
Normal file
26
src/main/java/trinity/radiation/FalloutHandler.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package trinity.radiation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
|
||||||
|
|
||||||
|
/*public class FalloutHandler extends ProcessorRecipeHandler {
|
||||||
|
|
||||||
|
public FalloutHandler() {
|
||||||
|
super("falloutEffects", 1, 0, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addRecipes() {
|
||||||
|
addRecipe("dirt", NCBlocks.wasteland_earth, 0, 100, 1, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List fixExtras(List extras) {
|
||||||
|
List fixed = new ArrayList(1);
|
||||||
|
fixed.add(extras.size() > 0 && extras.get(0) instanceof Double ? (double) extras.get(0) : 0D);
|
||||||
|
return fixed;
|
||||||
|
}
|
||||||
|
}*/
|
29
src/main/java/trinity/radiation/FalloutSaveStructure.java
Normal file
29
src/main/java/trinity/radiation/FalloutSaveStructure.java
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
package trinity.radiation;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
|
public class FalloutSaveStructure {
|
||||||
|
public int chunkX;
|
||||||
|
public int chunkY;
|
||||||
|
public float radiation;
|
||||||
|
|
||||||
|
public FalloutSaveStructure() { }
|
||||||
|
|
||||||
|
public FalloutSaveStructure(int x, int y, float rad) {
|
||||||
|
chunkX = x;
|
||||||
|
chunkY = y;
|
||||||
|
radiation = rad;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void readFromNBT(NBTTagCompound nbt, int index) {
|
||||||
|
chunkX = nbt.getInteger("rad_" + index + "_x");
|
||||||
|
chunkY = nbt.getInteger("rad_" + index + "_y");
|
||||||
|
radiation = nbt.getFloat("rad_" + index + "_level");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeToNBT(NBTTagCompound nbt, int index) {
|
||||||
|
nbt.setInteger("rad_" + index + "_x", chunkX);
|
||||||
|
nbt.setInteger("rad_" + index + "_y", chunkY);
|
||||||
|
nbt.setFloat("rad_" + index + "_level", radiation);
|
||||||
|
}
|
||||||
|
}
|
238
src/main/java/trinity/radiation/FalloutSavedData.java
Normal file
238
src/main/java/trinity/radiation/FalloutSavedData.java
Normal file
|
@ -0,0 +1,238 @@
|
||||||
|
package trinity.radiation;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import nc.config.NCConfig;
|
||||||
|
|
||||||
|
//import com.hbm.config.GeneralConfig;
|
||||||
|
//import com.hbm.config.RadiationConfig;
|
||||||
|
//import com.hbm.packet.AuxParticlePacket;
|
||||||
|
//import com.hbm.packet.PacketDispatcher;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.ChunkPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.chunk.Chunk;
|
||||||
|
import net.minecraft.world.storage.WorldSavedData;
|
||||||
|
import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
|
|
||||||
|
public class FalloutSavedData extends WorldSavedData {
|
||||||
|
public Map<ChunkPos, FalloutSaveStructure> contamination = new HashMap<ChunkPos, FalloutSaveStructure>();
|
||||||
|
|
||||||
|
//in order to reduce read operations
|
||||||
|
//Drillgon200: I'm pretty sure this doesn't actually help since all the world saved datas are cached in a map anyway...
|
||||||
|
private static FalloutSavedData openInstance;
|
||||||
|
|
||||||
|
public World worldObj;
|
||||||
|
|
||||||
|
public FalloutSavedData(String p_i2141_1_) {
|
||||||
|
super(p_i2141_1_);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FalloutSavedData(World p_i1678_1_)
|
||||||
|
{
|
||||||
|
super("fallout");
|
||||||
|
this.worldObj = p_i1678_1_;
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean doesEntryExist(int x, int y) {
|
||||||
|
|
||||||
|
return getRadFromCoord(x, y) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createEntry(int x, int y, float rad) {
|
||||||
|
|
||||||
|
contamination.put(new ChunkPos(x, y), new FalloutSaveStructure(x, y, rad));
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteEntry(FalloutSaveStructure struct) {
|
||||||
|
|
||||||
|
contamination.remove(struct);
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void jettisonData() {
|
||||||
|
|
||||||
|
contamination.clear();
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadForCoord(int x, int y, float radiation) {
|
||||||
|
ChunkPos pos = new ChunkPos(x, y);
|
||||||
|
FalloutSaveStructure entry = contamination.get(pos);
|
||||||
|
|
||||||
|
if(entry == null) {
|
||||||
|
|
||||||
|
entry = new FalloutSaveStructure(x, y, radiation);
|
||||||
|
contamination.put(pos, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.radiation = radiation;
|
||||||
|
this.markDirty();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public FalloutSaveStructure getRadFromCoord(int x, int y) {
|
||||||
|
ChunkPos pos = new ChunkPos(x, y);
|
||||||
|
return contamination.get(pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getRadNumFromCoord(int x, int y) {
|
||||||
|
ChunkPos pos = new ChunkPos(x, y);
|
||||||
|
FalloutSaveStructure rad = contamination.get(pos);
|
||||||
|
if(rad != null)
|
||||||
|
return rad.radiation;
|
||||||
|
return 0F;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateSystem() {
|
||||||
|
|
||||||
|
Map<ChunkPos, FalloutSaveStructure> tempList = new HashMap<ChunkPos, FalloutSaveStructure>(contamination);
|
||||||
|
|
||||||
|
contamination.clear();
|
||||||
|
|
||||||
|
for(FalloutSaveStructure struct : tempList.values()) {
|
||||||
|
|
||||||
|
if(struct.radiation != 0) {
|
||||||
|
|
||||||
|
//struct.radiation *= 0.999F;
|
||||||
|
struct.radiation *= 0.999F;
|
||||||
|
struct.radiation -= 0.05F;
|
||||||
|
|
||||||
|
if(struct.radiation <= 0) {
|
||||||
|
struct.radiation = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*if(struct.radiation > RadiationConfig.fogRad && worldObj != null && worldObj.rand.nextInt(RadiationConfig.fogCh) == 0 && worldObj.getChunkFromChunkCoords(struct.chunkX, struct.chunkY).isLoaded()) {
|
||||||
|
|
||||||
|
int x = struct.chunkX * 16 + worldObj.rand.nextInt(16);
|
||||||
|
int z = struct.chunkY * 16 + worldObj.rand.nextInt(16);
|
||||||
|
int y = worldObj.getHeight(x, z) + worldObj.rand.nextInt(5);
|
||||||
|
|
||||||
|
//EntityFogFX fog = new EntityFogFX(worldObj);
|
||||||
|
//fog.setPosition(x, y, z);
|
||||||
|
//System.out.println(x + " " + y + " " + z);
|
||||||
|
//worldObj.spawnEntity(fog);
|
||||||
|
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacket(x, y, z, 3), new TargetPoint(worldObj.provider.getDimension(), x, y, z, 100));
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(struct.radiation > 1) {
|
||||||
|
|
||||||
|
float[] rads = new float[9];
|
||||||
|
|
||||||
|
rads[0] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY + 1);
|
||||||
|
rads[1] = getRadNumFromCoord(struct.chunkX, struct.chunkY + 1);
|
||||||
|
rads[2] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY + 1);
|
||||||
|
rads[3] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY);
|
||||||
|
rads[4] = getRadNumFromCoord(struct.chunkX - 1, struct.chunkY - 1);
|
||||||
|
rads[5] = getRadNumFromCoord(struct.chunkX, struct.chunkY - 1);
|
||||||
|
rads[6] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY - 1);
|
||||||
|
rads[7] = getRadNumFromCoord(struct.chunkX + 1, struct.chunkY);
|
||||||
|
rads[8] = getRadNumFromCoord(struct.chunkX, struct.chunkY);
|
||||||
|
|
||||||
|
float main = 0.6F;
|
||||||
|
float side = 0.075F;
|
||||||
|
float corner = 0.025F;
|
||||||
|
|
||||||
|
setRadForCoord(struct.chunkX + 1, struct.chunkY + 1, rads[0] + struct.radiation * corner);
|
||||||
|
setRadForCoord(struct.chunkX, struct.chunkY + 1, rads[1] + struct.radiation * side);
|
||||||
|
setRadForCoord(struct.chunkX - 1, struct.chunkY + 1, rads[2] + struct.radiation * corner);
|
||||||
|
setRadForCoord(struct.chunkX - 1, struct.chunkY, rads[3] + struct.radiation * side);
|
||||||
|
setRadForCoord(struct.chunkX - 1, struct.chunkY - 1, rads[4] + struct.radiation * corner);
|
||||||
|
setRadForCoord(struct.chunkX, struct.chunkY - 1, rads[5] + struct.radiation * side);
|
||||||
|
setRadForCoord(struct.chunkX + 1, struct.chunkY - 1, rads[6] + struct.radiation * corner);
|
||||||
|
setRadForCoord(struct.chunkX + 1, struct.chunkY, rads[7] + struct.radiation * side);
|
||||||
|
setRadForCoord(struct.chunkX, struct.chunkY, rads[8] + struct.radiation * main);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
this.setRadForCoord(struct.chunkX, struct.chunkY, getRadNumFromCoord(struct.chunkX, struct.chunkY) + struct.radiation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
|
if(!NCConfig.radiation_enabled_public) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int count = nbt.getInteger("falloutLevel");
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
|
FalloutSaveStructure struct = new FalloutSaveStructure();
|
||||||
|
struct.readFromNBT(nbt, i);
|
||||||
|
|
||||||
|
contamination.put(new ChunkPos(struct.chunkX, struct.chunkY), struct);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound nbt) {
|
||||||
|
nbt.setInteger("falloutLevel", contamination.size());
|
||||||
|
int i = 0;
|
||||||
|
Iterator<FalloutSaveStructure> itr = contamination.values().iterator();
|
||||||
|
while(itr.hasNext()){
|
||||||
|
itr.next().writeToNBT(nbt, i);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return nbt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static FalloutSavedData getData(World worldObj) {
|
||||||
|
|
||||||
|
if(openInstance != null && openInstance.worldObj == worldObj)
|
||||||
|
return openInstance;
|
||||||
|
|
||||||
|
FalloutSavedData data = (FalloutSavedData)worldObj.getPerWorldStorage().getOrLoadData(FalloutSavedData.class, "fallout");
|
||||||
|
if(data == null) {
|
||||||
|
worldObj.getPerWorldStorage().setData("fallout", new FalloutSavedData(worldObj));
|
||||||
|
|
||||||
|
data = (FalloutSavedData)worldObj.getPerWorldStorage().getOrLoadData(FalloutSavedData.class, "fallout");
|
||||||
|
}
|
||||||
|
|
||||||
|
data.worldObj = worldObj;
|
||||||
|
openInstance = data;
|
||||||
|
|
||||||
|
return openInstance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void incrementRad(World worldObj, int x, int z, float rad, float maxRad) {
|
||||||
|
|
||||||
|
FalloutSavedData data = getData(worldObj);
|
||||||
|
|
||||||
|
Chunk chunk = worldObj.getChunk(new BlockPos(x, -1, z));
|
||||||
|
|
||||||
|
float r = data.getRadNumFromCoord(chunk.x, chunk.z);
|
||||||
|
|
||||||
|
if(r < maxRad) {
|
||||||
|
|
||||||
|
data.setRadForCoord(chunk.x, chunk.z, r + rad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void decrementRad(World worldObj, int x, int z, float rad) {
|
||||||
|
|
||||||
|
FalloutSavedData data = getData(worldObj);
|
||||||
|
|
||||||
|
Chunk chunk = worldObj.getChunk(new BlockPos(x, -1, z));
|
||||||
|
|
||||||
|
float r = data.getRadNumFromCoord(chunk.x, chunk.z);
|
||||||
|
|
||||||
|
r -= rad;
|
||||||
|
|
||||||
|
if(r > 0) {
|
||||||
|
data.setRadForCoord(chunk.x, chunk.z, r);
|
||||||
|
} else {
|
||||||
|
data.setRadForCoord(chunk.x, chunk.z, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
128
src/main/java/trinity/radiation/RadiationHandler.java
Normal file
128
src/main/java/trinity/radiation/RadiationHandler.java
Normal file
|
@ -0,0 +1,128 @@
|
||||||
|
package trinity.radiation;
|
||||||
|
|
||||||
|
import nc.radiation.RadArmor;
|
||||||
|
import nc.radiation.RadBiomes;
|
||||||
|
import nc.radiation.RadSources;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
import trinity.world.TrinityBiomes;
|
||||||
|
import net.minecraft.client.util.RecipeItemHelper;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.oredict.OreDictionary;
|
||||||
|
|
||||||
|
public class RadiationHandler {
|
||||||
|
|
||||||
|
public static final double INITIATOR = RadSources.POLONIUM/1000;
|
||||||
|
|
||||||
|
public static final double D_T = RadSources.TRITIUM/2;
|
||||||
|
|
||||||
|
public static final double URANIUM_233_PIT = RadSources.getFuelRadiation(RadSources.URANIUM_233, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double URANIUM_235_PIT = RadSources.getFuelRadiation(RadSources.URANIUM_235, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double NEPTUNIUM_237_PIT = RadSources.getFuelRadiation(RadSources.NEPTUNIUM_237, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double PLUTONIUM_239_PIT = RadSources.getFuelRadiation(RadSources.PLUTONIUM_239, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double AMERICIUM_242_PIT = RadSources.getFuelRadiation(RadSources.AMERICIUM_242, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double CURIUM_247_PIT = RadSources.getFuelRadiation(RadSources.CURIUM_247, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double BERKELIUM_248_PIT = RadSources.getFuelRadiation(RadSources.BERKELIUM_248, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double CALIFORNIUM_249_PIT = RadSources.getFuelRadiation(RadSources.CALIFORNIUM_249, 8, (INITIATOR/900), 1);
|
||||||
|
public static final double CALIFORNIUM_251_PIT = RadSources.getFuelRadiation(RadSources.CALIFORNIUM_251, 8, (INITIATOR/900), 1);
|
||||||
|
|
||||||
|
public static final double URANIUM_233_CORE = ((URANIUM_233_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double URANIUM_235_CORE = ((URANIUM_235_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double NEPTUNIUM_237_CORE = ((NEPTUNIUM_237_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double PLUTONIUM_239_CORE = ((PLUTONIUM_239_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double AMERICIUM_242_CORE = ((AMERICIUM_242_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double CURIUM_247_CORE = ((CURIUM_247_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double BERKELIUM_248_CORE = ((BERKELIUM_248_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double CALIFORNIUM_249_CORE = ((CALIFORNIUM_249_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
public static final double CALIFORNIUM_251_CORE = ((CALIFORNIUM_251_PIT/1000)+(RadSources.URANIUM_238*8));
|
||||||
|
|
||||||
|
public static final double URANIUM_233_BOMB = (URANIUM_233_CORE/100);
|
||||||
|
public static final double URANIUM_235_BOMB = (URANIUM_235_CORE/100);
|
||||||
|
public static final double NEPTUNIUM_237_BOMB = (NEPTUNIUM_237_CORE/100);
|
||||||
|
public static final double PLUTONIUM_239_BOMB = (PLUTONIUM_239_CORE/100);
|
||||||
|
public static final double AMERICIUM_242_BOMB = (AMERICIUM_242_CORE/100);
|
||||||
|
public static final double CURIUM_247_BOMB = (CURIUM_247_CORE/100);
|
||||||
|
public static final double BERKELIUM_248_BOMB = (BERKELIUM_248_CORE/100);
|
||||||
|
public static final double CALIFORNIUM_249_BOMB = (CALIFORNIUM_249_CORE/100);
|
||||||
|
public static final double CALIFORNIUM_251_BOMB = (CALIFORNIUM_251_CORE/100);
|
||||||
|
|
||||||
|
public static final double TRINITITE = 0.0001;
|
||||||
|
public static final double SALTED_EARTH = 1;
|
||||||
|
public static final double NUCLEAR_CRATER = 0.5;
|
||||||
|
public static final double HEAVY_SALTED_EARTH = 5;
|
||||||
|
public static final double CONTAMINATED_OCEAN = 0.001;
|
||||||
|
public static final double GOLD_198 = 135.428;
|
||||||
|
|
||||||
|
public static void radiation(){
|
||||||
|
|
||||||
|
RadSources.put(INITIATOR, ModItems.neutron_initiator);
|
||||||
|
|
||||||
|
RadSources.put(URANIUM_233_PIT, ModItems.bomb_pit_u233);
|
||||||
|
RadSources.put(URANIUM_235_PIT, ModItems.bomb_pit_u235);
|
||||||
|
RadSources.put(NEPTUNIUM_237_PIT, ModItems.bomb_pit_np237);
|
||||||
|
RadSources.put(PLUTONIUM_239_PIT, ModItems.bomb_pit_pu239);
|
||||||
|
RadSources.put(AMERICIUM_242_PIT, ModItems.bomb_pit_am242);
|
||||||
|
RadSources.put(CURIUM_247_PIT, ModItems.bomb_pit_cm247);
|
||||||
|
RadSources.put(BERKELIUM_248_PIT, ModItems.bomb_pit_bk248);
|
||||||
|
RadSources.put(CALIFORNIUM_249_PIT, ModItems.bomb_pit_cf249);
|
||||||
|
RadSources.put(CALIFORNIUM_251_PIT, ModItems.bomb_pit_cf251);
|
||||||
|
|
||||||
|
RadSources.put(URANIUM_233_CORE, ModBlocks.core_u233);
|
||||||
|
RadSources.put(URANIUM_235_CORE, ModBlocks.core_u235);
|
||||||
|
RadSources.put(NEPTUNIUM_237_CORE, ModBlocks.core_np237);
|
||||||
|
RadSources.put(PLUTONIUM_239_CORE, ModBlocks.core_pu239);
|
||||||
|
RadSources.put(AMERICIUM_242_CORE, ModBlocks.core_am242);
|
||||||
|
RadSources.put(CURIUM_247_CORE, ModBlocks.core_cm247);
|
||||||
|
RadSources.put(BERKELIUM_248_CORE, ModBlocks.core_bk248);
|
||||||
|
RadSources.put(CALIFORNIUM_249_CORE, ModBlocks.core_cf249);
|
||||||
|
RadSources.put(CALIFORNIUM_251_CORE, ModBlocks.core_cf251);
|
||||||
|
|
||||||
|
RadSources.put(URANIUM_233_CORE, ModBlocks.salted_core_u233);
|
||||||
|
RadSources.put(URANIUM_235_CORE, ModBlocks.salted_core_u235);
|
||||||
|
RadSources.put(NEPTUNIUM_237_CORE, ModBlocks.salted_core_np237);
|
||||||
|
RadSources.put(PLUTONIUM_239_CORE, ModBlocks.salted_core_pu239);
|
||||||
|
RadSources.put(AMERICIUM_242_CORE, ModBlocks.salted_core_am242);
|
||||||
|
RadSources.put(CURIUM_247_CORE, ModBlocks.salted_core_cm247);
|
||||||
|
RadSources.put(BERKELIUM_248_CORE, ModBlocks.salted_core_bk248);
|
||||||
|
RadSources.put(CALIFORNIUM_249_CORE, ModBlocks.salted_core_cf249);
|
||||||
|
RadSources.put(CALIFORNIUM_251_CORE, ModBlocks.salted_core_cf251);
|
||||||
|
|
||||||
|
RadSources.put(URANIUM_233_BOMB, ModBlocks.bomb_u233);
|
||||||
|
RadSources.put(URANIUM_235_BOMB, ModBlocks.bomb_u235);
|
||||||
|
RadSources.put(NEPTUNIUM_237_BOMB, ModBlocks.bomb_np237);
|
||||||
|
RadSources.put(PLUTONIUM_239_BOMB, ModBlocks.bomb_pu239);
|
||||||
|
RadSources.put(AMERICIUM_242_BOMB, ModBlocks.bomb_am242);
|
||||||
|
RadSources.put(CURIUM_247_BOMB, ModBlocks.bomb_cm247);
|
||||||
|
RadSources.put(BERKELIUM_248_BOMB, ModBlocks.bomb_bk248);
|
||||||
|
RadSources.put(CALIFORNIUM_249_BOMB, ModBlocks.bomb_cf249);
|
||||||
|
RadSources.put(CALIFORNIUM_251_BOMB, ModBlocks.bomb_cf251);
|
||||||
|
|
||||||
|
RadSources.put(URANIUM_233_BOMB, ModBlocks.salted_bomb_u233);
|
||||||
|
RadSources.put(URANIUM_235_BOMB, ModBlocks.salted_bomb_u235);
|
||||||
|
RadSources.put(NEPTUNIUM_237_BOMB, ModBlocks.salted_bomb_np237);
|
||||||
|
RadSources.put(PLUTONIUM_239_BOMB, ModBlocks.salted_bomb_pu239);
|
||||||
|
RadSources.put(AMERICIUM_242_BOMB, ModBlocks.salted_bomb_am242);
|
||||||
|
RadSources.put(CURIUM_247_BOMB, ModBlocks.salted_bomb_cm247);
|
||||||
|
RadSources.put(BERKELIUM_248_BOMB, ModBlocks.salted_bomb_bk248);
|
||||||
|
RadSources.put(CALIFORNIUM_249_BOMB, ModBlocks.salted_bomb_cf249);
|
||||||
|
RadSources.put(CALIFORNIUM_251_BOMB, ModBlocks.salted_bomb_cf251);
|
||||||
|
|
||||||
|
RadSources.putOre(TRINITITE, "oreTrinitite");
|
||||||
|
RadSources.putOre(TRINITITE*9, "blockTrinitite");
|
||||||
|
RadSources.putOre(TRINITITE, "gemTrinitite");
|
||||||
|
RadSources.putOre(SALTED_EARTH, "blockRadioactiveEarth");
|
||||||
|
RadSources.putOre(SALTED_EARTH, "blockRadioactiveSand");
|
||||||
|
RadSources.putOre(HEAVY_SALTED_EARTH, "blockHighlyRadioactiveEarth");
|
||||||
|
RadSources.putOre(HEAVY_SALTED_EARTH, "blockHighlyRadioactiveSand");
|
||||||
|
RadSources.putMaterial(GOLD_198, "Gold198");
|
||||||
|
//RadSources.putOre(GOLD_198, "dustGold198");
|
||||||
|
RadSources.put(RadSources.PLUTONIUM_239*3, ModBlocks.thermonuclear_core_pu239);
|
||||||
|
RadSources.put(RadSources.CAESIUM_137/10, ModBlocks.dirty_bomb);
|
||||||
|
RadSources.put(GOLD_198/10, ModBlocks.gold_bomb);
|
||||||
|
RadBiomes.RAD_MAP.put(TrinityBiomes.NUCLEAR_CRATER, NUCLEAR_CRATER);
|
||||||
|
RadBiomes.RAD_MAP.put(TrinityBiomes.CONTAMINATED_OCEAN, CONTAMINATED_OCEAN);
|
||||||
|
RadSources.putFluid(D_T, "deuterium-tritium_mixture");
|
||||||
|
//RadSources.refreshRadSources();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
76
src/main/java/trinity/render/AdvancedModelLoader.java
Normal file
76
src/main/java/trinity/render/AdvancedModelLoader.java
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
package trinity.render;
|
||||||
|
// TODO: Move this package to net.minecraftforge.model in 1.8
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.common.FMLLog;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Common interface for advanced model loading from files, based on file suffix
|
||||||
|
* Model support can be queried through the {@link #getSupportedSuffixes()} method.
|
||||||
|
* Instances can be created by calling {@link #loadModel(String)} with a class-loadable-path
|
||||||
|
*
|
||||||
|
* @author cpw
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class AdvancedModelLoader {
|
||||||
|
private static Map<String, IModelCustomLoader> instances = Maps.newHashMap();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register a new model handler
|
||||||
|
* @param modelHandler The model handler to register
|
||||||
|
*/
|
||||||
|
public static void registerModelHandler(IModelCustomLoader modelHandler)
|
||||||
|
{
|
||||||
|
for (String suffix : modelHandler.getSuffixes())
|
||||||
|
{
|
||||||
|
instances.put(suffix, modelHandler);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the model from the supplied classpath resolvable resource name
|
||||||
|
* @param resource The resource name
|
||||||
|
* @return A model
|
||||||
|
* @throws IllegalArgumentException if the resource name cannot be understood
|
||||||
|
* @throws ModelFormatException if the underlying model handler cannot parse the model format
|
||||||
|
*/
|
||||||
|
public static IModelCustom loadModel(ResourceLocation resource) throws IllegalArgumentException, ModelFormatException
|
||||||
|
{
|
||||||
|
String name = resource.getPath();
|
||||||
|
int i = name.lastIndexOf('.');
|
||||||
|
if (i == -1)
|
||||||
|
{
|
||||||
|
FMLLog.severe("The resource name %s is not valid", resource);
|
||||||
|
throw new IllegalArgumentException("The resource name is not valid");
|
||||||
|
}
|
||||||
|
String suffix = name.substring(i+1);
|
||||||
|
IModelCustomLoader loader = instances.get(suffix);
|
||||||
|
if (loader == null)
|
||||||
|
{
|
||||||
|
FMLLog.severe("The resource name %s is not supported", resource);
|
||||||
|
throw new IllegalArgumentException("The resource name is not supported");
|
||||||
|
}
|
||||||
|
|
||||||
|
return loader.loadInstance(resource);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Collection<String> getSupportedSuffixes()
|
||||||
|
{
|
||||||
|
return instances.keySet();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
registerModelHandler(new ObjModelLoader());
|
||||||
|
// registerModelHandler(new TechneModelLoader());
|
||||||
|
}
|
||||||
|
}
|
84
src/main/java/trinity/render/Face.java
Normal file
84
src/main/java/trinity/render/Face.java
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
|
||||||
|
public class Face
|
||||||
|
{
|
||||||
|
public Vertex[] vertices;
|
||||||
|
public Vertex[] vertexNormals;
|
||||||
|
public Vertex faceNormal;
|
||||||
|
public TextureCoordinate[] textureCoordinates;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addFaceForRender(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
addFaceForRender(tessellator, 0.0005F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addFaceForRender(Tessellator tessellator, float textureOffset)
|
||||||
|
{
|
||||||
|
if (faceNormal == null)
|
||||||
|
{
|
||||||
|
faceNormal = this.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
|
||||||
|
tessellator.setNormal(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||||
|
|
||||||
|
float averageU = 0F;
|
||||||
|
float averageV = 0F;
|
||||||
|
|
||||||
|
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < textureCoordinates.length; ++i)
|
||||||
|
{
|
||||||
|
averageU += textureCoordinates[i].u;
|
||||||
|
averageV += textureCoordinates[i].v;
|
||||||
|
}
|
||||||
|
|
||||||
|
averageU = averageU / textureCoordinates.length;
|
||||||
|
averageV = averageV / textureCoordinates.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
float offsetU, offsetV;
|
||||||
|
|
||||||
|
for (int i = 0; i < vertices.length; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||||
|
{
|
||||||
|
offsetU = textureOffset;
|
||||||
|
offsetV = textureOffset;
|
||||||
|
|
||||||
|
if (textureCoordinates[i].u > averageU)
|
||||||
|
{
|
||||||
|
offsetU = -offsetU;
|
||||||
|
}
|
||||||
|
if (textureCoordinates[i].v > averageV)
|
||||||
|
{
|
||||||
|
offsetV = -offsetV;
|
||||||
|
}
|
||||||
|
|
||||||
|
tessellator.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tessellator.addVertex(vertices[i].x, vertices[i].y, vertices[i].z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vertex calculateFaceNormal()
|
||||||
|
{
|
||||||
|
Vec3 v1 = Vec3.createVectorHelper(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
|
||||||
|
Vec3 v2 = Vec3.createVectorHelper(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
|
||||||
|
Vec3 normalVector = null;
|
||||||
|
|
||||||
|
normalVector = v1.crossProduct(v2).normalize();
|
||||||
|
|
||||||
|
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
|
||||||
|
}
|
||||||
|
}
|
86
src/main/java/trinity/render/Face2.java
Normal file
86
src/main/java/trinity/render/Face2.java
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
import trinity.render.TextureCoordinate;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
import trinity.render.Vertex;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class Face2 {
|
||||||
|
public Vertex[] vertices;
|
||||||
|
public Vertex[] vertexNormals;
|
||||||
|
public Vertex faceNormal;
|
||||||
|
public TextureCoordinate[] textureCoordinates;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addFaceForRender(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
addFaceForRender(tessellator, 0.0005F);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void addFaceForRender(Tessellator tessellator, float textureOffset)
|
||||||
|
{
|
||||||
|
if (faceNormal == null)
|
||||||
|
{
|
||||||
|
faceNormal = this.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
|
||||||
|
tessellator.setNormal(faceNormal.x, faceNormal.y, faceNormal.z);
|
||||||
|
|
||||||
|
float averageU = 0F;
|
||||||
|
float averageV = 0F;
|
||||||
|
|
||||||
|
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < textureCoordinates.length; ++i)
|
||||||
|
{
|
||||||
|
averageU += textureCoordinates[i].u;
|
||||||
|
averageV += textureCoordinates[i].v;
|
||||||
|
}
|
||||||
|
|
||||||
|
averageU = averageU / textureCoordinates.length;
|
||||||
|
averageV = averageV / textureCoordinates.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
float offsetU, offsetV;
|
||||||
|
|
||||||
|
for (int i = 0; i < vertices.length; ++i)
|
||||||
|
{
|
||||||
|
|
||||||
|
if ((textureCoordinates != null) && (textureCoordinates.length > 0))
|
||||||
|
{
|
||||||
|
offsetU = textureOffset;
|
||||||
|
offsetV = textureOffset;
|
||||||
|
|
||||||
|
if (textureCoordinates[i].u > averageU)
|
||||||
|
{
|
||||||
|
offsetU = -offsetU;
|
||||||
|
}
|
||||||
|
if (textureCoordinates[i].v > averageV)
|
||||||
|
{
|
||||||
|
offsetV = -offsetV;
|
||||||
|
}
|
||||||
|
|
||||||
|
tessellator.addVertexWithUV(vertices[i].x, vertices[i].y, vertices[i].z, textureCoordinates[i].u + offsetU, textureCoordinates[i].v + offsetV + (((double)System.currentTimeMillis() % HmfController.modoloMod) / HmfController.quotientMod));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tessellator.addVertex(vertices[i].x, vertices[i].y, vertices[i].z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vertex calculateFaceNormal()
|
||||||
|
{
|
||||||
|
Vec3 v1 = Vec3.createVectorHelper(vertices[1].x - vertices[0].x, vertices[1].y - vertices[0].y, vertices[1].z - vertices[0].z);
|
||||||
|
Vec3 v2 = Vec3.createVectorHelper(vertices[2].x - vertices[0].x, vertices[2].y - vertices[0].y, vertices[2].z - vertices[0].z);
|
||||||
|
Vec3 normalVector = null;
|
||||||
|
|
||||||
|
normalVector = v1.crossProduct(v2).normalize();
|
||||||
|
|
||||||
|
return new Vertex((float) normalVector.xCoord, (float) normalVector.yCoord, (float) normalVector.zCoord);
|
||||||
|
}
|
||||||
|
}
|
55
src/main/java/trinity/render/GroupObject.java
Normal file
55
src/main/java/trinity/render/GroupObject.java
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
package trinity.render;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
import trinity.render.Face;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class GroupObject
|
||||||
|
{
|
||||||
|
public String name;
|
||||||
|
public ArrayList<Face> faces = new ArrayList<Face>();
|
||||||
|
public int glDrawingMode;
|
||||||
|
|
||||||
|
public GroupObject()
|
||||||
|
{
|
||||||
|
this("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupObject(String name)
|
||||||
|
{
|
||||||
|
this(name, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupObject(String name, int glDrawingMode)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.glDrawingMode = glDrawingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void render()
|
||||||
|
{
|
||||||
|
if (faces.size() > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawing(glDrawingMode);
|
||||||
|
render(tessellator);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void render(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
if (faces.size() > 0)
|
||||||
|
{
|
||||||
|
for (Face face : faces)
|
||||||
|
{
|
||||||
|
face.addFaceForRender(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
56
src/main/java/trinity/render/GroupObject2.java
Normal file
56
src/main/java/trinity/render/GroupObject2.java
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
|
||||||
|
public class GroupObject2 {
|
||||||
|
|
||||||
|
public String name;
|
||||||
|
public ArrayList<Face2> faces = new ArrayList<Face2>();
|
||||||
|
public int glDrawingMode;
|
||||||
|
|
||||||
|
public GroupObject2()
|
||||||
|
{
|
||||||
|
this("");
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupObject2(String name)
|
||||||
|
{
|
||||||
|
this(name, -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GroupObject2(String name, int glDrawingMode)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.glDrawingMode = glDrawingMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void render()
|
||||||
|
{
|
||||||
|
if (faces.size() > 0)
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawing(glDrawingMode);
|
||||||
|
render(tessellator);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void render(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
if (faces.size() > 0)
|
||||||
|
{
|
||||||
|
for (Face2 face : faces)
|
||||||
|
{
|
||||||
|
face.addFaceForRender(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
18
src/main/java/trinity/render/HmfController.java
Normal file
18
src/main/java/trinity/render/HmfController.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
public class HmfController {
|
||||||
|
|
||||||
|
public static double modoloMod = 100000D;
|
||||||
|
public static double quotientMod = 5000D;
|
||||||
|
|
||||||
|
public static void setMod(double modolo, double quotient) {
|
||||||
|
modoloMod = modolo;
|
||||||
|
quotientMod = quotient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void resetMod() {
|
||||||
|
modoloMod = 100000D;
|
||||||
|
quotientMod = 5000D;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
30
src/main/java/trinity/render/HmfModelLoader.java
Normal file
30
src/main/java/trinity/render/HmfModelLoader.java
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import trinity.render.IModelCustom;
|
||||||
|
import trinity.render.IModelCustomLoader;
|
||||||
|
import trinity.render.ModelFormatException;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class HmfModelLoader implements IModelCustomLoader {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "HMF model";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String[] types = { "hmf" };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getSuffixes()
|
||||||
|
{
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException
|
||||||
|
{
|
||||||
|
return new ModelObject(resource);
|
||||||
|
}
|
||||||
|
}
|
17
src/main/java/trinity/render/IModelCustom.java
Normal file
17
src/main/java/trinity/render/IModelCustom.java
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public interface IModelCustom
|
||||||
|
{
|
||||||
|
String getType();
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void renderAll();
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void renderOnly(String... groupNames);
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void renderPart(String partName);
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
void renderAllExcept(String... excludedGroupNames);
|
||||||
|
}
|
23
src/main/java/trinity/render/IModelCustomLoader.java
Normal file
23
src/main/java/trinity/render/IModelCustomLoader.java
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public interface IModelCustomLoader {
|
||||||
|
/**
|
||||||
|
* Get the main type name for this loader
|
||||||
|
* @return the type name
|
||||||
|
*/
|
||||||
|
String getType();
|
||||||
|
/**
|
||||||
|
* Get resource suffixes this model loader recognizes
|
||||||
|
* @return a list of suffixes
|
||||||
|
*/
|
||||||
|
String[] getSuffixes();
|
||||||
|
/**
|
||||||
|
* Load a model instance from the supplied path
|
||||||
|
* @param resource The ResourceLocation of the model
|
||||||
|
* @return A model instance
|
||||||
|
* @throws ModelFormatException if the model format is not correct
|
||||||
|
*/
|
||||||
|
IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException;
|
||||||
|
}
|
27
src/main/java/trinity/render/ModelFormatException.java
Normal file
27
src/main/java/trinity/render/ModelFormatException.java
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
public class ModelFormatException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 2023547503969671835L;
|
||||||
|
|
||||||
|
public ModelFormatException()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelFormatException(String message, Throwable cause)
|
||||||
|
{
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelFormatException(String message)
|
||||||
|
{
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelFormatException(Throwable cause)
|
||||||
|
{
|
||||||
|
super(cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
657
src/main/java/trinity/render/ModelObject.java
Normal file
657
src/main/java/trinity/render/ModelObject.java
Normal file
|
@ -0,0 +1,657 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import trinity.render.IModelCustom;
|
||||||
|
import trinity.render.ModelFormatException;
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
import trinity.render.TextureCoordinate;
|
||||||
|
import trinity.render.Vertex;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.IResource;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class ModelObject implements IModelCustom {
|
||||||
|
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||||
|
private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||||
|
private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+(\\.\\d+)?){2,3} *$)");
|
||||||
|
private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_Pattern = Pattern.compile("(f( \\d+){3,4} *\\n)|(f( \\d+){3,4} *$)");
|
||||||
|
private static Pattern groupObjectPattern = Pattern.compile("([go]( [\\w\\d\\.]+) *\\n)|([go]( [\\w\\d\\.]+) *$)");
|
||||||
|
|
||||||
|
private static Matcher vertexMatcher, vertexNormalMatcher, textureCoordinateMatcher;
|
||||||
|
private static Matcher face_V_VT_VN_Matcher, face_V_VT_Matcher, face_V_VN_Matcher, face_V_Matcher;
|
||||||
|
private static Matcher groupObjectMatcher;
|
||||||
|
|
||||||
|
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
||||||
|
public ArrayList<Vertex> vertexNormals = new ArrayList<Vertex>();
|
||||||
|
public ArrayList<TextureCoordinate> textureCoordinates = new ArrayList<TextureCoordinate>();
|
||||||
|
public ArrayList<GroupObject2> groupObjects = new ArrayList<GroupObject2>();
|
||||||
|
private GroupObject2 currentGroupObject;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
public ModelObject(ResourceLocation resource) throws ModelFormatException
|
||||||
|
{
|
||||||
|
this.fileName = resource.toString();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||||
|
loadObjModel(res.getInputStream());
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("IO Exception reading model format", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ModelObject(String filename, InputStream inputStream) throws ModelFormatException
|
||||||
|
{
|
||||||
|
this.fileName = filename;
|
||||||
|
loadObjModel(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadObjModel(InputStream inputStream) throws ModelFormatException
|
||||||
|
{
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
String currentLine = null;
|
||||||
|
int lineCount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
|
||||||
|
while ((currentLine = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
lineCount++;
|
||||||
|
currentLine = currentLine.replaceAll("\\s+", " ").trim();
|
||||||
|
|
||||||
|
if (currentLine.startsWith("#") || currentLine.length() == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("v "))
|
||||||
|
{
|
||||||
|
Vertex vertex = parseVertex(currentLine, lineCount);
|
||||||
|
if (vertex != null)
|
||||||
|
{
|
||||||
|
vertices.add(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("vn "))
|
||||||
|
{
|
||||||
|
Vertex vertex = parseVertexNormal(currentLine, lineCount);
|
||||||
|
if (vertex != null)
|
||||||
|
{
|
||||||
|
vertexNormals.add(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("vt "))
|
||||||
|
{
|
||||||
|
TextureCoordinate textureCoordinate = parseTextureCoordinate(currentLine, lineCount);
|
||||||
|
if (textureCoordinate != null)
|
||||||
|
{
|
||||||
|
textureCoordinates.add(textureCoordinate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("f "))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (currentGroupObject == null)
|
||||||
|
{
|
||||||
|
currentGroupObject = new GroupObject2("Default");
|
||||||
|
}
|
||||||
|
|
||||||
|
Face2 face = parseFace(currentLine, lineCount);
|
||||||
|
|
||||||
|
if (face != null)
|
||||||
|
{
|
||||||
|
currentGroupObject.faces.add(face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("g ") | currentLine.startsWith("o "))
|
||||||
|
{
|
||||||
|
GroupObject2 group = parseGroupObject(currentLine, lineCount);
|
||||||
|
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
if (currentGroupObject != null)
|
||||||
|
{
|
||||||
|
groupObjects.add(currentGroupObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
currentGroupObject = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
groupObjects.add(currentGroupObject);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("IO Exception reading model format", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// hush
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// hush
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderAll()
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
if (currentGroupObject != null)
|
||||||
|
{
|
||||||
|
tessellator.startDrawing(currentGroupObject.glDrawingMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tessellator.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
}
|
||||||
|
tessellateAll(tessellator);
|
||||||
|
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateAll(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderOnly(String... groupNames)
|
||||||
|
{
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
for (String groupName : groupNames)
|
||||||
|
{
|
||||||
|
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateOnly(Tessellator tessellator, String... groupNames) {
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
for (String groupName : groupNames)
|
||||||
|
{
|
||||||
|
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderPart(String partName)
|
||||||
|
{
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
if (partName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellatePart(Tessellator tessellator, String partName) {
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
if (partName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderAllExcept(String... excludedGroupNames)
|
||||||
|
{
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
boolean skipPart=false;
|
||||||
|
for (String excludedGroupName : excludedGroupNames)
|
||||||
|
{
|
||||||
|
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
skipPart=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!skipPart)
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames)
|
||||||
|
{
|
||||||
|
boolean exclude;
|
||||||
|
for (GroupObject2 groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
exclude=false;
|
||||||
|
for (String excludedGroupName : excludedGroupNames)
|
||||||
|
{
|
||||||
|
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
exclude=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!exclude)
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vertex parseVertex(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Vertex vertex = null;
|
||||||
|
|
||||||
|
if (isValidVertexLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 2)
|
||||||
|
{
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]));
|
||||||
|
}
|
||||||
|
else if (tokens.length == 3)
|
||||||
|
{
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vertex parseVertexNormal(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Vertex vertexNormal = null;
|
||||||
|
|
||||||
|
if (isValidVertexNormalLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 3)
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return vertexNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextureCoordinate parseTextureCoordinate(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
TextureCoordinate textureCoordinate = null;
|
||||||
|
|
||||||
|
if (isValidTextureCoordinateLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 2)
|
||||||
|
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]));
|
||||||
|
else if (tokens.length == 3)
|
||||||
|
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return textureCoordinate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Face2 parseFace(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Face2 face = null;
|
||||||
|
|
||||||
|
if (isValidFaceLine(line))
|
||||||
|
{
|
||||||
|
face = new Face2();
|
||||||
|
|
||||||
|
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = trimmedLine.split(" ");
|
||||||
|
String[] subTokens = null;
|
||||||
|
|
||||||
|
if (tokens.length == 3)
|
||||||
|
{
|
||||||
|
if (currentGroupObject.glDrawingMode == -1)
|
||||||
|
{
|
||||||
|
currentGroupObject.glDrawingMode = GL11.GL_TRIANGLES;
|
||||||
|
}
|
||||||
|
else if (currentGroupObject.glDrawingMode != GL11.GL_TRIANGLES)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 4, found " + tokens.length + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tokens.length == 4)
|
||||||
|
{
|
||||||
|
if (currentGroupObject.glDrawingMode == -1)
|
||||||
|
{
|
||||||
|
currentGroupObject.glDrawingMode = GL11.GL_QUADS;
|
||||||
|
}
|
||||||
|
else if (currentGroupObject.glDrawingMode != GL11.GL_QUADS)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 3, found " + tokens.length + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ...
|
||||||
|
if (isValidFace_V_VT_VN_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||||
|
face.vertexNormals = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("/");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[2]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||||
|
else if (isValidFace_V_VT_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("/");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1//vn1 v2//vn2 v3//vn3 ...
|
||||||
|
else if (isValidFace_V_VN_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.vertexNormals = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("//");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1 v2 v3 ...
|
||||||
|
else if (isValidFace_V_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupObject2 parseGroupObject(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
GroupObject2 group = null;
|
||||||
|
|
||||||
|
if (isValidGroupObjectLine(line))
|
||||||
|
{
|
||||||
|
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||||
|
|
||||||
|
if (trimmedLine.length() > 0)
|
||||||
|
{
|
||||||
|
group = new GroupObject2(trimmedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid vertex
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid vertex, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidVertexLine(String line)
|
||||||
|
{
|
||||||
|
if (vertexMatcher != null)
|
||||||
|
{
|
||||||
|
vertexMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
vertexMatcher = vertexPattern.matcher(line);
|
||||||
|
return vertexMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid vertex normal
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid vertex normal, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidVertexNormalLine(String line)
|
||||||
|
{
|
||||||
|
if (vertexNormalMatcher != null)
|
||||||
|
{
|
||||||
|
vertexNormalMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
vertexNormalMatcher = vertexNormalPattern.matcher(line);
|
||||||
|
return vertexNormalMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid texture coordinate
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid texture coordinate, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidTextureCoordinateLine(String line)
|
||||||
|
{
|
||||||
|
if (textureCoordinateMatcher != null)
|
||||||
|
{
|
||||||
|
textureCoordinateMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
textureCoordinateMatcher = textureCoordinatePattern.matcher(line);
|
||||||
|
return textureCoordinateMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices, texture coordinates, and vertex normals
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1/vt1/vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VT_VN_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VT_VN_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VT_VN_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VT_VN_Matcher = face_V_VT_VN_Pattern.matcher(line);
|
||||||
|
return face_V_VT_VN_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices and texture coordinates
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1/vt1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VT_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VT_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VT_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VT_Matcher = face_V_VT_Pattern.matcher(line);
|
||||||
|
return face_V_VT_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices and vertex normals
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1//vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VN_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VN_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VN_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VN_Matcher = face_V_VN_Pattern.matcher(line);
|
||||||
|
return face_V_VN_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by only vertices
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_Matcher = face_V_Pattern.matcher(line);
|
||||||
|
return face_V_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face of any of the possible face formats
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches any of the valid face formats, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFaceLine(String line)
|
||||||
|
{
|
||||||
|
return isValidFace_V_VT_VN_Line(line) || isValidFace_V_VT_Line(line) || isValidFace_V_VN_Line(line) || isValidFace_V_Line(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid group (or object)
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid group (or object), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidGroupObjectLine(String line)
|
||||||
|
{
|
||||||
|
if (groupObjectMatcher != null)
|
||||||
|
{
|
||||||
|
groupObjectMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
groupObjectMatcher = groupObjectPattern.matcher(line);
|
||||||
|
return groupObjectMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "hmf";
|
||||||
|
}
|
||||||
|
}
|
26
src/main/java/trinity/render/ObjModelLoader.java
Normal file
26
src/main/java/trinity/render/ObjModelLoader.java
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class ObjModelLoader implements IModelCustomLoader
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "OBJ model";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String[] types = { "obj" };
|
||||||
|
@Override
|
||||||
|
public String[] getSuffixes()
|
||||||
|
{
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IModelCustom loadInstance(ResourceLocation resource) throws ModelFormatException
|
||||||
|
{
|
||||||
|
return new WavefrontObject(resource);
|
||||||
|
}
|
||||||
|
}
|
66
src/main/java/trinity/render/QuadComparator.java
Normal file
66
src/main/java/trinity/render/QuadComparator.java
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import java.util.Comparator;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class QuadComparator implements Comparator
|
||||||
|
{
|
||||||
|
private float field_147630_a;
|
||||||
|
private float field_147628_b;
|
||||||
|
private float field_147629_c;
|
||||||
|
private int[] field_147627_d;
|
||||||
|
private static final String __OBFID = "CL_00000958";
|
||||||
|
|
||||||
|
public QuadComparator(int[] p_i45077_1_, float p_i45077_2_, float p_i45077_3_, float p_i45077_4_)
|
||||||
|
{
|
||||||
|
this.field_147627_d = p_i45077_1_;
|
||||||
|
this.field_147630_a = p_i45077_2_;
|
||||||
|
this.field_147628_b = p_i45077_3_;
|
||||||
|
this.field_147629_c = p_i45077_4_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compare(Integer p_compare_1_, Integer p_compare_2_)
|
||||||
|
{
|
||||||
|
float f = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue()]) - this.field_147630_a;
|
||||||
|
float f1 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 1]) - this.field_147628_b;
|
||||||
|
float f2 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 2]) - this.field_147629_c;
|
||||||
|
float f3 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 8]) - this.field_147630_a;
|
||||||
|
float f4 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 9]) - this.field_147628_b;
|
||||||
|
float f5 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 10]) - this.field_147629_c;
|
||||||
|
float f6 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 16]) - this.field_147630_a;
|
||||||
|
float f7 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 17]) - this.field_147628_b;
|
||||||
|
float f8 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 18]) - this.field_147629_c;
|
||||||
|
float f9 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 24]) - this.field_147630_a;
|
||||||
|
float f10 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 25]) - this.field_147628_b;
|
||||||
|
float f11 = Float.intBitsToFloat(this.field_147627_d[p_compare_1_.intValue() + 26]) - this.field_147629_c;
|
||||||
|
float f12 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue()]) - this.field_147630_a;
|
||||||
|
float f13 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 1]) - this.field_147628_b;
|
||||||
|
float f14 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 2]) - this.field_147629_c;
|
||||||
|
float f15 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 8]) - this.field_147630_a;
|
||||||
|
float f16 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 9]) - this.field_147628_b;
|
||||||
|
float f17 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 10]) - this.field_147629_c;
|
||||||
|
float f18 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 16]) - this.field_147630_a;
|
||||||
|
float f19 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 17]) - this.field_147628_b;
|
||||||
|
float f20 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 18]) - this.field_147629_c;
|
||||||
|
float f21 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 24]) - this.field_147630_a;
|
||||||
|
float f22 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 25]) - this.field_147628_b;
|
||||||
|
float f23 = Float.intBitsToFloat(this.field_147627_d[p_compare_2_.intValue() + 26]) - this.field_147629_c;
|
||||||
|
float f24 = (f + f3 + f6 + f9) * 0.25F;
|
||||||
|
float f25 = (f1 + f4 + f7 + f10) * 0.25F;
|
||||||
|
float f26 = (f2 + f5 + f8 + f11) * 0.25F;
|
||||||
|
float f27 = (f12 + f15 + f18 + f21) * 0.25F;
|
||||||
|
float f28 = (f13 + f16 + f19 + f22) * 0.25F;
|
||||||
|
float f29 = (f14 + f17 + f20 + f23) * 0.25F;
|
||||||
|
float f30 = f24 * f24 + f25 * f25 + f26 * f26;
|
||||||
|
float f31 = f27 * f27 + f28 * f28 + f29 * f29;
|
||||||
|
return Float.compare(f31, f30);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int compare(Object p_compare_1_, Object p_compare_2_)
|
||||||
|
{
|
||||||
|
return this.compare((Integer)p_compare_1_, (Integer)p_compare_2_);
|
||||||
|
}
|
||||||
|
}
|
63
src/main/java/trinity/render/TesselatorVertexState.java
Normal file
63
src/main/java/trinity/render/TesselatorVertexState.java
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class TesselatorVertexState
|
||||||
|
{
|
||||||
|
private int[] rawBuffer;
|
||||||
|
private int rawBufferIndex;
|
||||||
|
private int vertexCount;
|
||||||
|
private boolean hasTexture;
|
||||||
|
private boolean hasBrightness;
|
||||||
|
private boolean hasNormals;
|
||||||
|
private boolean hasColor;
|
||||||
|
private static final String __OBFID = "CL_00000961";
|
||||||
|
|
||||||
|
public TesselatorVertexState(int[] p_i45079_1_, int p_i45079_2_, int p_i45079_3_, boolean p_i45079_4_, boolean p_i45079_5_, boolean p_i45079_6_, boolean p_i45079_7_)
|
||||||
|
{
|
||||||
|
this.rawBuffer = p_i45079_1_;
|
||||||
|
this.rawBufferIndex = p_i45079_2_;
|
||||||
|
this.vertexCount = p_i45079_3_;
|
||||||
|
this.hasTexture = p_i45079_4_;
|
||||||
|
this.hasBrightness = p_i45079_5_;
|
||||||
|
this.hasNormals = p_i45079_6_;
|
||||||
|
this.hasColor = p_i45079_7_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[] getRawBuffer()
|
||||||
|
{
|
||||||
|
return this.rawBuffer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRawBufferIndex()
|
||||||
|
{
|
||||||
|
return this.rawBufferIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVertexCount()
|
||||||
|
{
|
||||||
|
return this.vertexCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHasTexture()
|
||||||
|
{
|
||||||
|
return this.hasTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHasBrightness()
|
||||||
|
{
|
||||||
|
return this.hasBrightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHasNormals()
|
||||||
|
{
|
||||||
|
return this.hasNormals;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean getHasColor()
|
||||||
|
{
|
||||||
|
return this.hasColor;
|
||||||
|
}
|
||||||
|
}
|
498
src/main/java/trinity/render/Tessellator.java
Normal file
498
src/main/java/trinity/render/Tessellator.java
Normal file
|
@ -0,0 +1,498 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
|
import java.nio.FloatBuffer;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
|
import java.nio.ShortBuffer;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.PriorityQueue;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GLAllocation;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class Tessellator
|
||||||
|
{
|
||||||
|
private static int nativeBufferSize = 0x200000;
|
||||||
|
private static int trivertsInBuffer = (nativeBufferSize / 48) * 6;
|
||||||
|
public static boolean renderingWorldRenderer = false;
|
||||||
|
public boolean defaultTexture = false;
|
||||||
|
private int rawBufferSize = 0;
|
||||||
|
public int textureID = 0;
|
||||||
|
|
||||||
|
/** The byte buffer used for GL allocation. */
|
||||||
|
private static ByteBuffer byteBuffer = GLAllocation.createDirectByteBuffer(nativeBufferSize * 4);
|
||||||
|
/** The same memory as byteBuffer, but referenced as an integer buffer. */
|
||||||
|
private static IntBuffer intBuffer = byteBuffer.asIntBuffer();
|
||||||
|
/** The same memory as byteBuffer, but referenced as an float buffer. */
|
||||||
|
private static FloatBuffer floatBuffer = byteBuffer.asFloatBuffer();
|
||||||
|
/** The same memory as byteBuffer, but referenced as an short buffer. */
|
||||||
|
private static ShortBuffer shortBuffer = byteBuffer.asShortBuffer();
|
||||||
|
/** Raw integer array. */
|
||||||
|
private int[] rawBuffer;
|
||||||
|
/** The number of vertices to be drawn in the next draw call. Reset to 0 between draw calls. */
|
||||||
|
private int vertexCount;
|
||||||
|
/** The first coordinate to be used for the texture. */
|
||||||
|
private double textureU;
|
||||||
|
/** The second coordinate to be used for the texture. */
|
||||||
|
private double textureV;
|
||||||
|
private int brightness;
|
||||||
|
/** The color (RGBA) value to be used for the following draw call. */
|
||||||
|
private int color;
|
||||||
|
/** Whether the current draw object for this tessellator has color values. */
|
||||||
|
private boolean hasColor;
|
||||||
|
/** Whether the current draw object for this tessellator has texture coordinates. */
|
||||||
|
private boolean hasTexture;
|
||||||
|
private boolean hasBrightness;
|
||||||
|
/** Whether the current draw object for this tessellator has normal values. */
|
||||||
|
private boolean hasNormals;
|
||||||
|
/** The index into the raw buffer to be used for the next data. */
|
||||||
|
private int rawBufferIndex;
|
||||||
|
/**
|
||||||
|
* The number of vertices manually added to the given draw call. This differs from vertexCount because it adds extra
|
||||||
|
* vertices when converting quads to triangles.
|
||||||
|
*/
|
||||||
|
private int addedVertices;
|
||||||
|
/** Disables all color information for the following draw call. */
|
||||||
|
private boolean isColorDisabled;
|
||||||
|
/** The draw mode currently being used by the tessellator. */
|
||||||
|
private int drawMode;
|
||||||
|
/** An offset to be applied along the x-axis for all vertices in this draw call. */
|
||||||
|
private double xOffset;
|
||||||
|
/** An offset to be applied along the y-axis for all vertices in this draw call. */
|
||||||
|
private double yOffset;
|
||||||
|
/** An offset to be applied along the z-axis for all vertices in this draw call. */
|
||||||
|
private double zOffset;
|
||||||
|
/** The normal to be applied to the face being drawn. */
|
||||||
|
private int normal;
|
||||||
|
/** The static instance of the Tessellator. */
|
||||||
|
public static final Tessellator instance = new Tessellator(2097152);
|
||||||
|
/** Whether this tessellator is currently in draw mode. */
|
||||||
|
private boolean isDrawing;
|
||||||
|
/** The size of the buffers used (in integers). */
|
||||||
|
private int bufferSize;
|
||||||
|
private static final String __OBFID = "CL_00000960";
|
||||||
|
|
||||||
|
private Tessellator(int p_i1250_1_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Tessellator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
instance.defaultTexture = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draws the data set up in this tessellator and resets the state to prepare for new drawing.
|
||||||
|
*/
|
||||||
|
public int draw()
|
||||||
|
{
|
||||||
|
if (!this.isDrawing)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Not tesselating!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.isDrawing = false;
|
||||||
|
|
||||||
|
int offs = 0;
|
||||||
|
while (offs < vertexCount)
|
||||||
|
{
|
||||||
|
int vtc = Math.min(vertexCount - offs, nativeBufferSize >> 5);
|
||||||
|
this.intBuffer.clear();
|
||||||
|
this.intBuffer.put(this.rawBuffer, offs * 8, vtc * 8);
|
||||||
|
this.byteBuffer.position(0);
|
||||||
|
this.byteBuffer.limit(vtc * 32);
|
||||||
|
offs += vtc;
|
||||||
|
|
||||||
|
if (this.hasTexture)
|
||||||
|
{
|
||||||
|
this.floatBuffer.position(3);
|
||||||
|
GL11.glTexCoordPointer(2, 32, this.floatBuffer);
|
||||||
|
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasBrightness)
|
||||||
|
{
|
||||||
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||||
|
this.shortBuffer.position(14);
|
||||||
|
GL11.glTexCoordPointer(2, 32, this.shortBuffer);
|
||||||
|
GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||||
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasColor)
|
||||||
|
{
|
||||||
|
this.byteBuffer.position(20);
|
||||||
|
GL11.glColorPointer(4, true, 32, this.byteBuffer);
|
||||||
|
GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasNormals)
|
||||||
|
{
|
||||||
|
this.byteBuffer.position(24);
|
||||||
|
GL11.glNormalPointer(32, this.byteBuffer);
|
||||||
|
GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.floatBuffer.position(0);
|
||||||
|
GL11.glVertexPointer(3, 32, this.floatBuffer);
|
||||||
|
GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
|
||||||
|
GL11.glDrawArrays(this.drawMode, 0, vtc);
|
||||||
|
GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
|
||||||
|
|
||||||
|
if (this.hasTexture)
|
||||||
|
{
|
||||||
|
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasBrightness)
|
||||||
|
{
|
||||||
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.lightmapTexUnit);
|
||||||
|
GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
|
||||||
|
OpenGlHelper.setClientActiveTexture(OpenGlHelper.defaultTexUnit);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasColor)
|
||||||
|
{
|
||||||
|
GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasNormals)
|
||||||
|
{
|
||||||
|
GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawBufferSize > 0x20000 && rawBufferIndex < (rawBufferSize << 3))
|
||||||
|
{
|
||||||
|
rawBufferSize = 0x10000;
|
||||||
|
rawBuffer = new int[rawBufferSize];
|
||||||
|
}
|
||||||
|
|
||||||
|
int i = this.rawBufferIndex * 4;
|
||||||
|
this.reset();
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public TesselatorVertexState getVertexState(float p_147564_1_, float p_147564_2_, float p_147564_3_)
|
||||||
|
{
|
||||||
|
int[] aint = new int[this.rawBufferIndex];
|
||||||
|
PriorityQueue priorityqueue = new PriorityQueue(this.rawBufferIndex, new QuadComparator(this.rawBuffer, p_147564_1_ + (float)this.xOffset, p_147564_2_ + (float)this.yOffset, p_147564_3_ + (float)this.zOffset));
|
||||||
|
byte b0 = 32;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < this.rawBufferIndex; i += b0)
|
||||||
|
{
|
||||||
|
priorityqueue.add(Integer.valueOf(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; !priorityqueue.isEmpty(); i += b0)
|
||||||
|
{
|
||||||
|
int j = ((Integer)priorityqueue.remove()).intValue();
|
||||||
|
|
||||||
|
for (int k = 0; k < b0; ++k)
|
||||||
|
{
|
||||||
|
aint[i + k] = this.rawBuffer[j + k];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.arraycopy(aint, 0, this.rawBuffer, 0, aint.length);
|
||||||
|
return new TesselatorVertexState(aint, this.rawBufferIndex, this.vertexCount, this.hasTexture, this.hasBrightness, this.hasNormals, this.hasColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVertexState(TesselatorVertexState p_147565_1_)
|
||||||
|
{
|
||||||
|
while (p_147565_1_.getRawBuffer().length > rawBufferSize && rawBufferSize > 0)
|
||||||
|
{
|
||||||
|
rawBufferSize <<= 1;
|
||||||
|
}
|
||||||
|
if (rawBufferSize > rawBuffer.length)
|
||||||
|
{
|
||||||
|
rawBuffer = new int[rawBufferSize];
|
||||||
|
}
|
||||||
|
System.arraycopy(p_147565_1_.getRawBuffer(), 0, this.rawBuffer, 0, p_147565_1_.getRawBuffer().length);
|
||||||
|
this.rawBufferIndex = p_147565_1_.getRawBufferIndex();
|
||||||
|
this.vertexCount = p_147565_1_.getVertexCount();
|
||||||
|
this.hasTexture = p_147565_1_.getHasTexture();
|
||||||
|
this.hasBrightness = p_147565_1_.getHasBrightness();
|
||||||
|
this.hasColor = p_147565_1_.getHasColor();
|
||||||
|
this.hasNormals = p_147565_1_.getHasNormals();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the tessellator state in preparation for new drawing.
|
||||||
|
*/
|
||||||
|
private void reset()
|
||||||
|
{
|
||||||
|
this.vertexCount = 0;
|
||||||
|
this.byteBuffer.clear();
|
||||||
|
this.rawBufferIndex = 0;
|
||||||
|
this.addedVertices = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets draw mode in the tessellator to draw quads.
|
||||||
|
*/
|
||||||
|
public void startDrawingQuads()
|
||||||
|
{
|
||||||
|
this.startDrawing(7);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Resets tessellator state and prepares for drawing (with the specified draw mode).
|
||||||
|
*/
|
||||||
|
public void startDrawing(int p_78371_1_)
|
||||||
|
{
|
||||||
|
if (this.isDrawing)
|
||||||
|
{
|
||||||
|
throw new IllegalStateException("Already tesselating!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.isDrawing = true;
|
||||||
|
this.reset();
|
||||||
|
this.drawMode = p_78371_1_;
|
||||||
|
this.hasNormals = false;
|
||||||
|
this.hasColor = false;
|
||||||
|
this.hasTexture = false;
|
||||||
|
this.hasBrightness = false;
|
||||||
|
this.isColorDisabled = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the texture coordinates.
|
||||||
|
*/
|
||||||
|
public void setTextureUV(double p_78385_1_, double p_78385_3_)
|
||||||
|
{
|
||||||
|
this.hasTexture = true;
|
||||||
|
this.textureU = p_78385_1_;
|
||||||
|
this.textureV = p_78385_3_;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBrightness(int p_78380_1_)
|
||||||
|
{
|
||||||
|
this.hasBrightness = true;
|
||||||
|
this.brightness = p_78380_1_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the RGB values as specified, converting from floats between 0 and 1 to integers from 0-255.
|
||||||
|
*/
|
||||||
|
public void setColorOpaque_F(float p_78386_1_, float p_78386_2_, float p_78386_3_)
|
||||||
|
{
|
||||||
|
this.setColorOpaque((int)(p_78386_1_ * 255.0F), (int)(p_78386_2_ * 255.0F), (int)(p_78386_3_ * 255.0F));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the RGBA values for the color, converting from floats between 0 and 1 to integers from 0-255.
|
||||||
|
*/
|
||||||
|
public void setColorRGBA_F(float p_78369_1_, float p_78369_2_, float p_78369_3_, float p_78369_4_)
|
||||||
|
{
|
||||||
|
this.setColorRGBA((int)(p_78369_1_ * 255.0F), (int)(p_78369_2_ * 255.0F), (int)(p_78369_3_ * 255.0F), (int)(p_78369_4_ * 255.0F));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the RGB values as specified, and sets alpha to opaque.
|
||||||
|
*/
|
||||||
|
public void setColorOpaque(int p_78376_1_, int p_78376_2_, int p_78376_3_)
|
||||||
|
{
|
||||||
|
this.setColorRGBA(p_78376_1_, p_78376_2_, p_78376_3_, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the RGBA values for the color. Also clamps them to 0-255.
|
||||||
|
*/
|
||||||
|
public void setColorRGBA(int p_78370_1_, int p_78370_2_, int p_78370_3_, int p_78370_4_)
|
||||||
|
{
|
||||||
|
if (!this.isColorDisabled)
|
||||||
|
{
|
||||||
|
if (p_78370_1_ > 255)
|
||||||
|
{
|
||||||
|
p_78370_1_ = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_2_ > 255)
|
||||||
|
{
|
||||||
|
p_78370_2_ = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_3_ > 255)
|
||||||
|
{
|
||||||
|
p_78370_3_ = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_4_ > 255)
|
||||||
|
{
|
||||||
|
p_78370_4_ = 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_1_ < 0)
|
||||||
|
{
|
||||||
|
p_78370_1_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_2_ < 0)
|
||||||
|
{
|
||||||
|
p_78370_2_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_3_ < 0)
|
||||||
|
{
|
||||||
|
p_78370_3_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (p_78370_4_ < 0)
|
||||||
|
{
|
||||||
|
p_78370_4_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.hasColor = true;
|
||||||
|
|
||||||
|
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN)
|
||||||
|
{
|
||||||
|
this.color = p_78370_4_ << 24 | p_78370_3_ << 16 | p_78370_2_ << 8 | p_78370_1_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.color = p_78370_1_ << 24 | p_78370_2_ << 16 | p_78370_3_ << 8 | p_78370_4_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void func_154352_a(byte p_154352_1_, byte p_154352_2_, byte p_154352_3_)
|
||||||
|
{
|
||||||
|
this.setColorOpaque(p_154352_1_ & 255, p_154352_2_ & 255, p_154352_3_ & 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a vertex specifying both x,y,z and the texture u,v for it.
|
||||||
|
*/
|
||||||
|
public void addVertexWithUV(double p_78374_1_, double p_78374_3_, double p_78374_5_, double p_78374_7_, double p_78374_9_)
|
||||||
|
{
|
||||||
|
this.setTextureUV(p_78374_7_, p_78374_9_);
|
||||||
|
this.addVertex(p_78374_1_, p_78374_3_, p_78374_5_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a vertex with the specified x,y,z to the current draw call. It will trigger a draw() if the buffer gets
|
||||||
|
* full.
|
||||||
|
*/
|
||||||
|
public void addVertex(double p_78377_1_, double p_78377_3_, double p_78377_5_)
|
||||||
|
{
|
||||||
|
if (rawBufferIndex >= rawBufferSize - 32)
|
||||||
|
{
|
||||||
|
if (rawBufferSize == 0)
|
||||||
|
{
|
||||||
|
rawBufferSize = 0x10000;
|
||||||
|
rawBuffer = new int[rawBufferSize];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rawBufferSize *= 2;
|
||||||
|
rawBuffer = Arrays.copyOf(rawBuffer, rawBufferSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
++this.addedVertices;
|
||||||
|
|
||||||
|
if (this.hasTexture)
|
||||||
|
{
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 3] = Float.floatToRawIntBits((float)this.textureU);
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 4] = Float.floatToRawIntBits((float)this.textureV);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasBrightness)
|
||||||
|
{
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 7] = this.brightness;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasColor)
|
||||||
|
{
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 5] = this.color;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.hasNormals)
|
||||||
|
{
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 6] = this.normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 0] = Float.floatToRawIntBits((float)(p_78377_1_ + this.xOffset));
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 1] = Float.floatToRawIntBits((float)(p_78377_3_ + this.yOffset));
|
||||||
|
this.rawBuffer[this.rawBufferIndex + 2] = Float.floatToRawIntBits((float)(p_78377_5_ + this.zOffset));
|
||||||
|
this.rawBufferIndex += 8;
|
||||||
|
++this.vertexCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color to the given opaque value (stored as byte values packed in an integer).
|
||||||
|
*/
|
||||||
|
public void setColorOpaque_I(int p_78378_1_)
|
||||||
|
{
|
||||||
|
int j = p_78378_1_ >> 16 & 255;
|
||||||
|
int k = p_78378_1_ >> 8 & 255;
|
||||||
|
int l = p_78378_1_ & 255;
|
||||||
|
this.setColorOpaque(j, k, l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the color to the given color (packed as bytes in integer) and alpha values.
|
||||||
|
*/
|
||||||
|
public void setColorRGBA_I(int p_78384_1_, int p_78384_2_)
|
||||||
|
{
|
||||||
|
int k = p_78384_1_ >> 16 & 255;
|
||||||
|
int l = p_78384_1_ >> 8 & 255;
|
||||||
|
int i1 = p_78384_1_ & 255;
|
||||||
|
this.setColorRGBA(k, l, i1, p_78384_2_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disables colors for the current draw call.
|
||||||
|
*/
|
||||||
|
public void disableColor()
|
||||||
|
{
|
||||||
|
this.isColorDisabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the normal for the current draw call.
|
||||||
|
*/
|
||||||
|
public void setNormal(float p_78375_1_, float p_78375_2_, float p_78375_3_)
|
||||||
|
{
|
||||||
|
this.hasNormals = true;
|
||||||
|
byte b0 = (byte)((int)(p_78375_1_ * 127.0F));
|
||||||
|
byte b1 = (byte)((int)(p_78375_2_ * 127.0F));
|
||||||
|
byte b2 = (byte)((int)(p_78375_3_ * 127.0F));
|
||||||
|
this.normal = b0 & 255 | (b1 & 255) << 8 | (b2 & 255) << 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the translation for all vertices in the current draw call.
|
||||||
|
*/
|
||||||
|
public void setTranslation(double p_78373_1_, double p_78373_3_, double p_78373_5_)
|
||||||
|
{
|
||||||
|
this.xOffset = p_78373_1_;
|
||||||
|
this.yOffset = p_78373_3_;
|
||||||
|
this.zOffset = p_78373_5_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Offsets the translation for all vertices in the current draw call.
|
||||||
|
*/
|
||||||
|
public void addTranslation(float p_78372_1_, float p_78372_2_, float p_78372_3_)
|
||||||
|
{
|
||||||
|
this.xOffset += (double)p_78372_1_;
|
||||||
|
this.yOffset += (double)p_78372_2_;
|
||||||
|
this.zOffset += (double)p_78372_3_;
|
||||||
|
}
|
||||||
|
}
|
18
src/main/java/trinity/render/TextureCoordinate.java
Normal file
18
src/main/java/trinity/render/TextureCoordinate.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
public class TextureCoordinate
|
||||||
|
{
|
||||||
|
public float u, v, w;
|
||||||
|
|
||||||
|
public TextureCoordinate(float u, float v)
|
||||||
|
{
|
||||||
|
this(u, v, 0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TextureCoordinate(float u, float v, float w)
|
||||||
|
{
|
||||||
|
this.u = u;
|
||||||
|
this.v = v;
|
||||||
|
this.w = w;
|
||||||
|
}
|
||||||
|
}
|
18
src/main/java/trinity/render/Vertex.java
Normal file
18
src/main/java/trinity/render/Vertex.java
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
public class Vertex
|
||||||
|
{
|
||||||
|
public float x, y, z;
|
||||||
|
|
||||||
|
public Vertex(float x, float y)
|
||||||
|
{
|
||||||
|
this(x, y, 0F);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vertex(float x, float y, float z)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.z = z;
|
||||||
|
}
|
||||||
|
}
|
656
src/main/java/trinity/render/WavefrontObject.java
Normal file
656
src/main/java/trinity/render/WavefrontObject.java
Normal file
|
@ -0,0 +1,656 @@
|
||||||
|
package trinity.render;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.resources.IResource;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wavefront Object importer
|
||||||
|
* Based heavily off of the specifications found at http://en.wikipedia.org/wiki/Wavefront_.obj_file
|
||||||
|
*/
|
||||||
|
public class WavefrontObject implements IModelCustom
|
||||||
|
{
|
||||||
|
private static Pattern vertexPattern = Pattern.compile("(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(v( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||||
|
private static Pattern vertexNormalPattern = Pattern.compile("(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *\\n)|(vn( (\\-){0,1}\\d+(\\.\\d+)?){3,4} *$)");
|
||||||
|
private static Pattern textureCoordinatePattern = Pattern.compile("(vt( (\\-){0,1}\\d+\\.\\d+){2,3} *\\n)|(vt( (\\-){0,1}\\d+(\\.\\d+)?){2,3} *$)");
|
||||||
|
private static Pattern face_V_VT_VN_Pattern = Pattern.compile("(f( \\d+/\\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+/\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_VT_Pattern = Pattern.compile("(f( \\d+/\\d+){3,4} *\\n)|(f( \\d+/\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_VN_Pattern = Pattern.compile("(f( \\d+//\\d+){3,4} *\\n)|(f( \\d+//\\d+){3,4} *$)");
|
||||||
|
private static Pattern face_V_Pattern = Pattern.compile("(f( \\d+){3,4} *\\n)|(f( \\d+){3,4} *$)");
|
||||||
|
private static Pattern groupObjectPattern = Pattern.compile("([go]( [\\w\\d\\.]+) *\\n)|([go]( [\\w\\d\\.]+) *$)");
|
||||||
|
|
||||||
|
private static Matcher vertexMatcher, vertexNormalMatcher, textureCoordinateMatcher;
|
||||||
|
private static Matcher face_V_VT_VN_Matcher, face_V_VT_Matcher, face_V_VN_Matcher, face_V_Matcher;
|
||||||
|
private static Matcher groupObjectMatcher;
|
||||||
|
|
||||||
|
public ArrayList<Vertex> vertices = new ArrayList<Vertex>();
|
||||||
|
public ArrayList<Vertex> vertexNormals = new ArrayList<Vertex>();
|
||||||
|
public ArrayList<TextureCoordinate> textureCoordinates = new ArrayList<TextureCoordinate>();
|
||||||
|
public ArrayList<GroupObject> groupObjects = new ArrayList<GroupObject>();
|
||||||
|
private GroupObject currentGroupObject;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
public WavefrontObject(ResourceLocation resource) throws ModelFormatException
|
||||||
|
{
|
||||||
|
this.fileName = resource.toString();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IResource res = Minecraft.getMinecraft().getResourceManager().getResource(resource);
|
||||||
|
loadObjModel(res.getInputStream());
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("IO Exception reading model format", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public WavefrontObject(String filename, InputStream inputStream) throws ModelFormatException
|
||||||
|
{
|
||||||
|
this.fileName = filename;
|
||||||
|
loadObjModel(inputStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void loadObjModel(InputStream inputStream) throws ModelFormatException
|
||||||
|
{
|
||||||
|
BufferedReader reader = null;
|
||||||
|
|
||||||
|
String currentLine = null;
|
||||||
|
int lineCount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
|
||||||
|
while ((currentLine = reader.readLine()) != null)
|
||||||
|
{
|
||||||
|
lineCount++;
|
||||||
|
currentLine = currentLine.replaceAll("\\s+", " ").trim();
|
||||||
|
|
||||||
|
if (currentLine.startsWith("#") || currentLine.length() == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("v "))
|
||||||
|
{
|
||||||
|
Vertex vertex = parseVertex(currentLine, lineCount);
|
||||||
|
if (vertex != null)
|
||||||
|
{
|
||||||
|
vertices.add(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("vn "))
|
||||||
|
{
|
||||||
|
Vertex vertex = parseVertexNormal(currentLine, lineCount);
|
||||||
|
if (vertex != null)
|
||||||
|
{
|
||||||
|
vertexNormals.add(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("vt "))
|
||||||
|
{
|
||||||
|
TextureCoordinate textureCoordinate = parseTextureCoordinate(currentLine, lineCount);
|
||||||
|
if (textureCoordinate != null)
|
||||||
|
{
|
||||||
|
textureCoordinates.add(textureCoordinate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("f "))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (currentGroupObject == null)
|
||||||
|
{
|
||||||
|
currentGroupObject = new GroupObject("Default");
|
||||||
|
}
|
||||||
|
|
||||||
|
Face face = parseFace(currentLine, lineCount);
|
||||||
|
|
||||||
|
if (face != null)
|
||||||
|
{
|
||||||
|
currentGroupObject.faces.add(face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (currentLine.startsWith("g ") | currentLine.startsWith("o "))
|
||||||
|
{
|
||||||
|
GroupObject group = parseGroupObject(currentLine, lineCount);
|
||||||
|
|
||||||
|
if (group != null)
|
||||||
|
{
|
||||||
|
if (currentGroupObject != null)
|
||||||
|
{
|
||||||
|
groupObjects.add(currentGroupObject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
currentGroupObject = group;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
groupObjects.add(currentGroupObject);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("IO Exception reading model format", e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// hush
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
inputStream.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
// hush
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderAll()
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
if (currentGroupObject != null)
|
||||||
|
{
|
||||||
|
tessellator.startDrawing(currentGroupObject.glDrawingMode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tessellator.startDrawing(GL11.GL_TRIANGLES);
|
||||||
|
}
|
||||||
|
tessellateAll(tessellator);
|
||||||
|
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateAll(Tessellator tessellator)
|
||||||
|
{
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderOnly(String... groupNames)
|
||||||
|
{
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
for (String groupName : groupNames)
|
||||||
|
{
|
||||||
|
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateOnly(Tessellator tessellator, String... groupNames) {
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
for (String groupName : groupNames)
|
||||||
|
{
|
||||||
|
if (groupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderPart(String partName)
|
||||||
|
{
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
if (partName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellatePart(Tessellator tessellator, String partName) {
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
if (partName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void renderAllExcept(String... excludedGroupNames)
|
||||||
|
{
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
boolean skipPart=false;
|
||||||
|
for (String excludedGroupName : excludedGroupNames)
|
||||||
|
{
|
||||||
|
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
skipPart=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!skipPart)
|
||||||
|
{
|
||||||
|
groupObject.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void tessellateAllExcept(Tessellator tessellator, String... excludedGroupNames)
|
||||||
|
{
|
||||||
|
boolean exclude;
|
||||||
|
for (GroupObject groupObject : groupObjects)
|
||||||
|
{
|
||||||
|
exclude=false;
|
||||||
|
for (String excludedGroupName : excludedGroupNames)
|
||||||
|
{
|
||||||
|
if (excludedGroupName.equalsIgnoreCase(groupObject.name))
|
||||||
|
{
|
||||||
|
exclude=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!exclude)
|
||||||
|
{
|
||||||
|
groupObject.render(tessellator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vertex parseVertex(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Vertex vertex = null;
|
||||||
|
|
||||||
|
if (isValidVertexLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 2)
|
||||||
|
{
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]));
|
||||||
|
}
|
||||||
|
else if (tokens.length == 3)
|
||||||
|
{
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return vertex;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Vertex parseVertexNormal(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Vertex vertexNormal = null;
|
||||||
|
|
||||||
|
if (isValidVertexNormalLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 3)
|
||||||
|
return new Vertex(Float.parseFloat(tokens[0]), Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return vertexNormal;
|
||||||
|
}
|
||||||
|
|
||||||
|
private TextureCoordinate parseTextureCoordinate(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
TextureCoordinate textureCoordinate = null;
|
||||||
|
|
||||||
|
if (isValidTextureCoordinateLine(line))
|
||||||
|
{
|
||||||
|
line = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = line.split(" ");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (tokens.length == 2)
|
||||||
|
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]));
|
||||||
|
else if (tokens.length == 3)
|
||||||
|
return new TextureCoordinate(Float.parseFloat(tokens[0]), 1 - Float.parseFloat(tokens[1]), Float.parseFloat(tokens[2]));
|
||||||
|
}
|
||||||
|
catch (NumberFormatException e)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException(String.format("Number formatting error at line %d",lineCount), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return textureCoordinate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Face parseFace(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
Face face = null;
|
||||||
|
|
||||||
|
if (isValidFaceLine(line))
|
||||||
|
{
|
||||||
|
face = new Face();
|
||||||
|
|
||||||
|
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||||
|
String[] tokens = trimmedLine.split(" ");
|
||||||
|
String[] subTokens = null;
|
||||||
|
|
||||||
|
if (tokens.length == 3)
|
||||||
|
{
|
||||||
|
if (currentGroupObject.glDrawingMode == -1)
|
||||||
|
{
|
||||||
|
currentGroupObject.glDrawingMode = GL11.GL_TRIANGLES;
|
||||||
|
}
|
||||||
|
else if (currentGroupObject.glDrawingMode != GL11.GL_TRIANGLES)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 4, found " + tokens.length + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (tokens.length == 4)
|
||||||
|
{
|
||||||
|
if (currentGroupObject.glDrawingMode == -1)
|
||||||
|
{
|
||||||
|
currentGroupObject.glDrawingMode = GL11.GL_QUADS;
|
||||||
|
}
|
||||||
|
else if (currentGroupObject.glDrawingMode != GL11.GL_QUADS)
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Invalid number of points for face (expected 3, found " + tokens.length + ")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 ...
|
||||||
|
if (isValidFace_V_VT_VN_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||||
|
face.vertexNormals = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("/");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[2]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1/vt1 v2/vt2 v3/vt3 ...
|
||||||
|
else if (isValidFace_V_VT_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.textureCoordinates = new TextureCoordinate[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("/");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.textureCoordinates[i] = textureCoordinates.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1//vn1 v2//vn2 v3//vn3 ...
|
||||||
|
else if (isValidFace_V_VN_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
face.vertexNormals = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
subTokens = tokens[i].split("//");
|
||||||
|
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(subTokens[0]) - 1);
|
||||||
|
face.vertexNormals[i] = vertexNormals.get(Integer.parseInt(subTokens[1]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
// f v1 v2 v3 ...
|
||||||
|
else if (isValidFace_V_Line(line))
|
||||||
|
{
|
||||||
|
face.vertices = new Vertex[tokens.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < tokens.length; ++i)
|
||||||
|
{
|
||||||
|
face.vertices[i] = vertices.get(Integer.parseInt(tokens[i]) - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
face.faceNormal = face.calculateFaceNormal();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return face;
|
||||||
|
}
|
||||||
|
|
||||||
|
private GroupObject parseGroupObject(String line, int lineCount) throws ModelFormatException
|
||||||
|
{
|
||||||
|
GroupObject group = null;
|
||||||
|
|
||||||
|
if (isValidGroupObjectLine(line))
|
||||||
|
{
|
||||||
|
String trimmedLine = line.substring(line.indexOf(" ") + 1);
|
||||||
|
|
||||||
|
if (trimmedLine.length() > 0)
|
||||||
|
{
|
||||||
|
group = new GroupObject(trimmedLine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new ModelFormatException("Error parsing entry ('" + line + "'" + ", line " + lineCount + ") in file '" + fileName + "' - Incorrect format");
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid vertex
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid vertex, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidVertexLine(String line)
|
||||||
|
{
|
||||||
|
if (vertexMatcher != null)
|
||||||
|
{
|
||||||
|
vertexMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
vertexMatcher = vertexPattern.matcher(line);
|
||||||
|
return vertexMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid vertex normal
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid vertex normal, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidVertexNormalLine(String line)
|
||||||
|
{
|
||||||
|
if (vertexNormalMatcher != null)
|
||||||
|
{
|
||||||
|
vertexNormalMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
vertexNormalMatcher = vertexNormalPattern.matcher(line);
|
||||||
|
return vertexNormalMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid texture coordinate
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid texture coordinate, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidTextureCoordinateLine(String line)
|
||||||
|
{
|
||||||
|
if (textureCoordinateMatcher != null)
|
||||||
|
{
|
||||||
|
textureCoordinateMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
textureCoordinateMatcher = textureCoordinatePattern.matcher(line);
|
||||||
|
return textureCoordinateMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices, texture coordinates, and vertex normals
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1/vt1/vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VT_VN_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VT_VN_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VT_VN_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VT_VN_Matcher = face_V_VT_VN_Pattern.matcher(line);
|
||||||
|
return face_V_VT_VN_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices and texture coordinates
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1/vt1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VT_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VT_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VT_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VT_Matcher = face_V_VT_Pattern.matcher(line);
|
||||||
|
return face_V_VT_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by vertices and vertex normals
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1//vn1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_VN_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_VN_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_VN_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_VN_Matcher = face_V_VN_Pattern.matcher(line);
|
||||||
|
return face_V_VN_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face that is described by only vertices
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches the format "f v1 ..." (with a minimum of 3 points in the face, and a maximum of 4), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFace_V_Line(String line)
|
||||||
|
{
|
||||||
|
if (face_V_Matcher != null)
|
||||||
|
{
|
||||||
|
face_V_Matcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
face_V_Matcher = face_V_Pattern.matcher(line);
|
||||||
|
return face_V_Matcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid face of any of the possible face formats
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid face that matches any of the valid face formats, false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidFaceLine(String line)
|
||||||
|
{
|
||||||
|
return isValidFace_V_VT_VN_Line(line) || isValidFace_V_VT_Line(line) || isValidFace_V_VN_Line(line) || isValidFace_V_Line(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Verifies that the given line from the model file is a valid group (or object)
|
||||||
|
* @param line the line being validated
|
||||||
|
* @return true if the line is a valid group (or object), false otherwise
|
||||||
|
*/
|
||||||
|
private static boolean isValidGroupObjectLine(String line)
|
||||||
|
{
|
||||||
|
if (groupObjectMatcher != null)
|
||||||
|
{
|
||||||
|
groupObjectMatcher.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
groupObjectMatcher = groupObjectPattern.matcher(line);
|
||||||
|
return groupObjectMatcher.matches();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType()
|
||||||
|
{
|
||||||
|
return "obj";
|
||||||
|
}
|
||||||
|
}
|
345
src/main/java/trinity/render/entity/RenderBlackHole.java
Normal file
345
src/main/java/trinity/render/entity/RenderBlackHole.java
Normal file
|
@ -0,0 +1,345 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityBlackHole;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
//import trinity.util.IConstantRenderer;
|
||||||
|
//import trinity.util.Reference;
|
||||||
|
import trinity.util.ResourceManager;
|
||||||
|
import trinity.render.AdvancedModelLoader;
|
||||||
|
import trinity.render.IModelCustom;
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
//import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.culling.ICamera;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
|
|
||||||
|
public class RenderBlackHole extends Render<EntityBlackHole> {
|
||||||
|
|
||||||
|
public static final IRenderFactory<EntityBlackHole> FACTORY = (RenderManager man) -> {return new RenderBlackHole(man);};
|
||||||
|
|
||||||
|
private static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */Global.MOD_ID, "models/Sphere.obj");
|
||||||
|
private IModelCustom blastModel;
|
||||||
|
private ResourceLocation hole;
|
||||||
|
private ResourceLocation disk;
|
||||||
|
|
||||||
|
public RenderBlackHole(RenderManager renderManager) {
|
||||||
|
super(renderManager);
|
||||||
|
blastModel = AdvancedModelLoader.loadModel(objTesterModelRL);
|
||||||
|
hole = new ResourceLocation(Global.MOD_ID, "textures/models/black.png");
|
||||||
|
disk = new ResourceLocation(Global.MOD_ID, "textures/models/disk.png");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityBlackHole entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
|
||||||
|
EntityPlayer player = Minecraft.getMinecraft().player;
|
||||||
|
long time = Minecraft.getMinecraft().world.getTotalWorldTime();
|
||||||
|
float speed = 4;
|
||||||
|
//double resonateSpeed = 0.2;
|
||||||
|
double radius = entity.getDataManager().get(EntityBlackHole.SCALE);
|
||||||
|
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
|
||||||
|
//radius = radius;// * Math.sin(time * resonateSpeed) * 0.1 + radius * 0.9;
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glTranslated(x, y, z);
|
||||||
|
GL11.glScaled(radius, radius, radius);
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
bindTexture(hole);
|
||||||
|
GL11.glColor4d(0, 0, 0, 1);
|
||||||
|
blastModel.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
//=======================================================
|
||||||
|
//Draw Vortex
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glTranslated(x, y, z);
|
||||||
|
GL11.glRotatef(-time, 0, 1, 0);
|
||||||
|
|
||||||
|
double size = radius * 6;
|
||||||
|
|
||||||
|
this.bindTexture(disk);
|
||||||
|
|
||||||
|
//top render
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, -size, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, +size, 0, 1);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, +size, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, -size, 1, 0);
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
//bottom render
|
||||||
|
GL11.glRotatef(180, 1, 0, 0);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, -size, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, +size, 1, 0);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, +size, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, -size, 0, 1);
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
// Enable Lighting/Glow Off
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
// Disable Blending
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
/*GL11.glPushMatrix();
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glTranslated(x, y, z);
|
||||||
|
GL11.glRotatef(-time/2, 0, 1, 0);
|
||||||
|
|
||||||
|
double size2 = size * 3;
|
||||||
|
|
||||||
|
this.bindTexture(disk);
|
||||||
|
|
||||||
|
//top render
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 0.757F, 0.49F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-size2, 0, -size2, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(-size2, 0, +size2, 0, 1);
|
||||||
|
tessellator.addVertexWithUV(+size2, 0, +size2, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(+size2, 0, -size2, 1, 0);
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
//bottom render
|
||||||
|
GL11.glRotatef(180, 1, 0, 0);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 0.757F, 0.49F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-size2, 0, -size2, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(-size2, 0, +size2, 1, 0);
|
||||||
|
tessellator.addVertexWithUV(+size2, 0, +size2, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(+size2, 0, -size2, 0, 1);
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
// Enable Lighting/Glow Off
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
// Disable Blending
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glPopMatrix();*/
|
||||||
|
}
|
||||||
|
/*GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(x, y, z);
|
||||||
|
//GL11.glRotatef((entity.ticksExisted % 360) * 10, 1, 1, 1);
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GlStateManager.disableCull();
|
||||||
|
|
||||||
|
float size = entity.getDataManager().get(EntityBlackHole.SCALE);
|
||||||
|
|
||||||
|
renderSwirl(entity, true, partialTicks, size);
|
||||||
|
|
||||||
|
GL11.glScalef(size, size, size*10);
|
||||||
|
|
||||||
|
bindTexture(blastTexture);
|
||||||
|
blastModel.renderAll();
|
||||||
|
|
||||||
|
|
||||||
|
GL11.glScalef(0.2F, 0.2F, 0.2F);
|
||||||
|
|
||||||
|
/*FLARE START
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
BufferBuilder buf = tessellator.getBuffer();
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
int j = 75;//entity.ticksExisted > 250 ? 250 : entity.ticksExisted;
|
||||||
|
float f1 = (j + 2.0F) / 200.0F;
|
||||||
|
float f2 = 0.0F;
|
||||||
|
int count = 250;
|
||||||
|
|
||||||
|
/*if(entity.ticksExisted < 250)
|
||||||
|
{
|
||||||
|
count = entity.ticksExisted * 3;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/*count = j;
|
||||||
|
|
||||||
|
if (f1 > 0.8F)
|
||||||
|
{
|
||||||
|
f2 = (f1 - 0.8F) / 0.2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
Random random = new Random(432L);
|
||||||
|
GlStateManager.disableTexture2D();
|
||||||
|
GlStateManager.shadeModel(GL11.GL_SMOOTH);
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE);
|
||||||
|
GlStateManager.disableAlpha();
|
||||||
|
GlStateManager.enableCull();
|
||||||
|
GlStateManager.depthMask(false);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
//for (int i = 0; (float)i < (f1 + f1 * f1) / 2.0F * 60.0F; ++i)
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
buf.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
|
||||||
|
float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
|
||||||
|
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
|
||||||
|
//Drillgon200: Ah yes, numbers even more magic than the original. '0.53725490196F, 0.54509803921F, 0.2F' essentially means 'light yellow'
|
||||||
|
buf.pos(0.0D, 0.0D, 0.0D).color(0.53725490196F, 0.54509803921F, 0.2F, 1.0F).endVertex();
|
||||||
|
buf.pos(-0.866D * f4, f3, -0.5F * f4).color(0.53725490196F, 0.54509803921F, 0.2F, 0.0F).endVertex();
|
||||||
|
buf.pos(0.866D * f4, f3, -0.5F * f4).color(0.53725490196F, 0.54509803921F, 0.2F, 0.0F).endVertex();
|
||||||
|
buf.pos(0.0D, f3, 1.0F * f4).color(0.53725490196F, 0.54509803921F, 0.2F, 0.0F).endVertex();
|
||||||
|
buf.pos(-0.866D * f4, f3, -0.5F * f4).color(0.53725490196F, 0.54509803921F, 0.2F, 0.0F).endVertex();
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GlStateManager.depthMask(true);
|
||||||
|
GlStateManager.disableCull();
|
||||||
|
GlStateManager.blendFunc(SourceFactor.SRC_ALPHA, DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.shadeModel(GL11.GL_FLAT);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
|
GlStateManager.enableAlpha();
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void renderSwirl(Entity entity, boolean hasJet, float interp, float size) {
|
||||||
|
|
||||||
|
bindTexture(diskTexture);
|
||||||
|
|
||||||
|
GL11.glScalef(size, size, size);
|
||||||
|
GL11.glRotatef(entity.getEntityId() % 90 - 45, 1, 0, 0);
|
||||||
|
GL11.glRotatef(entity.getEntityId() % 360, 0, 1, 0);
|
||||||
|
GL11.glRotatef((entity.ticksExisted + interp % 360) * -5, 0, 1, 0);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
Vec3 vec = Vec3.createVectorHelper(1, 0, 0);
|
||||||
|
|
||||||
|
Tessellator tess = Tessellator.instance;
|
||||||
|
tess.startDrawingQuads();
|
||||||
|
|
||||||
|
double s = 3;
|
||||||
|
int count = 16;
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
|
|
||||||
|
tess.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
tess.addVertexWithUV(vec.xCoord * 0.9, 0, vec.zCoord * 0.9, 0.5 + vec.xCoord * 0.25 / s * 0.9, 0.5 + vec.zCoord * 0.25 / s * 0.9);
|
||||||
|
//this.setColorFull(entity, tess);
|
||||||
|
tess.setColorRGBA_I(0xFFFFFF, (int) (255.0F * (1.0F)));
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s, 0, vec.zCoord * s, 0.5 + vec.xCoord * 0.25, 0.5 + vec.zCoord * 0.25);
|
||||||
|
|
||||||
|
vec.rotateAroundY((float)(Math.PI * 2 / count));
|
||||||
|
//this.setColorFull(entity, tess);
|
||||||
|
tess.setColorRGBA_I(0xFFFFFF, (int) (255.0F * (1.0F)));
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s, 0, vec.zCoord * s, 0.5 + vec.xCoord * 0.25, 0.5 + vec.zCoord * 0.25);
|
||||||
|
tess.setColorRGBA_F(0.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
tess.addVertexWithUV(vec.xCoord * 0.9, 0, vec.zCoord * 0.9, 0.5 + vec.xCoord * 0.25 / s * 0.9, 0.5 + vec.zCoord * 0.25 / s * 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
tess.draw();
|
||||||
|
|
||||||
|
tess.startDrawingQuads();
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.0F);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
|
|
||||||
|
//this.setColorFull(entity, tess);
|
||||||
|
tess.setColorRGBA_I(0xFFFFFF, (int) (255.0F * (1.0F)));
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s, 0, vec.zCoord * s, 0.5 + vec.xCoord * 0.25, 0.5 + vec.zCoord * 0.25);
|
||||||
|
//this.setColorNone(entity, tess);
|
||||||
|
tess.setColorRGBA_I(0xFFB900, 0);
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s * 2, 0, vec.zCoord * s * 2, 0.5 + vec.xCoord * 0.5, 0.5 + vec.zCoord * 0.5);
|
||||||
|
|
||||||
|
vec.rotateAroundY((float)(Math.PI * 2 / count));
|
||||||
|
tess.setColorRGBA_I(0xFFB900, 0);
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s * 2, 0, vec.zCoord * s * 2, 0.5 + vec.xCoord * 0.5, 0.5 + vec.zCoord * 0.5);
|
||||||
|
tess.setColorRGBA_I(0xFFFFFF, (int) (255.0F * (1.0F)));
|
||||||
|
tess.addVertexWithUV(vec.xCoord * s, 0, vec.zCoord * s, 0.5 + vec.xCoord * 0.25, 0.5 + vec.zCoord * 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
tess.draw();
|
||||||
|
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
|
||||||
|
/*for(int j = -1; j <= 1; j += 2) {
|
||||||
|
tess.startDrawing(GL11.GL_TRIANGLE_FAN);
|
||||||
|
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.35F);
|
||||||
|
tess.addVertex(0, 0, 0);
|
||||||
|
tess.setColorRGBA_F(1.0F, 1.0F, 1.0F, 0.0F);
|
||||||
|
|
||||||
|
Vec3 jet = Vec3.createVectorHelper(0.5, 0, 0);
|
||||||
|
|
||||||
|
for(int i = 0; i <= 12; i++) {
|
||||||
|
|
||||||
|
tess.addVertex(jet.xCoord, 10 * j, jet.zCoord);
|
||||||
|
jet.rotateAroundY((float)(Math.PI / 6 * -j));
|
||||||
|
}
|
||||||
|
|
||||||
|
tess.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityBlackHole entity) {
|
||||||
|
return hole;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
409
src/main/java/trinity/render/entity/RenderFallout.java
Normal file
409
src/main/java/trinity/render/entity/RenderFallout.java
Normal file
|
@ -0,0 +1,409 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.culling.ICamera;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraftforge.client.IRenderHandler;
|
||||||
|
|
||||||
|
public class RenderFallout extends Render<EntityFalloutRain> {
|
||||||
|
|
||||||
|
private Minecraft mc;
|
||||||
|
private Random random = new Random();
|
||||||
|
float[] rainXCoords;
|
||||||
|
float[] rainYCoords;
|
||||||
|
private int rendererUpdateCount;
|
||||||
|
private DynamicTexture lightmapTexture;
|
||||||
|
private ResourceLocation locationLightMap;
|
||||||
|
long lastTime = System.nanoTime();
|
||||||
|
private static final ResourceLocation BLACK_RAIN_TEXTURES = new ResourceLocation("textures/environment/snow.png");
|
||||||
|
private static final ResourceLocation falloutTexture = new ResourceLocation(Reference.MODID, "textures/fallout.png");
|
||||||
|
private float previousPartialTicks =-1;
|
||||||
|
|
||||||
|
public RenderFallout(RenderManager renderManager) {
|
||||||
|
super(renderManager);
|
||||||
|
this.mc = Minecraft.getMinecraft();
|
||||||
|
this.rainXCoords = new float[1024];
|
||||||
|
this.rainYCoords = new float[1024];
|
||||||
|
for (int i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 32; ++j)
|
||||||
|
{
|
||||||
|
float f = (float)(j - 16);
|
||||||
|
float f1 = (float)(i - 16);
|
||||||
|
float f2 = MathHelper.sqrt(f * f + f1 * f1);
|
||||||
|
this.rainXCoords[i << 5 | j] = -f1 / f2;
|
||||||
|
this.rainYCoords[i << 5 | j] = f / f2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender(EntityFalloutRain livingEntity, ICamera camera, double camX, double camY, double camZ) {
|
||||||
|
if(TrinityConfig.fallout_rendering)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityFalloutRain entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
if(TrinityConfig.fallout_rendering)
|
||||||
|
{
|
||||||
|
if(previousPartialTicks==partialTicks)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
previousPartialTicks =partialTicks;
|
||||||
|
}
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
Entity ent = this.mc.getRenderViewEntity();
|
||||||
|
Vec3 vector = Vec3.createVectorHelper(ent.posX - entity.posX,
|
||||||
|
ent.posY - entity.posY, ent.posZ - entity.posZ);
|
||||||
|
|
||||||
|
double d = vector.lengthVector();
|
||||||
|
|
||||||
|
if (d <= entity.getScale()) {
|
||||||
|
rendererUpdateCount++;
|
||||||
|
long time = System.nanoTime();
|
||||||
|
float t = (time - lastTime) / 50000000;
|
||||||
|
if (t <= 1.0F)
|
||||||
|
renderRainSnow2(t);
|
||||||
|
else
|
||||||
|
renderRainSnow2(1.0F);
|
||||||
|
|
||||||
|
lastTime = time;
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderRainSnow(float p_78474_1_) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
IRenderHandler renderer = null;
|
||||||
|
if ((renderer = this.mc.world.provider.getWeatherRenderer()) != null) {
|
||||||
|
renderer.render(p_78474_1_, this.mc.world, mc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f1 = 1;
|
||||||
|
|
||||||
|
if (f1 > 0.0F) {
|
||||||
|
|
||||||
|
if (this.rainXCoords == null) {
|
||||||
|
this.rainXCoords = new float[1024];
|
||||||
|
this.rainYCoords = new float[1024];
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; ++i) {
|
||||||
|
for (int j = 0; j < 32; ++j) {
|
||||||
|
float f2 = j - 16;
|
||||||
|
float f3 = i - 16;
|
||||||
|
float f4 = MathHelper.sqrt(f2 * f2 + f3 * f3);
|
||||||
|
this.rainXCoords[i << 5 | j] = -f3 / f4;
|
||||||
|
this.rainYCoords[i << 5 | j] = f2 / f4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entitylivingbase = this.mc.getRenderViewEntity();
|
||||||
|
WorldClient worldclient = this.mc.world;
|
||||||
|
int k2 = MathHelper.floor(entitylivingbase.posX);
|
||||||
|
int l2 = MathHelper.floor(entitylivingbase.posY);
|
||||||
|
int i3 = MathHelper.floor(entitylivingbase.posZ);
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
double d0 = entitylivingbase.lastTickPosX
|
||||||
|
+ (entitylivingbase.posX - entitylivingbase.lastTickPosX) * p_78474_1_;
|
||||||
|
double d1 = entitylivingbase.lastTickPosY
|
||||||
|
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * p_78474_1_;
|
||||||
|
double d2 = entitylivingbase.lastTickPosZ
|
||||||
|
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * p_78474_1_;
|
||||||
|
int k = MathHelper.floor(d1);
|
||||||
|
byte b0 = 5;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics) {
|
||||||
|
b0 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
byte b1 = -1;
|
||||||
|
float f5 = this.rendererUpdateCount + p_78474_1_;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics) {
|
||||||
|
b0 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
for (int l = i3 - b0; l <= i3 + b0; ++l) {
|
||||||
|
for (int i1 = k2 - b0; i1 <= k2 + b0; ++i1) {
|
||||||
|
int j1 = (l - i3 + 16) * 32 + i1 - k2 + 16;
|
||||||
|
float f6 = this.rainXCoords[j1] * 0.5F;
|
||||||
|
float f7 = this.rainYCoords[j1] * 0.5F;
|
||||||
|
pos.setPos(i1, 50, l);
|
||||||
|
Biome biomegenbase = worldclient.getBiomeForCoordsBody(pos);
|
||||||
|
|
||||||
|
{
|
||||||
|
int k1 = worldclient.getPrecipitationHeight(pos).getY();
|
||||||
|
int l1 = l2 - b0;
|
||||||
|
int i2 = l2 + b0;
|
||||||
|
|
||||||
|
if (l1 < k1) {
|
||||||
|
l1 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i2 < k1) {
|
||||||
|
i2 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f8 = 1.0F;
|
||||||
|
int j2 = k1;
|
||||||
|
|
||||||
|
if (k1 < k) {
|
||||||
|
j2 = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l1 != i2) {
|
||||||
|
pos.setY(l1);
|
||||||
|
this.random.setSeed(i1 * i1 * 3121 + i1 * 45238971 ^ l * l * 418711 + l * 13761);
|
||||||
|
float f9 = biomegenbase.getTemperature(pos);
|
||||||
|
float f10;
|
||||||
|
double d4;
|
||||||
|
{
|
||||||
|
if (b1 != 1) {
|
||||||
|
if (b1 >= 0) {
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
b1 = 1;
|
||||||
|
this.mc.getTextureManager().bindTexture(RenderFallout.falloutTexture);
|
||||||
|
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);;
|
||||||
|
}
|
||||||
|
|
||||||
|
f10 = ((this.rendererUpdateCount & 511) + p_78474_1_) / 512.0F;
|
||||||
|
float f16 = this.random.nextFloat() + f5 * 0.01F * (float) this.random.nextGaussian();
|
||||||
|
float f11 = this.random.nextFloat() + f5 * (float) this.random.nextGaussian() * 0.001F;
|
||||||
|
d4 = i1 + 0.5F - entitylivingbase.posX;
|
||||||
|
double d5 = l + 0.5F - entitylivingbase.posZ;
|
||||||
|
float f14 = MathHelper.sqrt(d4 * d4 + d5 * d5) / b0;
|
||||||
|
float f15 = 1.0F;
|
||||||
|
BufferBuilder buf = tessellator.getBuffer();
|
||||||
|
int bright = (int)(worldclient.getLightBrightness(pos.setPos(i1, j2, l)) * 3 + 15728880 / 4);
|
||||||
|
buf.color(f15, f15, f15, ((1.0F - f14 * f14) * 0.3F + 0.5F) * f1);
|
||||||
|
buf.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
|
||||||
|
|
||||||
|
buf.pos(i1 - f6 + 0.5D, l1, l - f7 + 0.5D).tex(0.0F * f8 + f16, l1 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 + f6 + 0.5D, l1, l + f7 + 0.5D).tex(1.0F * f8 + f16, l1 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 + f6 + 0.5D, i2, l + f7 + 0.5D).tex(1.0F * f8 + f16, i2 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 - f6 + 0.5D, i2, l - f7 + 0.5D).tex(0.0F * f8 + f16, i2 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.setTranslation(0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b1 >= 0) {
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderRainSnow2(float partialTicks)
|
||||||
|
{
|
||||||
|
float f = 1;
|
||||||
|
|
||||||
|
if (f > 0.0F)
|
||||||
|
{
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
//EntityRenderer.enableLightmap();
|
||||||
|
Entity entity = this.mc.getRenderViewEntity();
|
||||||
|
World world = this.mc.world;
|
||||||
|
int i = MathHelper.floor(entity.posX);
|
||||||
|
int j = MathHelper.floor(entity.posY);
|
||||||
|
int k = MathHelper.floor(entity.posZ);
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||||
|
GlStateManager.disableCull();
|
||||||
|
GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
|
GlStateManager.alphaFunc(516, 0.1F);
|
||||||
|
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
|
||||||
|
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
|
||||||
|
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
|
||||||
|
int l = MathHelper.floor(d1);
|
||||||
|
int i1 = 5;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics)
|
||||||
|
{
|
||||||
|
i1 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int j1 = -1;
|
||||||
|
float f1 = (float)this.rendererUpdateCount + partialTicks;
|
||||||
|
bufferbuilder.setTranslation(-d0, -d1, -d2);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
for (int k1 = k - i1; k1 <= k + i1; ++k1)
|
||||||
|
{
|
||||||
|
for (int l1 = i - i1; l1 <= i + i1; ++l1)
|
||||||
|
{
|
||||||
|
int i2 = (k1 - k + 16) * 32 + l1 - i + 16;
|
||||||
|
double d3 = (double)this.rainXCoords[i2] * 0.5D;
|
||||||
|
double d4 = (double)this.rainYCoords[i2] * 0.5D;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, 0, k1);
|
||||||
|
Biome biome = world.getBiome(blockpos$mutableblockpos);
|
||||||
|
|
||||||
|
//if (biome.canRain() || biome.getEnableSnow())
|
||||||
|
//{
|
||||||
|
int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
|
||||||
|
int k2 = j - i1;
|
||||||
|
int l2 = j + i1;
|
||||||
|
|
||||||
|
if (k2 < j2)
|
||||||
|
{
|
||||||
|
k2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l2 < j2)
|
||||||
|
{
|
||||||
|
l2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i3 = j2;
|
||||||
|
|
||||||
|
if (j2 < l)
|
||||||
|
{
|
||||||
|
i3 = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k2 != l2)
|
||||||
|
{
|
||||||
|
this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761));
|
||||||
|
blockpos$mutableblockpos.setPos(l1, k2, k1);
|
||||||
|
float f2 = biome.getTemperature(blockpos$mutableblockpos);
|
||||||
|
|
||||||
|
//if (world.getBiomeProvider().getTemperatureAtHeight(f2, j2) >= 0.15F)
|
||||||
|
/*if (world.getRainStrength(partialTicks) > 0.15F)
|
||||||
|
{
|
||||||
|
if (j1 != 0)
|
||||||
|
{
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
j1 = 0;
|
||||||
|
this.mc.getTextureManager().bindTexture(BLACK_RAIN_TEXTURES);
|
||||||
|
bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
double d5 = -((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble());
|
||||||
|
double d6 = (double)((float)l1 + 0.5F) - entity.posX;
|
||||||
|
double d7 = (double)((float)k1 + 0.5F) - entity.posZ;
|
||||||
|
float f3 = MathHelper.sqrt(d6 * d6 + d7 * d7) / (float)i1;
|
||||||
|
float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, i3, k1);
|
||||||
|
int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0);
|
||||||
|
int k3 = j3 >> 16 & 65535;
|
||||||
|
int l3 = j3 & 65535;
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
}
|
||||||
|
else*/
|
||||||
|
{
|
||||||
|
if (j1 != 1)
|
||||||
|
{
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
j1 = 1;
|
||||||
|
this.mc.getTextureManager().bindTexture(falloutTexture);
|
||||||
|
bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
double d8 = (double)(-((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F);
|
||||||
|
double d9 = this.random.nextDouble() + (double)f1 * 0.01D * (double)((float)this.random.nextGaussian());
|
||||||
|
double d10 = this.random.nextDouble() + (double)(f1 * (float)this.random.nextGaussian()) * 0.001D;
|
||||||
|
double d11 = (double)((float)l1 + 0.5F) - entity.posX;
|
||||||
|
double d12 = (double)((float)k1 + 0.5F) - entity.posZ;
|
||||||
|
float f6 = MathHelper.sqrt(d11 * d11 + d12 * d12) / (float)i1;
|
||||||
|
float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, i3, k1);
|
||||||
|
int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4;
|
||||||
|
int j4 = i4 >> 16 & 65535;
|
||||||
|
int k4 = i4 & 65535;
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D);
|
||||||
|
GlStateManager.enableCull();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.alphaFunc(516, 0.1F);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
//this.disableLightmap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityFalloutRain entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.render.entity.RenderFallout;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
|
|
||||||
|
public class RenderFalloutRainFactory implements IRenderFactory<EntityFalloutRain> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Render<? super EntityFalloutRain> createRenderFor(RenderManager manager) {
|
||||||
|
return new RenderFallout(manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
283
src/main/java/trinity/render/entity/RenderNuclearExplosion.java
Normal file
283
src/main/java/trinity/render/entity/RenderNuclearExplosion.java
Normal file
|
@ -0,0 +1,283 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.entities.EntityNuclearCloud;
|
||||||
|
//import trinity.util.IConstantRenderer;
|
||||||
|
//import trinity.util.Reference;
|
||||||
|
import trinity.util.ResourceManager;
|
||||||
|
import trinity.render.AdvancedModelLoader;
|
||||||
|
import trinity.render.IModelCustom;
|
||||||
|
import trinity.render.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.culling.ICamera;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class RenderNuclearExplosion extends Render<EntityNuclearCloud> {
|
||||||
|
private IModelCustom blastModel;
|
||||||
|
private IModelCustom ringModel;
|
||||||
|
private IModelCustom ringBigModel;
|
||||||
|
public float scale = 0;
|
||||||
|
public float ring = 0;
|
||||||
|
private float previousPartialTicks =-1;
|
||||||
|
public RenderNuclearExplosion(RenderManager renderManager) {
|
||||||
|
super(renderManager);
|
||||||
|
blastModel = AdvancedModelLoader.loadModel(ResourceManager.objTesterModelRL);
|
||||||
|
ringModel = AdvancedModelLoader.loadModel(ResourceManager.ringModelRL);
|
||||||
|
ringBigModel = AdvancedModelLoader.loadModel(ResourceManager.ringBigModelRL);
|
||||||
|
scale = 0;
|
||||||
|
ring = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender(EntityNuclearCloud livingEntity, ICamera camera, double camX, double camY, double camZ)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityNuclearCloud cloud, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
if(previousPartialTicks==partialTicks)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
previousPartialTicks =partialTicks;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_LIGHTING_BIT);
|
||||||
|
GL11.glTranslatef((float)x, (float)y + 0.25F, (float)z);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
float size = cloud.getDataManager().get(EntityNuclearCloud.SCALE);
|
||||||
|
GL11.glScalef(size, size, size);
|
||||||
|
int age = cloud.age;
|
||||||
|
int shockScale = age * 4;
|
||||||
|
int fireScale = (int)((age - 25) * 1.5);
|
||||||
|
if(age < 50) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glColor4f(0.2F, 0.2F, 0.2F, 0.9F);
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||||
|
|
||||||
|
GL11.glScalef(shockScale, shockScale, shockScale);
|
||||||
|
GL11.glScalef(2, 2, 2);
|
||||||
|
|
||||||
|
for(float i = 0.9F; i <= 1; i += 0.05F) {
|
||||||
|
GL11.glScalef(i, i, i);
|
||||||
|
ResourceManager.sphere_ruv.renderAll();
|
||||||
|
ResourceManager.sphere_iuv.renderAll();
|
||||||
|
GL11.glScalef(1/i, 1/i, 1/i);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
|
||||||
|
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||||
|
|
||||||
|
GL11.glScalef(0.6F, 1F / shockScale * 5, 0.6F);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glScalef(1.1F, 1F, 1.1F);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glScalef(1.1F, 1F, 1.1F);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
{
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
RenderHelper.disableStandardItemLighting();
|
||||||
|
float f1 = (cloud.ticksExisted + 2.0F) / 200.0F;
|
||||||
|
float f2 = 0.0F;
|
||||||
|
int count = 250;
|
||||||
|
|
||||||
|
if(cloud.ticksExisted < 250)
|
||||||
|
{
|
||||||
|
count = cloud.ticksExisted * 3;
|
||||||
|
}
|
||||||
|
if (f1 > 0.8F)
|
||||||
|
{
|
||||||
|
f2 = (f1 - 0.8F) / 0.2F;
|
||||||
|
}
|
||||||
|
|
||||||
|
Random random = new Random(432L);
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||||
|
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslatef((float)x, (float)y, (float)z);
|
||||||
|
GL11.glScalef(shockScale, shockScale, shockScale);
|
||||||
|
|
||||||
|
for(int i = 0; i < count; i++)
|
||||||
|
{
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glRotatef(random.nextFloat() * 360.0F + f1 * 90.0F, 0.0F, 0.0F, 1.0F);
|
||||||
|
tessellator.startDrawing(6);
|
||||||
|
float f3 = random.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
|
||||||
|
float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
|
||||||
|
tessellator.setColorRGBA_I(59345715, (int)(255.0F * (1.0F - f2)));
|
||||||
|
tessellator.addVertex(0.0D, 0.0D, 0.0D);
|
||||||
|
tessellator.setColorRGBA_I(59345735, 0);
|
||||||
|
tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
|
||||||
|
tessellator.addVertex(0.866D * f4, f3, -0.5F * f4);
|
||||||
|
tessellator.addVertex(0.0D, f3, 1.0F * f4);
|
||||||
|
tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4);
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
GL11.glDepthMask(true);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
RenderHelper.enableStandardItemLighting();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(age >= 50 && age < 150) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
if(cloud.getDataManager().get(EntityNuclearCloud.SOMETHING) == 1)
|
||||||
|
GL11.glColor4f(0.2F, 0.7F, 0.0F, 0.9F);
|
||||||
|
else
|
||||||
|
GL11.glColor4f(0.4F, 0.15F, 0.0F, 0.9F);
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
|
||||||
|
GL11.glTranslatef(0, fireScale * 0.75F, 0);
|
||||||
|
|
||||||
|
GL11.glScalef(fireScale * 0.85F, fireScale, fireScale * 0.85F);
|
||||||
|
|
||||||
|
for(float i = 0.6F; i <= 1; i += 0.2F) {
|
||||||
|
GL11.glScalef(i, i, i);
|
||||||
|
ResourceManager.sphere_ruv.renderAll();
|
||||||
|
GL11.glScalef(1/i, 1/i, 1/i);
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(age >= 150) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
bindTexture(getEntityTexture(cloud));
|
||||||
|
GL11.glTranslatef(0, -40, 0);
|
||||||
|
GL11.glScalef(6, 6, 6);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
blastModel.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glScalef(1.5F, 1.5F, 1.5F);
|
||||||
|
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||||
|
GL11.glScalef(10, 10, 10);
|
||||||
|
float f = 1.8F + (((float)Math.sin(((double)age) / 20 + 90) * 0.25F) * 0.5F);
|
||||||
|
float f1 = 1 + ((float)Math.sin(((double)age) / 10) * 0.15F);
|
||||||
|
GL11.glScalef(f, 1, f);
|
||||||
|
GL11.glTranslatef(0, 3.5F + f1 * 0.25F, 0);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glTranslatef(0, - f1 * 0.25F * 2, 0);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(age >= 50) {
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glScalef(2, 2, 2);
|
||||||
|
GL11.glColor4f(0.4F, 0.4F, 0.4F, 1F);
|
||||||
|
float f = (float)Math.min((age - 50) * 0.5, 20);
|
||||||
|
GL11.glScalef(f, 15, f);
|
||||||
|
GL11.glScalef(1.5F, 1, 1.5F);
|
||||||
|
GL11.glTranslatef(0, -0.15F, 0);
|
||||||
|
GL11.glScalef(1.5F, 1, 1.5F);
|
||||||
|
GL11.glTranslatef(0, -0.15F, 0);
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glScalef(2, 2, 2);
|
||||||
|
GL11.glColor4f(0.6F, 0.6F, 0.6F, 1F);
|
||||||
|
float f0 = (float)Math.min((age - 50) * 0.25, 20) * 5F;
|
||||||
|
GL11.glScalef(f0, 15, f0);
|
||||||
|
GL11.glTranslatef(0, 3.5F, 0);
|
||||||
|
ringBigModel.renderAll();
|
||||||
|
GL11.glTranslatef(0, 1F, 0);
|
||||||
|
GL11.glScalef(0.65F, 1, 0.65F);
|
||||||
|
ringModel.renderAll();
|
||||||
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
/*GL11.glPushMatrix();
|
||||||
|
GL11.glDepthMask(false);
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
GL11.glTranslatef(0, 50, 0);
|
||||||
|
|
||||||
|
//double size = radius * 4;
|
||||||
|
|
||||||
|
this.bindTexture(ResourceManager.shockwave);
|
||||||
|
|
||||||
|
//top render
|
||||||
|
Tessellator tessellator = Tessellator.instance;
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-f0*2, 0, -f0*2, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(-f0*2, 0, +f0*2, 0, 1);
|
||||||
|
tessellator.addVertexWithUV(+f0*2, 0, +f0*2, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(+f0*2, 0, -f0*2, 1, 0);
|
||||||
|
tessellator.draw();
|
||||||
|
|
||||||
|
//bottom render
|
||||||
|
GL11.glRotatef(180, 1, 0, 0);
|
||||||
|
tessellator.startDrawingQuads();
|
||||||
|
tessellator.setBrightness(240);
|
||||||
|
tessellator.setColorRGBA_F(1.0F, 1.0F, 1.0F, 1F);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, -size, 1, 1);
|
||||||
|
tessellator.addVertexWithUV(-size, 0, +size, 1, 0);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, +size, 0, 0);
|
||||||
|
tessellator.addVertexWithUV(+size, 0, -size, 0, 1);
|
||||||
|
tessellator.draw();
|
||||||
|
GL11.glPopMatrix();*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glPopAttrib();
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityNuclearCloud entity) {
|
||||||
|
return ResourceManager.fireball;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,88 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.renderer.BlockRendererDispatcher;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
|
import trinity.entities.EntityDirtyBomb;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public class RenderPrimedDirtyBomb extends Render<EntityDirtyBomb>
|
||||||
|
{
|
||||||
|
public RenderPrimedDirtyBomb(RenderManager renderManagerIn)
|
||||||
|
{
|
||||||
|
super(renderManagerIn);
|
||||||
|
this.shadowSize = 0.5F;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Renders the desired {@code T} type Entity.
|
||||||
|
*/
|
||||||
|
public void doRender(EntityDirtyBomb entity, double x, double y, double z, float entityYaw, float partialTicks)
|
||||||
|
{
|
||||||
|
BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate((float)x, (float)y + 0.5F, (float)z);
|
||||||
|
|
||||||
|
if ((float)entity.getFuse() - partialTicks + 1.0F < 10.0F)
|
||||||
|
{
|
||||||
|
float f = 1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 10.0F;
|
||||||
|
f = MathHelper.clamp(f, 0.0F, 1.0F);
|
||||||
|
f = f * f;
|
||||||
|
f = f * f;
|
||||||
|
float f1 = 1.0F + f * 0.3F;
|
||||||
|
GlStateManager.scale(f1, f1, f1);
|
||||||
|
}
|
||||||
|
|
||||||
|
float f2 = (1.0F - ((float)entity.getFuse() - partialTicks + 1.0F) / 100.0F) * 0.8F;
|
||||||
|
this.bindEntityTexture(entity);
|
||||||
|
GlStateManager.rotate(-90.0F, 0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.translate(-0.5F, -0.5F, 0.5F);
|
||||||
|
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), entity.getBrightness());
|
||||||
|
GlStateManager.translate(0.0F, 0.0F, 1.0F);
|
||||||
|
|
||||||
|
if (this.renderOutlines)
|
||||||
|
{
|
||||||
|
GlStateManager.enableColorMaterial();
|
||||||
|
GlStateManager.enableOutlineMode(this.getTeamColor(entity));
|
||||||
|
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 1.0F);
|
||||||
|
GlStateManager.disableOutlineMode();
|
||||||
|
GlStateManager.disableColorMaterial();
|
||||||
|
}
|
||||||
|
else if (entity.getFuse() / 5 % 2 == 0)
|
||||||
|
{
|
||||||
|
GlStateManager.disableTexture2D();
|
||||||
|
GlStateManager.disableLighting();
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.DST_ALPHA);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, f2);
|
||||||
|
GlStateManager.doPolygonOffset(-3.0F, -3.0F);
|
||||||
|
GlStateManager.enablePolygonOffset();
|
||||||
|
blockrendererdispatcher.renderBlockBrightness(Blocks.TNT.getDefaultState(), 1.0F);
|
||||||
|
GlStateManager.doPolygonOffset(0.0F, 0.0F);
|
||||||
|
GlStateManager.disablePolygonOffset();
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.enableLighting();
|
||||||
|
GlStateManager.enableTexture2D();
|
||||||
|
}
|
||||||
|
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
super.doRender(entity, x, y, z, entityYaw, partialTicks);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the location of an entity's texture. Doesn't seem to be called unless you call Render.bindEntityTexture.
|
||||||
|
*/
|
||||||
|
protected ResourceLocation getEntityTexture(EntityDirtyBomb entity)
|
||||||
|
{
|
||||||
|
return TextureMap.LOCATION_BLOCKS_TEXTURE;
|
||||||
|
}
|
||||||
|
}
|
410
src/main/java/trinity/render/entity/RenderThermalBlast.java
Normal file
410
src/main/java/trinity/render/entity/RenderThermalBlast.java
Normal file
|
@ -0,0 +1,410 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import trinity.entities.EntityThermalBlast;
|
||||||
|
//import trinity.entities.EntityFalloutRain;
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import trinity.handler.Vec3;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.multiplayer.WorldClient;
|
||||||
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
|
import net.minecraft.client.renderer.EntityRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.culling.ICamera;
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.math.BlockPos.MutableBlockPos;
|
||||||
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraftforge.client.IRenderHandler;
|
||||||
|
|
||||||
|
public class RenderThermalBlast extends Render<EntityThermalBlast> {
|
||||||
|
|
||||||
|
private Minecraft mc;
|
||||||
|
private Random random = new Random();
|
||||||
|
float[] rainXCoords;
|
||||||
|
float[] rainYCoords;
|
||||||
|
private int rendererUpdateCount;
|
||||||
|
private DynamicTexture lightmapTexture;
|
||||||
|
private ResourceLocation locationLightMap;
|
||||||
|
long lastTime = System.nanoTime();
|
||||||
|
private static final ResourceLocation BLACK_RAIN_TEXTURES = new ResourceLocation("textures/environment/snow.png");
|
||||||
|
private static final ResourceLocation falloutTexture = new ResourceLocation(Reference.MODID, "textures/fallout.png");
|
||||||
|
private float previousPartialTicks =-1;
|
||||||
|
|
||||||
|
public RenderThermalBlast(RenderManager renderManager) {
|
||||||
|
super(renderManager);
|
||||||
|
this.mc = Minecraft.getMinecraft();
|
||||||
|
this.rainXCoords = new float[1024];
|
||||||
|
this.rainYCoords = new float[1024];
|
||||||
|
for (int i = 0; i < 32; ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < 32; ++j)
|
||||||
|
{
|
||||||
|
float f = (float)(j - 16);
|
||||||
|
float f1 = (float)(i - 16);
|
||||||
|
float f2 = MathHelper.sqrt(f * f + f1 * f1);
|
||||||
|
this.rainXCoords[i << 5 | j] = -f1 / f2;
|
||||||
|
this.rainYCoords[i << 5 | j] = f / f2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldRender(EntityThermalBlast livingEntity, ICamera camera, double camX, double camY, double camZ) {
|
||||||
|
if(TrinityConfig.fallout_rendering)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void doRender(EntityThermalBlast entity, double x, double y, double z, float entityYaw, float partialTicks) {
|
||||||
|
if(TrinityConfig.fallout_rendering)
|
||||||
|
{
|
||||||
|
if(previousPartialTicks==partialTicks)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
previousPartialTicks =partialTicks;
|
||||||
|
}
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
Entity ent = this.mc.getRenderViewEntity();
|
||||||
|
Vec3 vector = Vec3.createVectorHelper(ent.posX - entity.posX,
|
||||||
|
ent.posY - entity.posY, ent.posZ - entity.posZ);
|
||||||
|
|
||||||
|
double d = vector.lengthVector();
|
||||||
|
|
||||||
|
if (d <= entity.getScale()) {
|
||||||
|
rendererUpdateCount++;
|
||||||
|
long time = System.nanoTime();
|
||||||
|
float t = (time - lastTime) / 50000000;
|
||||||
|
if (t <= 1.0F)
|
||||||
|
renderRainSnow2(t);
|
||||||
|
else
|
||||||
|
renderRainSnow2(1.0F);
|
||||||
|
|
||||||
|
lastTime = time;
|
||||||
|
}
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderRainSnow(float p_78474_1_) {
|
||||||
|
MutableBlockPos pos = new BlockPos.MutableBlockPos();
|
||||||
|
IRenderHandler renderer = null;
|
||||||
|
if ((renderer = this.mc.world.provider.getWeatherRenderer()) != null) {
|
||||||
|
renderer.render(p_78474_1_, this.mc.world, mc);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f1 = 1;
|
||||||
|
|
||||||
|
if (f1 > 0.0F) {
|
||||||
|
|
||||||
|
if (this.rainXCoords == null) {
|
||||||
|
this.rainXCoords = new float[1024];
|
||||||
|
this.rainYCoords = new float[1024];
|
||||||
|
|
||||||
|
for (int i = 0; i < 32; ++i) {
|
||||||
|
for (int j = 0; j < 32; ++j) {
|
||||||
|
float f2 = j - 16;
|
||||||
|
float f3 = i - 16;
|
||||||
|
float f4 = MathHelper.sqrt(f2 * f2 + f3 * f3);
|
||||||
|
this.rainXCoords[i << 5 | j] = -f3 / f4;
|
||||||
|
this.rainYCoords[i << 5 | j] = f2 / f4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Entity entitylivingbase = this.mc.getRenderViewEntity();
|
||||||
|
WorldClient worldclient = this.mc.world;
|
||||||
|
int k2 = MathHelper.floor(entitylivingbase.posX);
|
||||||
|
int l2 = MathHelper.floor(entitylivingbase.posY);
|
||||||
|
int i3 = MathHelper.floor(entitylivingbase.posZ);
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
double d0 = entitylivingbase.lastTickPosX
|
||||||
|
+ (entitylivingbase.posX - entitylivingbase.lastTickPosX) * p_78474_1_;
|
||||||
|
double d1 = entitylivingbase.lastTickPosY
|
||||||
|
+ (entitylivingbase.posY - entitylivingbase.lastTickPosY) * p_78474_1_;
|
||||||
|
double d2 = entitylivingbase.lastTickPosZ
|
||||||
|
+ (entitylivingbase.posZ - entitylivingbase.lastTickPosZ) * p_78474_1_;
|
||||||
|
int k = MathHelper.floor(d1);
|
||||||
|
byte b0 = 5;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics) {
|
||||||
|
b0 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean flag = false;
|
||||||
|
byte b1 = -1;
|
||||||
|
float f5 = this.rendererUpdateCount + p_78474_1_;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics) {
|
||||||
|
b0 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
flag = false;
|
||||||
|
|
||||||
|
for (int l = i3 - b0; l <= i3 + b0; ++l) {
|
||||||
|
for (int i1 = k2 - b0; i1 <= k2 + b0; ++i1) {
|
||||||
|
int j1 = (l - i3 + 16) * 32 + i1 - k2 + 16;
|
||||||
|
float f6 = this.rainXCoords[j1] * 0.5F;
|
||||||
|
float f7 = this.rainYCoords[j1] * 0.5F;
|
||||||
|
pos.setPos(i1, 50, l);
|
||||||
|
Biome biomegenbase = worldclient.getBiomeForCoordsBody(pos);
|
||||||
|
|
||||||
|
{
|
||||||
|
int k1 = worldclient.getPrecipitationHeight(pos).getY();
|
||||||
|
int l1 = l2 - b0;
|
||||||
|
int i2 = l2 + b0;
|
||||||
|
|
||||||
|
if (l1 < k1) {
|
||||||
|
l1 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i2 < k1) {
|
||||||
|
i2 = k1;
|
||||||
|
}
|
||||||
|
|
||||||
|
float f8 = 1.0F;
|
||||||
|
int j2 = k1;
|
||||||
|
|
||||||
|
if (k1 < k) {
|
||||||
|
j2 = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l1 != i2) {
|
||||||
|
pos.setY(l1);
|
||||||
|
this.random.setSeed(i1 * i1 * 3121 + i1 * 45238971 ^ l * l * 418711 + l * 13761);
|
||||||
|
float f9 = biomegenbase.getTemperature(pos);
|
||||||
|
float f10;
|
||||||
|
double d4;
|
||||||
|
{
|
||||||
|
if (b1 != 1) {
|
||||||
|
if (b1 >= 0) {
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
b1 = 1;
|
||||||
|
this.mc.getTextureManager().bindTexture(RenderThermalBlast.falloutTexture);
|
||||||
|
tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);;
|
||||||
|
}
|
||||||
|
|
||||||
|
f10 = ((this.rendererUpdateCount & 511) + p_78474_1_) / 512.0F;
|
||||||
|
float f16 = this.random.nextFloat() + f5 * 0.01F * (float) this.random.nextGaussian();
|
||||||
|
float f11 = this.random.nextFloat() + f5 * (float) this.random.nextGaussian() * 0.001F;
|
||||||
|
d4 = i1 + 0.5F - entitylivingbase.posX;
|
||||||
|
double d5 = l + 0.5F - entitylivingbase.posZ;
|
||||||
|
float f14 = MathHelper.sqrt(d4 * d4 + d5 * d5) / b0;
|
||||||
|
float f15 = 1.0F;
|
||||||
|
BufferBuilder buf = tessellator.getBuffer();
|
||||||
|
int bright = (int)(worldclient.getLightBrightness(pos.setPos(i1, j2, l)) * 3 + 15728880 / 4);
|
||||||
|
buf.color(f15, f15, f15, ((1.0F - f14 * f14) * 0.3F + 0.5F) * f1);
|
||||||
|
buf.setTranslation(-d0 * 1.0D, -d1 * 1.0D, -d2 * 1.0D);
|
||||||
|
|
||||||
|
buf.pos(i1 - f6 + 0.5D, l1, l - f7 + 0.5D).tex(0.0F * f8 + f16, l1 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 + f6 + 0.5D, l1, l + f7 + 0.5D).tex(1.0F * f8 + f16, l1 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 + f6 + 0.5D, i2, l + f7 + 0.5D).tex(1.0F * f8 + f16, i2 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.pos(i1 - f6 + 0.5D, i2, l - f7 + 0.5D).tex(0.0F * f8 + f16, i2 * f8 / 4.0F + f10 * f8 + f11).endVertex();
|
||||||
|
buf.setTranslation(0.0D, 0.0D, 0.0D);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b1 >= 0) {
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void renderRainSnow2(float partialTicks)
|
||||||
|
{
|
||||||
|
float f = 1;
|
||||||
|
|
||||||
|
if (f > 0.0F)
|
||||||
|
{
|
||||||
|
GL11.glEnable(GL11.GL_LIGHTING);
|
||||||
|
//EntityRenderer.enableLightmap();
|
||||||
|
Entity entity = this.mc.getRenderViewEntity();
|
||||||
|
World world = this.mc.world;
|
||||||
|
int i = MathHelper.floor(entity.posX);
|
||||||
|
int j = MathHelper.floor(entity.posY);
|
||||||
|
int k = MathHelper.floor(entity.posZ);
|
||||||
|
Tessellator tessellator = Tessellator.getInstance();
|
||||||
|
BufferBuilder bufferbuilder = tessellator.getBuffer();
|
||||||
|
GlStateManager.disableCull();
|
||||||
|
GlStateManager.glNormal3f(0.0F, 1.0F, 0.0F);
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
|
GlStateManager.alphaFunc(516, 0.1F);
|
||||||
|
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double)partialTicks;
|
||||||
|
double d1 = entity.lastTickPosY + (entity.posY - entity.lastTickPosY) * (double)partialTicks;
|
||||||
|
double d2 = entity.lastTickPosZ + (entity.posZ - entity.lastTickPosZ) * (double)partialTicks;
|
||||||
|
int l = MathHelper.floor(d1);
|
||||||
|
int i1 = 5;
|
||||||
|
|
||||||
|
if (this.mc.gameSettings.fancyGraphics)
|
||||||
|
{
|
||||||
|
i1 = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
int j1 = -1;
|
||||||
|
float f1 = (float)this.rendererUpdateCount + partialTicks;
|
||||||
|
bufferbuilder.setTranslation(-d0, -d1, -d2);
|
||||||
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
for (int k1 = k - i1; k1 <= k + i1; ++k1)
|
||||||
|
{
|
||||||
|
for (int l1 = i - i1; l1 <= i + i1; ++l1)
|
||||||
|
{
|
||||||
|
int i2 = (k1 - k + 16) * 32 + l1 - i + 16;
|
||||||
|
double d3 = (double)this.rainXCoords[i2] * 0.5D;
|
||||||
|
double d4 = (double)this.rainYCoords[i2] * 0.5D;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, 0, k1);
|
||||||
|
Biome biome = world.getBiome(blockpos$mutableblockpos);
|
||||||
|
|
||||||
|
//if (biome.canRain() || biome.getEnableSnow())
|
||||||
|
//{
|
||||||
|
int j2 = world.getPrecipitationHeight(blockpos$mutableblockpos).getY();
|
||||||
|
int k2 = j - i1;
|
||||||
|
int l2 = j + i1;
|
||||||
|
|
||||||
|
if (k2 < j2)
|
||||||
|
{
|
||||||
|
k2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (l2 < j2)
|
||||||
|
{
|
||||||
|
l2 = j2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int i3 = j2;
|
||||||
|
|
||||||
|
if (j2 < l)
|
||||||
|
{
|
||||||
|
i3 = l;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k2 != l2)
|
||||||
|
{
|
||||||
|
this.random.setSeed((long)(l1 * l1 * 3121 + l1 * 45238971 ^ k1 * k1 * 418711 + k1 * 13761));
|
||||||
|
blockpos$mutableblockpos.setPos(l1, k2, k1);
|
||||||
|
float f2 = biome.getTemperature(blockpos$mutableblockpos);
|
||||||
|
|
||||||
|
//if (world.getBiomeProvider().getTemperatureAtHeight(f2, j2) >= 0.15F)
|
||||||
|
/*if (world.getRainStrength(partialTicks) > 0.15F)
|
||||||
|
{
|
||||||
|
if (j1 != 0)
|
||||||
|
{
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
j1 = 0;
|
||||||
|
this.mc.getTextureManager().bindTexture(BLACK_RAIN_TEXTURES);
|
||||||
|
bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
double d5 = -((double)(this.rendererUpdateCount + l1 * l1 * 3121 + l1 * 45238971 + k1 * k1 * 418711 + k1 * 13761 & 31) + (double)partialTicks) / 32.0D * (3.0D + this.random.nextDouble());
|
||||||
|
double d6 = (double)((float)l1 + 0.5F) - entity.posX;
|
||||||
|
double d7 = (double)((float)k1 + 0.5F) - entity.posZ;
|
||||||
|
float f3 = MathHelper.sqrt(d6 * d6 + d7 * d7) / (float)i1;
|
||||||
|
float f4 = ((1.0F - f3 * f3) * 0.5F + 0.5F) * f;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, i3, k1);
|
||||||
|
int j3 = world.getCombinedLight(blockpos$mutableblockpos, 0);
|
||||||
|
int k3 = j3 >> 16 & 65535;
|
||||||
|
int l3 = j3 & 65535;
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)k2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D, (double)l2 * 0.25D + d5).color(1.0F, 1.0F, 1.0F, f4).lightmap(k3, l3).endVertex();
|
||||||
|
}
|
||||||
|
else*/
|
||||||
|
{
|
||||||
|
if (j1 != 1)
|
||||||
|
{
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
j1 = 1;
|
||||||
|
this.mc.getTextureManager().bindTexture(falloutTexture);
|
||||||
|
bufferbuilder.begin(7, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
|
||||||
|
}
|
||||||
|
|
||||||
|
double d8 = (double)(-((float)(this.rendererUpdateCount & 511) + partialTicks) / 512.0F);
|
||||||
|
double d9 = this.random.nextDouble() + (double)f1 * 0.01D * (double)((float)this.random.nextGaussian());
|
||||||
|
double d10 = this.random.nextDouble() + (double)(f1 * (float)this.random.nextGaussian()) * 0.001D;
|
||||||
|
double d11 = (double)((float)l1 + 0.5F) - entity.posX;
|
||||||
|
double d12 = (double)((float)k1 + 0.5F) - entity.posZ;
|
||||||
|
float f6 = MathHelper.sqrt(d11 * d11 + d12 * d12) / (float)i1;
|
||||||
|
float f5 = ((1.0F - f6 * f6) * 0.3F + 0.5F) * f;
|
||||||
|
blockpos$mutableblockpos.setPos(l1, i3, k1);
|
||||||
|
int i4 = (world.getCombinedLight(blockpos$mutableblockpos, 0) * 3 + 15728880) / 4;
|
||||||
|
int j4 = i4 >> 16 & 65535;
|
||||||
|
int k4 = i4 & 65535;
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)l2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)l2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)k2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 + d3 + 0.5D, (double)k2, (double)k1 + d4 + 0.5D).tex(1.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
bufferbuilder.pos((double)l1 - d3 + 0.5D, (double)k2, (double)k1 - d4 + 0.5D).tex(0.0D + d9, (double)l2 * 0.25D + d8 + d10).color(1.0F, 1.0F, 1.0F, f5).lightmap(j4, k4).endVertex();
|
||||||
|
}
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (j1 >= 0)
|
||||||
|
{
|
||||||
|
tessellator.draw();
|
||||||
|
}
|
||||||
|
|
||||||
|
bufferbuilder.setTranslation(0.0D, 0.0D, 0.0D);
|
||||||
|
GlStateManager.enableCull();
|
||||||
|
GlStateManager.disableBlend();
|
||||||
|
GlStateManager.alphaFunc(516, 0.1F);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
//this.disableLightmap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ResourceLocation getEntityTexture(EntityThermalBlast entity) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
package trinity.render.entity;
|
||||||
|
|
||||||
|
import trinity.entities.EntityThermalBlast;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.entity.Render;
|
||||||
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
|
import net.minecraftforge.fml.client.registry.IRenderFactory;
|
||||||
|
|
||||||
|
public class RenderThermalBlastFactory implements IRenderFactory<EntityThermalBlast> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Render<? super EntityThermalBlast> createRenderFor(RenderManager manager) {
|
||||||
|
return new RenderThermalBlast(manager);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
62
src/main/java/trinity/tabs/TrinityTab.java
Normal file
62
src/main/java/trinity/tabs/TrinityTab.java
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
package trinity.tabs;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.google.common.collect.Ordering;
|
||||||
|
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.init.ModBlocks;
|
||||||
|
import trinity.init.ModItems;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.NonNullList;
|
||||||
|
|
||||||
|
public class TrinityTab extends CreativeTabs {
|
||||||
|
|
||||||
|
public TrinityTab() {
|
||||||
|
super("Trinity_Tab");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack createIcon() {
|
||||||
|
return new ItemStack(ModBlocks.bomb_u235);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_) {
|
||||||
|
super.displayAllRelevantItems(p_78018_1_);
|
||||||
|
p_78018_1_.sort(new Comparator<ItemStack>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(ItemStack o1, ItemStack o2) {
|
||||||
|
|
||||||
|
return o1.getDisplayName().compareTo(o2.getDisplayName());
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_) {
|
||||||
|
super.displayAllRelevantItems(p_78018_1_);
|
||||||
|
|
||||||
|
List<Item> order = Arrays.asList(ModItems.bomb_pit_u233,ModItems.bomb_pit_u235,ModItems.bomb_pit_np237,ModItems.bomb_pit_pu239,ModItems.bomb_pit_am242,ModItems.bomb_pit_cm247,ModItems.bomb_pit_bk248,ModItems.bomb_pit_cf249,ModItems.bomb_pit_cf251,Item.getItemFromBlock(ModBlocks.baratol),Item.getItemFromBlock(ModBlocks.compression_charge),Item.getItemFromBlock(ModBlocks.core_u233),Item.getItemFromBlock(ModBlocks.core_u235),Item.getItemFromBlock(ModBlocks.core_np237),Item.getItemFromBlock(ModBlocks.core_pu239),Item.getItemFromBlock(ModBlocks.core_am242),Item.getItemFromBlock(ModBlocks.core_cm247),Item.getItemFromBlock(ModBlocks.core_bk248),Item.getItemFromBlock(ModBlocks.core_cf249),Item.getItemFromBlock(ModBlocks.core_cf251),Item.getItemFromBlock(ModBlocks.bomb_u233),Item.getItemFromBlock(ModBlocks.bomb_u235),Item.getItemFromBlock(ModBlocks.bomb_np237),Item.getItemFromBlock(ModBlocks.bomb_pu239),Item.getItemFromBlock(ModBlocks.bomb_am242),Item.getItemFromBlock(ModBlocks.bomb_cm247),Item.getItemFromBlock(ModBlocks.bomb_bk248),Item.getItemFromBlock(ModBlocks.bomb_cf249),Item.getItemFromBlock(ModBlocks.bomb_cf251),Item.getItemFromBlock(ModBlocks.salted_core_u233),Item.getItemFromBlock(ModBlocks.salted_core_u235),Item.getItemFromBlock(ModBlocks.salted_core_np237),Item.getItemFromBlock(ModBlocks.salted_core_pu239),Item.getItemFromBlock(ModBlocks.salted_core_am242),Item.getItemFromBlock(ModBlocks.salted_core_cm247),Item.getItemFromBlock(ModBlocks.salted_core_bk248),Item.getItemFromBlock(ModBlocks.salted_core_cf249),Item.getItemFromBlock(ModBlocks.salted_core_cf251),Item.getItemFromBlock(ModBlocks.salted_bomb_u233),Item.getItemFromBlock(ModBlocks.salted_bomb_u235),Item.getItemFromBlock(ModBlocks.salted_bomb_np237),Item.getItemFromBlock(ModBlocks.salted_bomb_pu239),Item.getItemFromBlock(ModBlocks.salted_bomb_am242),Item.getItemFromBlock(ModBlocks.salted_bomb_cm247),Item.getItemFromBlock(ModBlocks.salted_bomb_bk248),Item.getItemFromBlock(ModBlocks.salted_bomb_cf249),Item.getItemFromBlock(ModBlocks.salted_bomb_cf251),ModItems.detonator,Item.getItemFromBlock(ModBlocks.trinitite),Item.getItemFromBlock(ModBlocks.solid_trinitite),Item.getItemFromBlock(ModBlocks.radioactive_earth),ModItems.trinitite,ModItems.gem_witherite,ModItems.gem_dust_witherite,ModItems.compound_barium_nitrate);
|
||||||
|
Comparator<Item> c = Ordering.explicit(order);
|
||||||
|
|
||||||
|
Trinity.trinityOrder = Ordering.explicit(order).onResultOf(ItemStack::getItem);
|
||||||
|
p_78018_1_.sort(Trinity.trinityOrder){
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(ItemStack o1, ItemStack o2) {
|
||||||
|
|
||||||
|
return o1.getDisplayName().compareTo(o2.getDisplayName());
|
||||||
|
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
public static final CreativeTabs TRINITY_TAB = new TrinityTab();
|
||||||
|
}
|
303
src/main/java/trinity/tiles/TileEntityShieldedContainer.java
Normal file
303
src/main/java/trinity/tiles/TileEntityShieldedContainer.java
Normal file
|
@ -0,0 +1,303 @@
|
||||||
|
package trinity.tiles;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.nbt.NBTTagList;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.text.ITextComponent;
|
||||||
|
import net.minecraft.util.text.TextComponentString;
|
||||||
|
import net.minecraft.util.text.TextComponentTranslation;
|
||||||
|
import trinity.Trinity;
|
||||||
|
import trinity.blocks.ShieldedContainer;
|
||||||
|
//import trinity.items.RadioactiveSource;
|
||||||
|
import trinity.items.RadioactiveSource2;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import nc.capability.radiation.resistance.IRadiationResistance;
|
||||||
|
import nc.capability.radiation.source.IRadiationSource;
|
||||||
|
import nc.radiation.RadiationHelper;
|
||||||
|
import nc.util.NCMath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: brandon3055
|
||||||
|
* Date: 06/01/2015
|
||||||
|
*
|
||||||
|
* This is a simple tile entity implementing IInventory that can store 9 item stacks
|
||||||
|
*/
|
||||||
|
public class TileEntityShieldedContainer extends TileEntity implements IInventory {
|
||||||
|
// Create and initialize the items variable that will store store the items
|
||||||
|
private final int NUMBER_OF_SLOTS = 9;
|
||||||
|
private ItemStack[] itemStacks;
|
||||||
|
|
||||||
|
public TileEntityShieldedContainer()
|
||||||
|
{
|
||||||
|
itemStacks = new ItemStack[NUMBER_OF_SLOTS];
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* The following are some IInventory methods you are required to override */
|
||||||
|
|
||||||
|
// Gets the number of slots in the inventory
|
||||||
|
@Override
|
||||||
|
public int getSizeInventory() {
|
||||||
|
return itemStacks.length;
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns true if all of the slots in the inventory are empty
|
||||||
|
@Override
|
||||||
|
public boolean isEmpty()
|
||||||
|
{
|
||||||
|
for (ItemStack itemstack : itemStacks) {
|
||||||
|
if (!itemstack.isEmpty()) { // isEmpty()
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad()
|
||||||
|
{
|
||||||
|
IRadiationResistance resistance = this.getCapability(IRadiationResistance.CAPABILITY_RADIATION_RESISTANCE, null);
|
||||||
|
if (resistance == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Block block = this.getBlockType();
|
||||||
|
if(block instanceof ShieldedContainer)
|
||||||
|
{
|
||||||
|
ShieldedContainer shield = ((ShieldedContainer)block);
|
||||||
|
resistance.setShieldingRadResistance(Math.exp(Double.POSITIVE_INFINITY));
|
||||||
|
//resistance.setShieldingRadResistance(Math.exp(shield.shielding)-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Gets the stack in the given slot
|
||||||
|
@Override
|
||||||
|
public ItemStack getStackInSlot(int slotIndex) {
|
||||||
|
return itemStacks[slotIndex];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes some of the units from itemstack in the given slot, and returns as a separate itemstack
|
||||||
|
* @param slotIndex the slot number to remove the items from
|
||||||
|
* @param count the number of units to remove
|
||||||
|
* @return a new itemstack containing the units removed from the slot
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack decrStackSize(int slotIndex, int count) {
|
||||||
|
ItemStack itemStackInSlot = getStackInSlot(slotIndex);
|
||||||
|
if (itemStackInSlot.isEmpty()) return ItemStack.EMPTY; // isEmpt(); EMPTY_ITEM
|
||||||
|
|
||||||
|
ItemStack itemStackRemoved;
|
||||||
|
if (itemStackInSlot.getCount() <= count) { // getStackSize()
|
||||||
|
itemStackRemoved = itemStackInSlot;
|
||||||
|
setInventorySlotContents(slotIndex, ItemStack.EMPTY); // EMPTY_ITEM
|
||||||
|
} else {
|
||||||
|
itemStackRemoved = itemStackInSlot.splitStack(count);
|
||||||
|
if (itemStackInSlot.getCount() == 0) { // getStackSize
|
||||||
|
setInventorySlotContents(slotIndex, ItemStack.EMPTY); // EMPTY_ITEM
|
||||||
|
}
|
||||||
|
}
|
||||||
|
markDirty();
|
||||||
|
return itemStackRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
// overwrites the stack in the given slotIndex with the given stack
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slotIndex, ItemStack itemstack) {
|
||||||
|
itemStacks[slotIndex] = itemstack;
|
||||||
|
if (itemstack.isEmpty() && itemstack.getCount() > getInventoryStackLimit()) { // isEmpty(); getStackSize()
|
||||||
|
itemstack.setCount(getInventoryStackLimit()); //setStackSize
|
||||||
|
}
|
||||||
|
markDirty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is the maximum number if items allowed in each slot
|
||||||
|
// This only affects things such as hoppers trying to insert items you need to use the container to enforce this for players
|
||||||
|
// inserting items via the gui
|
||||||
|
@Override
|
||||||
|
public int getInventoryStackLimit() {
|
||||||
|
return 64;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return true if the given player is able to use this block. In this case it checks that
|
||||||
|
// 1) the world tileentity hasn't been replaced in the meantime, and
|
||||||
|
// 2) the player isn't too far away from the centre of the block
|
||||||
|
@Override
|
||||||
|
public boolean isUsableByPlayer(EntityPlayer player) {
|
||||||
|
if (this.world.getTileEntity(this.pos) != this) return false;
|
||||||
|
final double X_CENTRE_OFFSET = 0.5;
|
||||||
|
final double Y_CENTRE_OFFSET = 0.5;
|
||||||
|
final double Z_CENTRE_OFFSET = 0.5;
|
||||||
|
final double MAXIMUM_DISTANCE_SQ = 8.0 * 8.0;
|
||||||
|
return player.getDistanceSq(pos.getX() + X_CENTRE_OFFSET, pos.getY() + Y_CENTRE_OFFSET, pos.getZ() + Z_CENTRE_OFFSET) < MAXIMUM_DISTANCE_SQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return true if the given stack is allowed to go in the given slot. In this case, we can insert anything.
|
||||||
|
// This only affects things such as hoppers trying to insert items you need to use the container to enforce this for players
|
||||||
|
// inserting items via the gui
|
||||||
|
@Override
|
||||||
|
public boolean isItemValidForSlot(int slotIndex, ItemStack itemstack) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is where you save any data that you don't want to lose when the tile entity unloads
|
||||||
|
// In this case, it saves the itemstacks stored in the container
|
||||||
|
@Override
|
||||||
|
public NBTTagCompound writeToNBT(NBTTagCompound parentNBTTagCompound)
|
||||||
|
{
|
||||||
|
super.writeToNBT(parentNBTTagCompound); // The super call is required to save and load the tileEntity's location
|
||||||
|
|
||||||
|
// to use an analogy with Java, this code generates an array of hashmaps
|
||||||
|
// The itemStack in each slot is converted to an NBTTagCompound, which is effectively a hashmap of key->value pairs such
|
||||||
|
// as slot=1, id=2353, count=1, etc
|
||||||
|
// Each of these NBTTagCompound are then inserted into NBTTagList, which is similar to an array.
|
||||||
|
NBTTagList dataForAllSlots = new NBTTagList();
|
||||||
|
for (int i = 0; i < this.itemStacks.length; ++i) {
|
||||||
|
if (!this.itemStacks[i].isEmpty()) { //isEmpty()
|
||||||
|
NBTTagCompound dataForThisSlot = new NBTTagCompound();
|
||||||
|
dataForThisSlot.setByte("Slot", (byte) i);
|
||||||
|
this.itemStacks[i].writeToNBT(dataForThisSlot);
|
||||||
|
dataForAllSlots.appendTag(dataForThisSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// the array of hashmaps is then inserted into the parent hashmap for the container
|
||||||
|
parentNBTTagCompound.setTag("Items", dataForAllSlots);
|
||||||
|
// return the NBT Tag Compound
|
||||||
|
return parentNBTTagCompound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadioactivity()
|
||||||
|
{
|
||||||
|
double rads = 0D;//+getSealedSources();
|
||||||
|
for (int i = 0; i < this.itemStacks.length; ++i) {
|
||||||
|
if (!this.itemStacks[i].isEmpty()) { //isEmpty()
|
||||||
|
/*if(Trinity.QMDLoaded)
|
||||||
|
{
|
||||||
|
if(this.itemStacks[i].getItem()instanceof RadioactiveSource)
|
||||||
|
{
|
||||||
|
RadioactiveSource source = ((RadioactiveSource)this.itemStacks[i].getItem());
|
||||||
|
rads+=source.rads*this.itemStacks[i].getCount();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(this.itemStacks[i].getItem()instanceof RadioactiveSource2)
|
||||||
|
{
|
||||||
|
RadioactiveSource2 source = ((RadioactiveSource2)this.itemStacks[i].getItem());
|
||||||
|
rads+=source.rads*this.itemStacks[i].getCount();
|
||||||
|
continue;
|
||||||
|
}*/
|
||||||
|
IRadiationSource stackSource = RadiationHelper.getRadiationSource(this.itemStacks[i]);
|
||||||
|
if (stackSource == null && !(this.itemStacks[i].getItem()instanceof RadioactiveSource2)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
rads+=stackSource.getRadiationLevel()*this.itemStacks[i].getCount();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//System.out.println("True Radioactivity: "+rads+" Rad/t");
|
||||||
|
return rads;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getShielding()
|
||||||
|
{
|
||||||
|
Block block = this.getBlockType();
|
||||||
|
if(block instanceof ShieldedContainer)
|
||||||
|
{
|
||||||
|
ShieldedContainer shield = ((ShieldedContainer)block);
|
||||||
|
return shield.shielding;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadiation()
|
||||||
|
{
|
||||||
|
double rads = getRadioactivity();
|
||||||
|
double shieldedRads = 0D;
|
||||||
|
shieldedRads = NCMath.sq(rads) / (rads + (Math.exp(getShielding())-1));
|
||||||
|
//System.out.println("Emitted Radiation: "+shieldedRads+" Rad/t");
|
||||||
|
return shieldedRads;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is where you load the data that you saved in writeToNBT
|
||||||
|
@Override
|
||||||
|
public void readFromNBT(NBTTagCompound parentNBTTagCompound)
|
||||||
|
{
|
||||||
|
super.readFromNBT(parentNBTTagCompound); // The super call is required to save and load the tiles location
|
||||||
|
final byte NBT_TYPE_COMPOUND = 10; // See NBTBase.createNewByType() for a listing
|
||||||
|
NBTTagList dataForAllSlots = parentNBTTagCompound.getTagList("Items", NBT_TYPE_COMPOUND);
|
||||||
|
|
||||||
|
Arrays.fill(itemStacks, ItemStack.EMPTY); // set all slots to empty EMPTY_ITEM
|
||||||
|
for (int i = 0; i < dataForAllSlots.tagCount(); ++i) {
|
||||||
|
NBTTagCompound dataForOneSlot = dataForAllSlots.getCompoundTagAt(i);
|
||||||
|
int slotIndex = dataForOneSlot.getByte("Slot") & 255;
|
||||||
|
|
||||||
|
if (slotIndex >= 0 && slotIndex < this.itemStacks.length) {
|
||||||
|
this.itemStacks[slotIndex] = new ItemStack(dataForOneSlot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// set all slots to empty
|
||||||
|
@Override
|
||||||
|
public void clear() {
|
||||||
|
Arrays.fill(itemStacks, ItemStack.EMPTY); //empty item
|
||||||
|
}
|
||||||
|
|
||||||
|
// will add a key for this container to the lang file so we can name it in the GUI
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "container.nuclear_pig.name";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasCustomName() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// standard code to look up what the human-readable name is
|
||||||
|
@Override
|
||||||
|
public ITextComponent getDisplayName() {
|
||||||
|
return this.hasCustomName() ? new TextComponentString(this.getName()) : new TextComponentTranslation(this.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------------
|
||||||
|
// The following methods are not needed for this example but are part of IInventory so they must be implemented
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method removes the entire contents of the given slot and returns it.
|
||||||
|
* Used by containers such as crafting tables which return any items in their slots when you close the GUI
|
||||||
|
* @param slotIndex
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ItemStack removeStackFromSlot(int slotIndex) {
|
||||||
|
ItemStack itemStack = getStackInSlot(slotIndex);
|
||||||
|
if (!itemStack.isEmpty()) setInventorySlotContents(slotIndex, ItemStack.EMPTY); //isEmpty(), EMPTY_ITEM
|
||||||
|
return itemStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void openInventory(EntityPlayer player) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void closeInventory(EntityPlayer player) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getField(int id) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setField(int id, int value) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getFieldCount() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
11
src/main/java/trinity/util/Reference.java
Normal file
11
src/main/java/trinity/util/Reference.java
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
package trinity.util;
|
||||||
|
|
||||||
|
public class Reference {
|
||||||
|
|
||||||
|
public static final String MODID = "trinity";
|
||||||
|
public static final String NAME = "Trinity";
|
||||||
|
public static final String VERSION = "1.4.b";
|
||||||
|
public static final String SERVER_PROXY_CLASS = "proxy.CommonProxy";
|
||||||
|
public static final String CLIENT_PROXY_CLASS ="proxy.ClientProxy";
|
||||||
|
public static final String REQUIREMENT ="required-after:nuclearcraft";
|
||||||
|
}
|
40
src/main/java/trinity/util/ResourceManager.java
Normal file
40
src/main/java/trinity/util/ResourceManager.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package trinity.util;
|
||||||
|
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
|
import trinity.util.Reference;
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.render.AdvancedModelLoader;
|
||||||
|
import trinity.render.IModelCustom;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.block.model.IBakedModel;
|
||||||
|
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.client.model.IModel;
|
||||||
|
import net.minecraftforge.client.model.ModelLoader;
|
||||||
|
import net.minecraftforge.client.model.obj.OBJLoader;
|
||||||
|
|
||||||
|
public class ResourceManager {
|
||||||
|
|
||||||
|
//Sphere
|
||||||
|
public static final IModelCustom sphere_ruv = AdvancedModelLoader.loadModel(new ResourceLocation(Global.MOD_ID, "models/sphere_ruv.obj"));
|
||||||
|
public static final IModelCustom sphere_iuv = AdvancedModelLoader.loadModel(new ResourceLocation(Global.MOD_ID, "models/sphere_iuv.obj"));
|
||||||
|
public static final IModelCustom sphere_uv = AdvancedModelLoader.loadModel(new ResourceLocation(Global.MOD_ID, "models/sphere_uv.obj"));
|
||||||
|
public static final IModelCustom sphere_uv_anim = AdvancedModelLoader.loadModel(new ResourceLocation(Global.MOD_ID, "models/sphere_uv.hmf"));
|
||||||
|
public static final ResourceLocation objTesterModelRL = new ResourceLocation(/*"/assets/" + */Global.MOD_ID, "models/mush.hmf");
|
||||||
|
public static final ResourceLocation ringModelRL = new ResourceLocation(/*"/assets/" + */Global.MOD_ID, "models/Ring.obj");
|
||||||
|
public static final ResourceLocation ringBigModelRL = new ResourceLocation(/*"/assets/" + */Global.MOD_ID, "models/RingBig.obj");
|
||||||
|
public static final ResourceLocation sphere = new ResourceLocation(/*"/assets/" + */Global.MOD_ID, "models/sphere.obj");
|
||||||
|
//Blast
|
||||||
|
public static final ResourceLocation fireball = new ResourceLocation(Global.MOD_ID, "textures/models/fireball2.png");
|
||||||
|
public static final ResourceLocation balefire = new ResourceLocation(Global.MOD_ID, "textures/models/balefire.png");
|
||||||
|
public static final ResourceLocation blackhole = new ResourceLocation(Global.MOD_ID, "textures/models/black.png");
|
||||||
|
public static final ResourceLocation whitehole = new ResourceLocation(Global.MOD_ID, "textures/models/white.png");
|
||||||
|
//public static final ResourceLocation shockwave = new ResourceLocation(Global.MOD_ID, "textures/models/shockwave.png");
|
||||||
|
public static final ResourceLocation disk = new ResourceLocation(Global.MOD_ID, "textures/models/disk.png");
|
||||||
|
|
||||||
|
public static void init(){
|
||||||
|
}
|
||||||
|
}
|
1292
src/main/java/trinity/util/ThermonuclearBomb.java
Normal file
1292
src/main/java/trinity/util/ThermonuclearBomb.java
Normal file
File diff suppressed because it is too large
Load diff
166
src/main/java/trinity/world/BiomeContaminatedOcean.java
Normal file
166
src/main/java/trinity/world/BiomeContaminatedOcean.java
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
package trinity.world;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.entity.EntityFeralGhoul;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
import nc.worldgen.biome.BiomeNuclearWasteland;
|
||||||
|
import nc.worldgen.biome.NCBiome;
|
||||||
|
//import nc.worldgen.biome.BiomeDecoratorNuclearWasteland;
|
||||||
|
import net.minecraft.block.BlockFlower;
|
||||||
|
import net.minecraft.block.BlockTallGrass;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeDecorator;
|
||||||
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenTallGrass;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class BiomeContaminatedOcean extends NCBiome {
|
||||||
|
|
||||||
|
public static final String BIOME_REGISTRY_NAME = "contaminated_ocean";
|
||||||
|
public static final String BIOME_NAME = "Contaminated Ocean";
|
||||||
|
|
||||||
|
public BiomeContaminatedOcean() {
|
||||||
|
super(new BiomeProperties(BIOME_NAME).setBaseHeight(0.12F).setHeightVariation(0.02F).setTemperature(2F).setWaterColor(0x588492));
|
||||||
|
|
||||||
|
topBlock = NCBlocks.wasteland_earth.getDefaultState();
|
||||||
|
fillerBlock = Blocks.COBBLESTONE.getDefaultState();
|
||||||
|
|
||||||
|
decorator = createBiomeDecorator();
|
||||||
|
|
||||||
|
setSpawnables();
|
||||||
|
addFlowers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getSkyColorByTemp(float currentTemperature) {
|
||||||
|
return 0x9DA071;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getGrassColorAtPos(BlockPos pos) {
|
||||||
|
return getModdedBiomeGrassColor(0x994C00);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getFoliageColorAtPos(BlockPos pos) {
|
||||||
|
return getModdedBiomeFoliageColor(0x994C00);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a new BiomeDecorator for this BiomeGenBase
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BiomeDecorator createBiomeDecorator() {
|
||||||
|
BiomeDecorator biomeDecorator = new BiomeNuclearWasteland.Decorator();
|
||||||
|
|
||||||
|
biomeDecorator.waterlilyPerChunk = 0;
|
||||||
|
biomeDecorator.treesPerChunk = 0;
|
||||||
|
biomeDecorator.extraTreeChance = 0F;
|
||||||
|
biomeDecorator.flowersPerChunk = 20;
|
||||||
|
biomeDecorator.grassPerChunk = 3;
|
||||||
|
biomeDecorator.deadBushPerChunk = 2;
|
||||||
|
biomeDecorator.mushroomsPerChunk = 0;
|
||||||
|
biomeDecorator.reedsPerChunk = 0;
|
||||||
|
biomeDecorator.cactiPerChunk = 0;
|
||||||
|
biomeDecorator.gravelPatchesPerChunk = 2;
|
||||||
|
biomeDecorator.sandPatchesPerChunk = 2;
|
||||||
|
biomeDecorator.clayPerChunk = 0;
|
||||||
|
biomeDecorator.bigMushroomsPerChunk = 0;
|
||||||
|
biomeDecorator.generateFalls = false;
|
||||||
|
|
||||||
|
return getModdedBiomeDecorator(biomeDecorator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FlowerEntry> getFlowerList() {
|
||||||
|
return flowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addFlowers() {
|
||||||
|
flowers.clear();
|
||||||
|
//addFlower(NCBlocks.glowing_mushroom.getDefaultState(), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSpawnables() {
|
||||||
|
spawnableCreatureList.clear();
|
||||||
|
spawnableMonsterList.clear();
|
||||||
|
spawnableWaterCreatureList.clear();
|
||||||
|
spawnableCaveCreatureList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(World worldIn, Random rand, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
|
||||||
|
int seaLevel = worldIn.getSeaLevel();
|
||||||
|
IBlockState topBlockState = topBlock;
|
||||||
|
IBlockState fillerBlockState = fillerBlock;
|
||||||
|
int heightCount = -1;
|
||||||
|
int noise = (int)(noiseVal / 3D + 3D + rand.nextDouble() * 0.25D);
|
||||||
|
int chunkPosX = x & 15;
|
||||||
|
int chunkPosZ = z & 15;
|
||||||
|
BlockPos.MutableBlockPos mutableblockpos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
for (int posY = 255; posY >= 0; --posY) {
|
||||||
|
if (posY <= rand.nextInt(5)) {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, BEDROCK);
|
||||||
|
} else {
|
||||||
|
IBlockState currentBlockState = chunkPrimerIn.getBlockState(chunkPosX, posY, chunkPosZ);
|
||||||
|
|
||||||
|
if (currentBlockState.getMaterial() == Material.AIR) heightCount = -1;
|
||||||
|
else if (currentBlockState.getBlock() == Blocks.STONE) {
|
||||||
|
if (heightCount == -1) {
|
||||||
|
if (noise <= 0) {
|
||||||
|
topBlockState = AIR;
|
||||||
|
fillerBlockState = STONE;
|
||||||
|
}
|
||||||
|
else if (posY >= seaLevel - 4 && posY <= seaLevel + 1) {
|
||||||
|
topBlockState = topBlock;
|
||||||
|
fillerBlockState = fillerBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posY < seaLevel && (topBlockState == null || topBlockState.getMaterial() == Material.AIR)) {
|
||||||
|
if (this.getTemperature(mutableblockpos.setPos(x, posY, z)) < 0.15F) topBlockState = ICE;
|
||||||
|
else topBlockState = WATER;
|
||||||
|
}
|
||||||
|
|
||||||
|
heightCount = noise;
|
||||||
|
|
||||||
|
if (posY >= seaLevel - 1) {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, topBlockState);
|
||||||
|
} else if (posY < seaLevel - 7 - noise) {
|
||||||
|
topBlockState = AIR;
|
||||||
|
fillerBlockState = STONE;
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, GRAVEL);
|
||||||
|
} else {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, fillerBlockState);
|
||||||
|
}
|
||||||
|
} else if (heightCount > 0) {
|
||||||
|
--heightCount;
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, fillerBlockState);
|
||||||
|
|
||||||
|
if (heightCount == 0 && fillerBlockState == fillerBlock && noise > 1) {
|
||||||
|
heightCount = rand.nextInt(4) + Math.max(0, posY - 63);
|
||||||
|
fillerBlockState = topBlock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
165
src/main/java/trinity/world/BiomeNuclearCrater.java
Normal file
165
src/main/java/trinity/world/BiomeNuclearCrater.java
Normal file
|
@ -0,0 +1,165 @@
|
||||||
|
package trinity.world;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
import nc.entity.EntityFeralGhoul;
|
||||||
|
import nc.init.NCBlocks;
|
||||||
|
//import nc.worldgen.biome.BiomeDecoratorNuclearWasteland;
|
||||||
|
import nc.worldgen.biome.BiomeNuclearWasteland;
|
||||||
|
import net.minecraft.block.BlockFlower;
|
||||||
|
import net.minecraft.block.BlockTallGrass;
|
||||||
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.block.state.IBlockState;
|
||||||
|
import net.minecraft.init.Blocks;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraft.world.biome.BiomeDecorator;
|
||||||
|
import net.minecraft.world.chunk.ChunkPrimer;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenTallGrass;
|
||||||
|
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||||
|
import net.minecraftforge.fml.relauncher.Side;
|
||||||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
|
public class BiomeNuclearCrater extends Biome {
|
||||||
|
|
||||||
|
public static final String BIOME_REGISTRY_NAME = "nuclear_crater";
|
||||||
|
public static final String BIOME_NAME = "Nuclear Crater";
|
||||||
|
|
||||||
|
public BiomeNuclearCrater() {
|
||||||
|
super(new BiomeProperties(BIOME_NAME).setBaseHeight(0.12F).setHeightVariation(0.02F).setTemperature(2F).setWaterColor(0x994C00).setRainDisabled());
|
||||||
|
|
||||||
|
topBlock = NCBlocks.wasteland_earth.getDefaultState();
|
||||||
|
fillerBlock = Blocks.COBBLESTONE.getDefaultState();
|
||||||
|
|
||||||
|
decorator = createBiomeDecorator();
|
||||||
|
|
||||||
|
setSpawnables();
|
||||||
|
addFlowers();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getSkyColorByTemp(float currentTemperature) {
|
||||||
|
return 0xFFBC5C;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getGrassColorAtPos(BlockPos pos) {
|
||||||
|
return getModdedBiomeGrassColor(0x994C00);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public int getFoliageColorAtPos(BlockPos pos) {
|
||||||
|
return getModdedBiomeFoliageColor(0x994C00);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate a new BiomeDecorator for this BiomeGenBase
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BiomeDecorator createBiomeDecorator() {
|
||||||
|
BiomeDecorator biomeDecorator = new BiomeNuclearWasteland.Decorator();
|
||||||
|
|
||||||
|
biomeDecorator.waterlilyPerChunk = 0;
|
||||||
|
biomeDecorator.treesPerChunk = 0;
|
||||||
|
biomeDecorator.extraTreeChance = 0F;
|
||||||
|
biomeDecorator.flowersPerChunk = 20;
|
||||||
|
biomeDecorator.grassPerChunk = 3;
|
||||||
|
biomeDecorator.deadBushPerChunk = 2;
|
||||||
|
biomeDecorator.mushroomsPerChunk = 0;
|
||||||
|
biomeDecorator.reedsPerChunk = 0;
|
||||||
|
biomeDecorator.cactiPerChunk = 0;
|
||||||
|
biomeDecorator.gravelPatchesPerChunk = 2;
|
||||||
|
biomeDecorator.sandPatchesPerChunk = 2;
|
||||||
|
biomeDecorator.clayPerChunk = 0;
|
||||||
|
biomeDecorator.bigMushroomsPerChunk = 0;
|
||||||
|
biomeDecorator.generateFalls = false;
|
||||||
|
|
||||||
|
return getModdedBiomeDecorator(biomeDecorator);
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FlowerEntry> getFlowerList() {
|
||||||
|
return flowers;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addFlowers() {
|
||||||
|
flowers.clear();
|
||||||
|
addFlower(NCBlocks.glowing_mushroom.getDefaultState(), 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSpawnables() {
|
||||||
|
spawnableCreatureList.clear();
|
||||||
|
spawnableMonsterList.clear();
|
||||||
|
spawnableWaterCreatureList.clear();
|
||||||
|
spawnableCaveCreatureList.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(World worldIn, Random rand, BlockPos pos) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @Override
|
||||||
|
public void genTerrainBlocks(World worldIn, Random rand, ChunkPrimer chunkPrimerIn, int x, int z, double noiseVal) {
|
||||||
|
int seaLevel = worldIn.getSeaLevel();
|
||||||
|
IBlockState topBlockState = topBlock;
|
||||||
|
IBlockState fillerBlockState = fillerBlock;
|
||||||
|
int heightCount = -1;
|
||||||
|
int noise = (int)(noiseVal / 3D + 3D + rand.nextDouble() * 0.25D);
|
||||||
|
int chunkPosX = x & 15;
|
||||||
|
int chunkPosZ = z & 15;
|
||||||
|
BlockPos.MutableBlockPos mutableblockpos = new BlockPos.MutableBlockPos();
|
||||||
|
|
||||||
|
for (int posY = 255; posY >= 0; --posY) {
|
||||||
|
if (posY <= rand.nextInt(5)) {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, BEDROCK);
|
||||||
|
} else {
|
||||||
|
IBlockState currentBlockState = chunkPrimerIn.getBlockState(chunkPosX, posY, chunkPosZ);
|
||||||
|
|
||||||
|
if (currentBlockState.getMaterial() == Material.AIR) heightCount = -1;
|
||||||
|
else if (currentBlockState.getBlock() == Blocks.STONE) {
|
||||||
|
if (heightCount == -1) {
|
||||||
|
if (noise <= 0) {
|
||||||
|
topBlockState = AIR;
|
||||||
|
fillerBlockState = STONE;
|
||||||
|
}
|
||||||
|
else if (posY >= seaLevel - 4 && posY <= seaLevel + 1) {
|
||||||
|
topBlockState = topBlock;
|
||||||
|
fillerBlockState = fillerBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (posY < seaLevel && (topBlockState == null || topBlockState.getMaterial() == Material.AIR)) {
|
||||||
|
if (this.getTemperature(mutableblockpos.setPos(x, posY, z)) < 0.15F) topBlockState = ICE;
|
||||||
|
else topBlockState = WATER;
|
||||||
|
}
|
||||||
|
|
||||||
|
heightCount = noise;
|
||||||
|
|
||||||
|
if (posY >= seaLevel - 1) {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, topBlockState);
|
||||||
|
} else if (posY < seaLevel - 7 - noise) {
|
||||||
|
topBlockState = AIR;
|
||||||
|
fillerBlockState = STONE;
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, GRAVEL);
|
||||||
|
} else {
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, fillerBlockState);
|
||||||
|
}
|
||||||
|
} else if (heightCount > 0) {
|
||||||
|
--heightCount;
|
||||||
|
chunkPrimerIn.setBlockState(chunkPosX, posY, chunkPosZ, fillerBlockState);
|
||||||
|
|
||||||
|
if (heightCount == 0 && fillerBlockState == fillerBlock && noise > 1) {
|
||||||
|
heightCount = rand.nextInt(4) + Math.max(0, posY - 63);
|
||||||
|
fillerBlockState = topBlock;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
42
src/main/java/trinity/world/TrinityBiomes.java
Normal file
42
src/main/java/trinity/world/TrinityBiomes.java
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
package trinity.world;
|
||||||
|
|
||||||
|
import trinity.Global;
|
||||||
|
import trinity.config.TrinityConfig;
|
||||||
|
import net.minecraft.world.biome.Biome;
|
||||||
|
import net.minecraftforge.common.BiomeDictionary;
|
||||||
|
import net.minecraftforge.common.BiomeManager;
|
||||||
|
import net.minecraftforge.common.BiomeManager.BiomeEntry;
|
||||||
|
import net.minecraftforge.common.BiomeManager.BiomeType;
|
||||||
|
import net.minecraftforge.event.RegistryEvent;
|
||||||
|
import net.minecraftforge.fml.common.Mod;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
|
||||||
|
import net.minecraftforge.registries.IForgeRegistry;
|
||||||
|
|
||||||
|
@ObjectHolder(Global.MOD_ID)
|
||||||
|
public class TrinityBiomes {
|
||||||
|
|
||||||
|
public final static BiomeNuclearCrater NUCLEAR_CRATER = new BiomeNuclearCrater();
|
||||||
|
|
||||||
|
public final static BiomeContaminatedOcean CONTAMINATED_OCEAN = new BiomeContaminatedOcean();
|
||||||
|
|
||||||
|
@Mod.EventBusSubscriber(modid = Global.MOD_ID)
|
||||||
|
public static class RegistrationHandler {
|
||||||
|
@SubscribeEvent
|
||||||
|
public static void onEvent(final RegistryEvent.Register<Biome> event) {
|
||||||
|
final IForgeRegistry<Biome> registry = event.getRegistry();
|
||||||
|
registry.register(new BiomeNuclearCrater().setRegistryName(Global.MOD_ID, BiomeNuclearCrater.BIOME_REGISTRY_NAME));
|
||||||
|
registry.register(new BiomeContaminatedOcean().setRegistryName(Global.MOD_ID, BiomeContaminatedOcean.BIOME_REGISTRY_NAME));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initBiomeManagerAndDictionary() {
|
||||||
|
//if (NCConfig.wasteland_biome) {
|
||||||
|
//zBiomeManager.addBiome(BiomeType.DESERT, new BiomeEntry(NUCLEAR_WASTELAND, NCConfig.wasteland_biome_weight));
|
||||||
|
//BiomeManager.addSpawnBiome(NUCLEAR_WASTELAND);
|
||||||
|
//BiomeManager.addStrongholdBiome(NUCLEAR_WASTELAND);
|
||||||
|
BiomeDictionary.addTypes(NUCLEAR_CRATER, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.DRY, BiomeDictionary.Type.HOT, BiomeDictionary.Type.SPARSE, BiomeDictionary.Type.WASTELAND);
|
||||||
|
BiomeDictionary.addTypes(CONTAMINATED_OCEAN, BiomeDictionary.Type.DEAD, BiomeDictionary.Type.OCEAN);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:antimatter_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"normal": {"model": "trinity:nuclear_bomb"}
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue