Initial Commit, has a working base class
@@ -0,0 +1,5 @@
|
||||
/run/
|
||||
/run-data/
|
||||
/build/
|
||||
/.gradle/
|
||||
/.idea/
|
||||
@@ -0,0 +1,76 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
maven { url = 'https://maven.minecraftforge.net' }
|
||||
maven { url = 'https://repo.spongepowered.org/maven' }
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '6.0.+', changing: true
|
||||
classpath 'org.spongepowered:mixingradle:0.7.+'
|
||||
}
|
||||
}
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'org.spongepowered.mixin'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
version = '1.0'
|
||||
group = 'net.halbear.hvf'
|
||||
archivesBaseName = 'hals_vehicle_framework'
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8)
|
||||
|
||||
minecraft {
|
||||
mappings channel: 'snapshot', version: '20201028-1.16.3'
|
||||
|
||||
runs {
|
||||
client {
|
||||
workingDirectory project.file('run')
|
||||
arg "-mixin.config=hals_vehicle_framework.mixin.json"
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
jvmArgs = [
|
||||
"--add-exports=java.base/sun.security.util=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.jar=ALL-UNNAMED"
|
||||
]
|
||||
|
||||
mods {
|
||||
hals_vehicle_framework {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
workingDirectory project.file('run')
|
||||
|
||||
property 'forge.logging.markers', 'REGISTRIES'
|
||||
property 'forge.logging.console.level', 'debug'
|
||||
|
||||
jvmArgs = [
|
||||
"--add-exports=java.base/sun.security.util=ALL-UNNAMED",
|
||||
"--add-opens=java.base/java.util.jar=ALL-UNNAMED"
|
||||
]
|
||||
|
||||
mods {
|
||||
hem {
|
||||
source sourceSets.main
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.named('jar', Jar).configure {
|
||||
manifest {
|
||||
attributes([
|
||||
'TweakClass' : 'org.spongepowered.asm.launch.MixinTweaker',
|
||||
'TweakOrder' : 0,
|
||||
'MixinConfigs' : 'hals_vehicle_framework.mixin.json'
|
||||
])
|
||||
}
|
||||
rename 'mixin.refmap.json', 'hals_vehicle_framework.mixin-refmap.json'
|
||||
}
|
||||
dependencies {
|
||||
minecraft 'net.minecraftforge:forge:1.16.5-36.2.26'
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.daemon=false
|
||||
# The Minecraft version must agree with the Forge version to get a valid artifact
|
||||
minecraft_version=1.16.5
|
||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||
# as they do not follow standard versioning conventions.
|
||||
minecraft_version_range=[1.16.5,1.17)
|
||||
# The Forge version must agree with the Minecraft version to get a valid artifact
|
||||
forge_version=36.2.42
|
||||
# The Forge version range can use any version of Forge as bounds or match the loader version range
|
||||
forge_version_range=[36,)
|
||||
# The loader version range can only use the major version of Forge/FML as bounds
|
||||
loader_version_range=[36,)
|
||||
# The mapping channel to use for mappings.
|
||||
# The default set of supported mapping channels are ["official", "snapshot", "snapshot_nodoc", "stable", "stable_nodoc"].
|
||||
# Additional mapping channels can be registered through the "channelProviders" extension in a Gradle plugin.
|
||||
#
|
||||
# | Channel | Version | |
|
||||
# |-----------|----------------------|--------------------------------------------------------------------------------|
|
||||
# | official | MCVersion | Official field/method names from Mojang mapping files |
|
||||
# | parchment | YYYY.MM.DD-MCVersion | Open community-sourced parameter names and javadocs layered on top of official |
|
||||
#
|
||||
# You must be aware of the Mojang license when using the 'official' or 'parchment' mappings.
|
||||
# See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md
|
||||
#
|
||||
# Parchment is an unofficial project maintained by ParchmentMC, separate from Minecraft Forge.
|
||||
# Additional setup is needed to use their mappings, see https://parchmentmc.org/docs/getting-started
|
||||
mapping_channel=official
|
||||
# The mapping version to query from the mapping channel.
|
||||
# This must match the format required by the mapping channel.
|
||||
mapping_version=1.16.5
|
||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||
mod_id=hals_vehicle_framework
|
||||
# The human-readable display name for the mod.
|
||||
mod_name=Hals Vehicle Framework
|
||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||
mod_license=All Rights Reserved
|
||||
# The mod version. See https://semver.org/
|
||||
mod_version=1.0-SNAPSHOT
|
||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
||||
# This should match the base package used for the mod sources.
|
||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
mod_group_id=net.halbear
|
||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||
mod_authors=Halbear1
|
||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||
mod_description=a complex Vehicle Entity library
|
||||
@@ -0,0 +1,7 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
@@ -0,0 +1,249 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# https://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Gradle start up script for POSIX generated by Gradle.
|
||||
#
|
||||
# Important for running:
|
||||
#
|
||||
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
||||
# noncompliant, but you have some other compliant shell such as ksh or
|
||||
# bash, then to run this script, type that shell name before the whole
|
||||
# command line, like:
|
||||
#
|
||||
# ksh Gradle
|
||||
#
|
||||
# Busybox and similar reduced shells will NOT work, because this script
|
||||
# requires all of these POSIX shell features:
|
||||
# * functions;
|
||||
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
||||
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
||||
# * compound commands having a testable exit status, especially «case»;
|
||||
# * various built-in commands including «command», «set», and «ulimit».
|
||||
#
|
||||
# Important for patching:
|
||||
#
|
||||
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
||||
# by Bash, Ksh, etc; in particular arrays are avoided.
|
||||
#
|
||||
# The "traditional" practice of packing multiple parameters into a
|
||||
# space-separated string is a well documented source of bugs and security
|
||||
# problems, so this is (mostly) avoided, by progressively accumulating
|
||||
# options in "$@", and eventually passing that to Java.
|
||||
#
|
||||
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
||||
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
||||
# see the in-line comments for details.
|
||||
#
|
||||
# There are tweaks for specific operating systems such as AIX, CygWin,
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
|
||||
# Resolve links: $0 may be a link
|
||||
app_path=$0
|
||||
|
||||
# Need this for daisy-chained symlinks.
|
||||
while
|
||||
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
||||
[ -h "$app_path" ]
|
||||
do
|
||||
ls=$( ls -ld "$app_path" )
|
||||
link=${ls#*' -> '}
|
||||
case $link in #(
|
||||
/*) app_path=$link ;; #(
|
||||
*) app_path=$APP_HOME$link ;;
|
||||
esac
|
||||
done
|
||||
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
} >&2
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
} >&2
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "$( uname )" in #(
|
||||
CYGWIN* ) cygwin=true ;; #(
|
||||
Darwin* ) darwin=true ;; #(
|
||||
MSYS* | MINGW* ) msys=true ;; #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
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
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command, stacking in reverse order:
|
||||
# * args from the command line
|
||||
# * the main class name
|
||||
# * -classpath
|
||||
# * -D...appname settings
|
||||
# * --module-path (only if needed)
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
||||
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
for arg do
|
||||
if
|
||||
case $arg in #(
|
||||
-*) false ;; # don't mess with options #(
|
||||
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
||||
[ -e "$t" ] ;; #(
|
||||
*) false ;;
|
||||
esac
|
||||
then
|
||||
arg=$( cygpath --path --ignore --mixed "$arg" )
|
||||
fi
|
||||
# Roll the args list around exactly as many times as the number of
|
||||
# args, so each arg winds up back in the position where it started, but
|
||||
# possibly modified.
|
||||
#
|
||||
# NB: a `for` loop captures its iteration list before it begins, so
|
||||
# changing the positional parameters here affects neither the number of
|
||||
# iterations, nor the values presented in `arg`.
|
||||
shift # remove old arg
|
||||
set -- "$@" "$arg" # push replacement arg
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
#
|
||||
# In Bash we could simply go:
|
||||
#
|
||||
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
||||
# set -- "${ARGS[@]}" "$@"
|
||||
#
|
||||
# but POSIX shell has neither arrays nor command substitution, so instead we
|
||||
# post-process each arg (as a line of input to sed) to backslash-escape any
|
||||
# character that might be a shell metacharacter, then use eval to reverse
|
||||
# that process (while maintaining the separation between arguments), and wrap
|
||||
# the whole thing up as a single "set" statement.
|
||||
#
|
||||
# This will of course break if any of these variables contains a newline or
|
||||
# an unmatched quote.
|
||||
#
|
||||
|
||||
eval "set -- $(
|
||||
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
||||
xargs -n1 |
|
||||
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
||||
tr '\n' ' '
|
||||
)" '"$@"'
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
@@ -0,0 +1,92 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
|
||||
: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 %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if %ERRORLEVEL% equ 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!
|
||||
set EXIT_CODE=%ERRORLEVEL%
|
||||
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||
exit /b %EXIT_CODE%
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
@@ -0,0 +1,15 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = 'MinecraftForge'
|
||||
url = 'https://maven.minecraftforge.net/'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0'
|
||||
}
|
||||
|
||||
rootProject.name = 'hals-vehicle-framework'
|
||||
@@ -0,0 +1,40 @@
|
||||
package net.halbear.hvf.Entity.Example;
|
||||
|
||||
import net.halbear.hvf.Entity.VehicleBaseEntity;
|
||||
import net.halbear.hvf.Util.VehicleData.EngineCategories;
|
||||
import net.halbear.hvf.Util.VehicleData.VehicleBuildInfo;
|
||||
import net.halbear.hvf.Util.VehicleData.VehicleClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class Aeroplane extends VehicleBaseEntity {
|
||||
|
||||
private static final VehicleBuildInfo buildInfo = new VehicleBuildInfo(VehicleClassification.Aeroplane)
|
||||
.SetEngineCount(1)
|
||||
.SetEngineType(EngineCategories.Aircraft_Propeller)
|
||||
.SetMaxEngineRPM(3000)
|
||||
.SetWingSpan(2)
|
||||
.SetMaxSpeedMS(70);
|
||||
|
||||
public Aeroplane(EntityType<?> Type, World WorldIn) {
|
||||
super(Type, WorldIn, new Vector3d[]{new Vector3d(0.0D, -1D, 0.0D)}, buildInfo);
|
||||
}
|
||||
|
||||
public void SetVehicleRoll(float value){
|
||||
SetFloatDataValue("ORIENTATION_ROLL",value);
|
||||
}
|
||||
public void SetVehicleYaw(float value){SetFloatDataValue("ORIENTATION_YAW", value);}
|
||||
public void SetVehiclePitch(float value){SetFloatDataValue("ORIENTATION_PITCH", value); }
|
||||
public float GetVehicleRoll(){return GetFloatDataValue("ORIENTATION_ROLL"); }
|
||||
public float GetVehicleYaw(){ return GetFloatDataValue("ORIENTATION_YAW"); }
|
||||
public float GetVehiclePitch(){return GetFloatDataValue("ORIENTATION_PITCH"); }
|
||||
public float[] GetVehicleRotations(){
|
||||
return new float[]{GetVehicleYaw(),GetVehiclePitch(),GetVehicleRoll()};
|
||||
}
|
||||
public void SetVehicleRotations(float Yaw, float Pitch, float Roll){
|
||||
SetVehicleRoll(Roll);
|
||||
SetVehicleYaw(Yaw);
|
||||
SetVehiclePitch(Pitch);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package net.halbear.hvf.Entity.Example.Renderer;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.halbear.hvf.Entity.Example.Renderer.Models.AeroplaneModel;
|
||||
import net.halbear.hvf.Entity.VehicleBaseEntity;
|
||||
import net.halbear.hvf.Halsvehicleframework;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.entity.EntityRenderer;
|
||||
import net.minecraft.client.renderer.entity.EntityRendererManager;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class AeroplaneRenderer extends EntityRenderer<VehicleBaseEntity> {
|
||||
private AeroplaneModel model = new AeroplaneModel();
|
||||
|
||||
public AeroplaneRenderer(EntityRendererManager renderManagerIn) {
|
||||
super(renderManagerIn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(VehicleBaseEntity entity, float entityYaw, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight) {
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.rotate(Vector3f.YP.rotationDegrees(180.0F - entityYaw));
|
||||
matrixStack.scale(-1.0F, -1.0F, 1.0F);
|
||||
matrixStack.translate(0.0D, -1.5D, 0.0D);
|
||||
|
||||
IVertexBuilder vertexBuilder = buffer.getBuffer(this.model.getRenderType(getEntityTexture(entity)));
|
||||
|
||||
this.model.setRotationAngles(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.model.render(matrixStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
matrixStack.pop();
|
||||
super.render(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nonnull
|
||||
public ResourceLocation getEntityTexture(VehicleBaseEntity entity) {
|
||||
return new ResourceLocation(Halsvehicleframework.MOD_ID,"textures/entities/biplaneupdated.png");
|
||||
}
|
||||
|
||||
/* @Override
|
||||
public boolean shouldRender(Aeroplane livingEntity, ClippingHelper camera, double camX, double camY, double camZ) {
|
||||
return true;
|
||||
}*/
|
||||
|
||||
//i can use this to render mutliple models on one entity
|
||||
/*private List<EntityModel<Aeroplane>> modelParts = new ArrayList<>();
|
||||
|
||||
public AeroplaneRenderer(EntityRendererManager renderManagerIn) {
|
||||
super(renderManagerIn );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Aeroplane entity, float entityYaw, float partialTicks, MatrixStack matrixStack, IRenderTypeBuffer buffer, int packedLight) {
|
||||
|
||||
modelParts.add(new AeroplaneModel());
|
||||
modelParts.add(new AeroplaneModel());
|
||||
modelParts.add(new AeroplaneModel());
|
||||
modelParts.add(new AeroplaneModel());
|
||||
|
||||
matrixStack.push();
|
||||
|
||||
matrixStack.rotate(Vector3f.YP.rotationDegrees(180.0F - entityYaw));
|
||||
matrixStack.scale(-1.0F, -1.0F, 1.0F);
|
||||
matrixStack.translate(0.0D, -1.5D, 0.0D);
|
||||
|
||||
|
||||
for(int i = 0; i < modelParts.toArray().length; i++) {
|
||||
IVertexBuilder vertexBuilder = buffer.getBuffer(this.modelParts.get(i).getRenderType(getEntityTexture(entity)));
|
||||
this.modelParts.get(i).setRotationAngles(entity, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
||||
this.modelParts.get(i).render(matrixStack, vertexBuilder, packedLight, OverlayTexture.NO_OVERLAY, 1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
matrixStack.pop();
|
||||
super.render(entity, entityYaw, partialTicks, matrixStack, buffer, packedLight);
|
||||
}*/
|
||||
}
|
||||
@@ -0,0 +1,317 @@
|
||||
package net.halbear.hvf.Entity.Example.Renderer.Models;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import net.halbear.hvf.Entity.Example.Aeroplane;
|
||||
import net.halbear.hvf.Entity.VehicleBaseEntity;
|
||||
import net.minecraft.client.renderer.entity.model.EntityModel;
|
||||
import net.minecraft.client.renderer.model.ModelRenderer;
|
||||
import net.halbear.hvf.*;
|
||||
|
||||
public class AeroplaneModel extends EntityModel<VehicleBaseEntity> {
|
||||
private final ModelRenderer Body;
|
||||
private final ModelRenderer cube_r1;
|
||||
private final ModelRenderer cube_r2;
|
||||
private final ModelRenderer cube_r3;
|
||||
private final ModelRenderer cube_r4;
|
||||
private final ModelRenderer cube_r5;
|
||||
private final ModelRenderer cube_r6;
|
||||
private final ModelRenderer cube_r7;
|
||||
private final ModelRenderer cube_r8;
|
||||
private final ModelRenderer cube_r9;
|
||||
private final ModelRenderer cube_r10;
|
||||
private final ModelRenderer cube_r11;
|
||||
private final ModelRenderer cube_r12;
|
||||
private final ModelRenderer cube_r13;
|
||||
private final ModelRenderer cube_r14;
|
||||
private final ModelRenderer cube_r15;
|
||||
private final ModelRenderer cube_r16;
|
||||
private final ModelRenderer cube_r17;
|
||||
private final ModelRenderer cube_r18;
|
||||
private final ModelRenderer cube_r19;
|
||||
private final ModelRenderer cube_r20;
|
||||
private final ModelRenderer cube_r21;
|
||||
private final ModelRenderer cube_r22;
|
||||
private final ModelRenderer cube_r23;
|
||||
private final ModelRenderer cube_r24;
|
||||
private final ModelRenderer cube_r25;
|
||||
private final ModelRenderer cube_r26;
|
||||
private final ModelRenderer cube_r27;
|
||||
private final ModelRenderer cube_r28;
|
||||
private final ModelRenderer cube_r29;
|
||||
private final ModelRenderer cube_r30;
|
||||
private final ModelRenderer cube_r31;
|
||||
private final ModelRenderer cube_r32;
|
||||
private final ModelRenderer cube_r33;
|
||||
private final ModelRenderer cube_r34;
|
||||
private final ModelRenderer cube_r35;
|
||||
private final ModelRenderer cube_r36;
|
||||
private final ModelRenderer cube_r37;
|
||||
private final ModelRenderer cube_r38;
|
||||
private final ModelRenderer cube_r39;
|
||||
private final ModelRenderer cube_r40;
|
||||
private final ModelRenderer cube_r41;
|
||||
private final ModelRenderer propeller;
|
||||
private final ModelRenderer cube_r42;
|
||||
|
||||
public AeroplaneModel() {
|
||||
textureWidth = 512;
|
||||
textureHeight = 512;
|
||||
Body = new ModelRenderer(this);
|
||||
Body.setRotationPoint(0.0F, 3.0F, -9.0F);
|
||||
Body.setTextureOffset(144, 0).addBox(-5.0F, 7.25F, -12.0F, 10.0F, 2.0F, 32.0F, 0.0F, false);
|
||||
Body.setTextureOffset(96, 43).addBox(-2.0F, -6.0F, 34.0F, 4.0F, 2.0F, 10.0F, 0.0F, false);
|
||||
Body.setTextureOffset(0, 92).addBox(-2.0F, -6.0F, 50.0F, 4.0F, 10.0F, 6.0F, 0.0F, false);
|
||||
Body.setTextureOffset(0, 92).addBox(-26.0F, -18.0F, -7.0F, 52.0F, 2.0F, 24.0F, 0.0F, false);
|
||||
Body.setTextureOffset(0, 92).addBox(-26.0F, 5.0F, -2.0F, 52.0F, 2.0F, 24.0F, 0.0F, false);
|
||||
Body.setTextureOffset(292, 89).addBox(11.0F, 13.0F, -4.0F, 2.0F, 8.0F, 8.0F, 0.0F, false);
|
||||
Body.setTextureOffset(9, 207).addBox(9.0F, 16.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F, false);
|
||||
Body.setTextureOffset(292, 89).addBox(-13.0F, 13.0F, -4.0F, 2.0F, 8.0F, 8.0F, 0.0F, true);
|
||||
Body.setTextureOffset(9, 207).addBox(-11.0F, 16.0F, -1.0F, 2.0F, 2.0F, 2.0F, 0.0F, true);
|
||||
cube_r1 = new ModelRenderer(this);
|
||||
cube_r1.setRotationPoint(-9.0F, 18.0F, 0.0F);
|
||||
Body.addChild(cube_r1);
|
||||
setRotationAngle(cube_r1, 0.0F, 0.0F, 0.4363F);
|
||||
cube_r1.setTextureOffset(10, 205).addBox(-2.0F, -12.0F, -1.0F, 2.0F, 12.0F, 2.0F, 0.0F, true);
|
||||
cube_r2 = new ModelRenderer(this);
|
||||
cube_r2.setRotationPoint(9.0F, 18.0F, 0.0F);
|
||||
Body.addChild(cube_r2);
|
||||
setRotationAngle(cube_r2, 0.0F, 0.0F, -0.4363F);
|
||||
cube_r2.setTextureOffset(10, 205).addBox(0.0F, -12.0F, -1.0F, 2.0F, 12.0F, 2.0F, 0.0F, false);
|
||||
cube_r3 = new ModelRenderer(this);
|
||||
cube_r3.setRotationPoint(-42.0F, 4.0F, 7.0F);
|
||||
Body.addChild(cube_r3);
|
||||
setRotationAngle(cube_r3, 0.1745F, 0.1745F, 0.0F);
|
||||
cube_r3.setTextureOffset(52, 21).addBox(-1.0F, -22.0F, -6.0F, 2.0F, 23.0F, 2.0F, 0.0F, false);
|
||||
cube_r4 = new ModelRenderer(this);
|
||||
cube_r4.setRotationPoint(-39.0F, 4.0F, 26.0F);
|
||||
Body.addChild(cube_r4);
|
||||
setRotationAngle(cube_r4, 0.1745F, 0.1745F, 0.0F);
|
||||
cube_r4.setTextureOffset(100, 203).addBox(-1.0F, -22.0F, -6.0F, 2.0F, 23.0F, 2.0F, 0.0F, false);
|
||||
cube_r5 = new ModelRenderer(this);
|
||||
cube_r5.setRotationPoint(39.0F, 4.0F, 26.0F);
|
||||
Body.addChild(cube_r5);
|
||||
setRotationAngle(cube_r5, 0.1745F, -0.1745F, 0.0F);
|
||||
cube_r5.setTextureOffset(186, 177).addBox(-1.0F, -22.0F, -6.0F, 2.0F, 23.0F, 2.0F, 0.0F, false);
|
||||
cube_r6 = new ModelRenderer(this);
|
||||
cube_r6.setRotationPoint(-11.0F, 4.5F, 21.0F);
|
||||
Body.addChild(cube_r6);
|
||||
setRotationAngle(cube_r6, 0.2659F, 0.008F, -0.0169F);
|
||||
cube_r6.setTextureOffset(162, 177).addBox(-1.0F, -22.5F, -2.0F, 2.0F, 24.0F, 2.0F, 0.0F, false);
|
||||
cube_r7 = new ModelRenderer(this);
|
||||
cube_r7.setRotationPoint(11.0F, 4.5F, 21.0F);
|
||||
Body.addChild(cube_r7);
|
||||
setRotationAngle(cube_r7, 0.2659F, -0.008F, 0.0169F);
|
||||
cube_r7.setTextureOffset(170, 177).addBox(-1.0F, -22.5F, -2.0F, 2.0F, 24.0F, 2.0F, 0.0F, false);
|
||||
cube_r8 = new ModelRenderer(this);
|
||||
cube_r8.setRotationPoint(-11.1935F, -5.629F, -1.7596F);
|
||||
Body.addChild(cube_r8);
|
||||
setRotationAngle(cube_r8, 0.2223F, 0.008F, -0.0169F);
|
||||
cube_r8.setTextureOffset(52, 21).addBox(-1.0F, -12.0F, -2.0F, 2.0F, 24.0F, 2.0F, 0.0F, false);
|
||||
cube_r9 = new ModelRenderer(this);
|
||||
cube_r9.setRotationPoint(11.1935F, -5.629F, -1.7596F);
|
||||
Body.addChild(cube_r9);
|
||||
setRotationAngle(cube_r9, 0.2223F, -0.008F, 0.0169F);
|
||||
cube_r9.setTextureOffset(178, 177).addBox(-1.0F, -12.0F, -2.0F, 2.0F, 24.0F, 2.0F, 0.0F, false);
|
||||
cube_r10 = new ModelRenderer(this);
|
||||
cube_r10.setRotationPoint(42.0F, 4.0F, 7.0F);
|
||||
Body.addChild(cube_r10);
|
||||
setRotationAngle(cube_r10, 0.1745F, -0.1745F, 0.0F);
|
||||
cube_r10.setTextureOffset(206, 177).addBox(-1.0F, -22.0F, -6.0F, 2.0F, 23.0F, 2.0F, 0.0F, false);
|
||||
cube_r11 = new ModelRenderer(this);
|
||||
cube_r11.setRotationPoint(-26.0F, -18.0F, -7.0F);
|
||||
Body.addChild(cube_r11);
|
||||
setRotationAngle(cube_r11, 0.0F, 0.1309F, 0.0F);
|
||||
cube_r11.setTextureOffset(0, 118).addBox(-29.0F, -0.01F, 0.0F, 29.0F, 2.0F, 24.0F, 0.0F, false);
|
||||
cube_r12 = new ModelRenderer(this);
|
||||
cube_r12.setRotationPoint(26.0F, -18.0F, -7.0F);
|
||||
Body.addChild(cube_r12);
|
||||
setRotationAngle(cube_r12, 0.0F, -0.1309F, 0.0F);
|
||||
cube_r12.setTextureOffset(0, 118).addBox(0.0F, -0.01F, 0.0F, 29.0F, 2.0F, 24.0F, 0.0F, true);
|
||||
cube_r13 = new ModelRenderer(this);
|
||||
cube_r13.setRotationPoint(-26.0F, 5.0F, -2.0F);
|
||||
Body.addChild(cube_r13);
|
||||
setRotationAngle(cube_r13, 0.0F, 0.1309F, 0.0F);
|
||||
cube_r13.setTextureOffset(64, 177).addBox(-19.0F, -0.01F, 0.0F, 19.0F, 2.0F, 24.0F, 0.0F, false);
|
||||
cube_r14 = new ModelRenderer(this);
|
||||
cube_r14.setRotationPoint(26.0F, 5.0F, -2.0F);
|
||||
Body.addChild(cube_r14);
|
||||
setRotationAngle(cube_r14, 0.0F, -0.1309F, 0.0F);
|
||||
cube_r14.setTextureOffset(64, 177).addBox(0.0F, -0.01F, 0.0F, 19.0F, 2.0F, 24.0F, 0.0F, true);
|
||||
cube_r15 = new ModelRenderer(this);
|
||||
cube_r15.setRotationPoint(-26.8737F, -5.0F, 6.9632F);
|
||||
Body.addChild(cube_r15);
|
||||
setRotationAngle(cube_r15, 0.1686F, 0.6551F, -0.0096F);
|
||||
cube_r15.setTextureOffset(190, 90).addBox(-19.5F, -12.0F, 1.0F, 39.0F, 24.0F, 0.0F, 0.0F, true);
|
||||
cube_r16 = new ModelRenderer(this);
|
||||
cube_r16.setRotationPoint(-26.5867F, -6.1884F, 8.6681F);
|
||||
Body.addChild(cube_r16);
|
||||
setRotationAngle(cube_r16, 0.2164F, -0.4589F, -0.102F);
|
||||
cube_r16.setTextureOffset(190, 90).addBox(-20.5F, -11.0F, 0.0F, 39.0F, 23.0F, 0.0F, 0.0F, true);
|
||||
cube_r17 = new ModelRenderer(this);
|
||||
cube_r17.setRotationPoint(26.5867F, -6.1884F, 8.6681F);
|
||||
Body.addChild(cube_r17);
|
||||
setRotationAngle(cube_r17, 0.2164F, 0.4589F, 0.102F);
|
||||
cube_r17.setTextureOffset(190, 90).addBox(-18.5F, -11.0F, 0.0F, 39.0F, 23.0F, 0.0F, 0.0F, false);
|
||||
cube_r18 = new ModelRenderer(this);
|
||||
cube_r18.setRotationPoint(26.8737F, -5.0F, 6.9632F);
|
||||
Body.addChild(cube_r18);
|
||||
setRotationAngle(cube_r18, 0.1686F, -0.6551F, 0.0096F);
|
||||
cube_r18.setTextureOffset(190, 90).addBox(-19.5F, -12.0F, 1.0F, 39.0F, 24.0F, 0.0F, 0.0F, false);
|
||||
cube_r19 = new ModelRenderer(this);
|
||||
cube_r19.setRotationPoint(0.0F, -1.5F, 0.0F);
|
||||
Body.addChild(cube_r19);
|
||||
setRotationAngle(cube_r19, -0.3491F, 0.0F, 0.0F);
|
||||
cube_r19.setTextureOffset(0, 0).addBox(-0.5F, -2.5F, 1.0F, 1.0F, 9.0F, 1.0F, 0.0F, false);
|
||||
cube_r20 = new ModelRenderer(this);
|
||||
cube_r20.setRotationPoint(10.0F, -3.0F, 52.0F);
|
||||
Body.addChild(cube_r20);
|
||||
setRotationAngle(cube_r20, -0.3054F, 0.0F, 1.5708F);
|
||||
cube_r20.setTextureOffset(144, 0).addBox(-1.0F, -9.0F, -6.0F, 2.0F, 18.0F, 12.0F, 0.0F, true);
|
||||
cube_r21 = new ModelRenderer(this);
|
||||
cube_r21.setRotationPoint(-10.0F, -3.0F, 52.0F);
|
||||
Body.addChild(cube_r21);
|
||||
setRotationAngle(cube_r21, -0.3054F, 0.0F, -1.5708F);
|
||||
cube_r21.setTextureOffset(144, 0).addBox(-1.0F, -9.0F, -6.0F, 2.0F, 18.0F, 12.0F, 0.0F, false);
|
||||
cube_r22 = new ModelRenderer(this);
|
||||
cube_r22.setRotationPoint(0.0F, -15.0F, 50.0F);
|
||||
Body.addChild(cube_r22);
|
||||
setRotationAngle(cube_r22, -0.3054F, 0.0F, 0.0F);
|
||||
cube_r22.setTextureOffset(54, 144).addBox(-1.0F, -6.0F, -4.0F, 2.0F, 18.0F, 12.0F, 0.0F, false);
|
||||
cube_r23 = new ModelRenderer(this);
|
||||
cube_r23.setRotationPoint(2.0F, 9.25F, 34.0F);
|
||||
Body.addChild(cube_r23);
|
||||
setRotationAngle(cube_r23, 0.2528F, -0.1733F, 0.5888F);
|
||||
cube_r23.setTextureOffset(135, 133).addBox(-0.25F, -6.3007F, -0.9537F, 0.0F, 6.0F, 17.0F, 0.0F, true);
|
||||
cube_r24 = new ModelRenderer(this);
|
||||
cube_r24.setRotationPoint(-2.0F, 9.25F, 34.0F);
|
||||
Body.addChild(cube_r24);
|
||||
setRotationAngle(cube_r24, 0.2528F, 0.1733F, -0.5888F);
|
||||
cube_r24.setTextureOffset(135, 133).addBox(0.25F, -6.3007F, -0.9537F, 0.0F, 6.0F, 17.0F, 0.0F, false);
|
||||
cube_r25 = new ModelRenderer(this);
|
||||
cube_r25.setRotationPoint(0.0F, 9.25F, 33.0F);
|
||||
Body.addChild(cube_r25);
|
||||
setRotationAngle(cube_r25, 0.2618F, 0.0F, 0.0F);
|
||||
cube_r25.setTextureOffset(106, 144).addBox(-2.0F, -6.0F, 0.0F, 4.0F, 6.0F, 21.0F, 0.0F, false);
|
||||
cube_r26 = new ModelRenderer(this);
|
||||
cube_r26.setRotationPoint(-5.0F, 9.0F, 20.0F);
|
||||
Body.addChild(cube_r26);
|
||||
setRotationAngle(cube_r26, 0.0F, 0.1745F, 0.0F);
|
||||
cube_r26.setTextureOffset(38, 201).addBox(0.0F, -1.75F, 0.0F, 5.0F, 2.0F, 14.0F, 0.0F, true);
|
||||
cube_r27 = new ModelRenderer(this);
|
||||
cube_r27.setRotationPoint(5.0F, 9.0F, 20.0F);
|
||||
Body.addChild(cube_r27);
|
||||
setRotationAngle(cube_r27, 0.0F, -0.1745F, 0.0F);
|
||||
cube_r27.setTextureOffset(38, 201).addBox(-5.0F, -1.75F, 0.0F, 5.0F, 2.0F, 14.0F, 0.0F, false);
|
||||
cube_r28 = new ModelRenderer(this);
|
||||
cube_r28.setRotationPoint(-7.0F, -11.0F, 20.0F);
|
||||
Body.addChild(cube_r28);
|
||||
setRotationAngle(cube_r28, 0.3925F, -1.2393F, 1.1581F);
|
||||
cube_r28.setTextureOffset(196, 64).addBox(0.0F, -7.0F, -5.0F, 18.0F, 7.0F, 5.0F, 0.0F, true);
|
||||
cube_r29 = new ModelRenderer(this);
|
||||
cube_r29.setRotationPoint(7.0F, -11.0F, 20.0F);
|
||||
Body.addChild(cube_r29);
|
||||
setRotationAngle(cube_r29, 0.3925F, 1.2393F, -1.1581F);
|
||||
cube_r29.setTextureOffset(196, 64).addBox(-18.0F, -7.0F, -5.0F, 18.0F, 7.0F, 5.0F, 0.0F, false);
|
||||
cube_r30 = new ModelRenderer(this);
|
||||
cube_r30.setRotationPoint(0.0F, -6.0F, 9.0F);
|
||||
Body.addChild(cube_r30);
|
||||
setRotationAngle(cube_r30, 0.0F, 0.0F, -1.5708F);
|
||||
cube_r30.setTextureOffset(42, 182).addBox(-10.0F, -7.0F, 6.0F, 15.0F, 14.0F, 5.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 239).addBox(-15.0F, -7.0F, -28.0F, 15.0F, 14.0F, 0.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 223).addBox(-15.0F, -7.0F, -27.0F, 15.0F, 14.0F, 0.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(96, 55).addBox(-9.0F, -2.0F, -28.0F, 4.0F, 4.0F, 7.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 201).addBox(-14.0F, -7.0F, -26.0F, 14.0F, 14.0F, 5.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(144, 34).addBox(-16.0F, -9.0F, -28.0F, 18.0F, 2.0F, 7.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(42, 0).addBox(0.0F, -7.0F, -28.0F, 2.0F, 14.0F, 7.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 0).addBox(-10.0F, -7.0F, -18.0F, 0.0F, 14.0F, 25.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 0).addBox(1.0F, 0.0F, -26.0F, 15.0F, 0.0F, 66.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(0, 0).addBox(-10.0F, -7.0F, -21.0F, 11.0F, 14.0F, 10.0F, 0.0F, false);
|
||||
cube_r30.setTextureOffset(54, 144).addBox(-10.0F, -8.0F, -21.0F, 10.0F, 1.0F, 32.0F, 0.0F, false);
|
||||
cube_r31 = new ModelRenderer(this);
|
||||
cube_r31.setRotationPoint(0.0F, -6.0F, 9.0F);
|
||||
Body.addChild(cube_r31);
|
||||
setRotationAngle(cube_r31, 0.0F, 0.0F, 1.5708F);
|
||||
cube_r31.setTextureOffset(144, 34).addBox(-2.0F, -9.0F, -28.0F, 18.0F, 2.0F, 7.0F, 0.0F, true);
|
||||
cube_r31.setTextureOffset(54, 144).addBox(0.0F, -8.0F, -21.0F, 10.0F, 1.0F, 32.0F, 0.0F, true);
|
||||
cube_r32 = new ModelRenderer(this);
|
||||
cube_r32.setRotationPoint(0.0F, 36.0F, 9.0F);
|
||||
Body.addChild(cube_r32);
|
||||
setRotationAngle(cube_r32, 0.0F, 0.0F, 1.5708F);
|
||||
cube_r32.setTextureOffset(42, 0).addBox(-28.0F, -7.0F, -28.0F, 2.0F, 14.0F, 7.0F, 0.0F, false);
|
||||
cube_r33 = new ModelRenderer(this);
|
||||
cube_r33.setRotationPoint(0.0F, -7.0F, -5.0F);
|
||||
Body.addChild(cube_r33);
|
||||
setRotationAngle(cube_r33, 0.0F, -0.4363F, -1.5708F);
|
||||
cube_r33.setTextureOffset(0, 118).addBox(0.0F, -7.0F, 0.0F, 7.0F, 14.0F, 1.0F, 0.0F, false);
|
||||
cube_r34 = new ModelRenderer(this);
|
||||
cube_r34.setRotationPoint(51.0F, -18.5F, 20.0F);
|
||||
Body.addChild(cube_r34);
|
||||
setRotationAngle(cube_r34, 0.7342F, -0.1119F, -1.4365F);
|
||||
cube_r34.setTextureOffset(53, 0).addBox(-24.5F, 0.0F, 0.0F, 24.0F, 0.0F, 43.0F, 0.0F, false);
|
||||
cube_r35 = new ModelRenderer(this);
|
||||
cube_r35.setRotationPoint(-51.0F, -18.5F, 20.0F);
|
||||
Body.addChild(cube_r35);
|
||||
setRotationAngle(cube_r35, 0.7342F, 0.1119F, 1.4365F);
|
||||
cube_r35.setTextureOffset(53, 0).addBox(0.5F, 0.0F, 0.0F, 24.0F, 0.0F, 43.0F, 0.0F, true);
|
||||
cube_r36 = new ModelRenderer(this);
|
||||
cube_r36.setRotationPoint(8.0F, 4.0F, 5.5F);
|
||||
Body.addChild(cube_r36);
|
||||
setRotationAngle(cube_r36, 0.0F, 0.0F, 2.0944F);
|
||||
cube_r36.setTextureOffset(162, 178).addBox(0.0F, 0.0F, -17.5F, 6.0F, 1.0F, 32.0F, 0.0F, true);
|
||||
cube_r37 = new ModelRenderer(this);
|
||||
cube_r37.setRotationPoint(-8.0F, 4.0F, 5.5F);
|
||||
Body.addChild(cube_r37);
|
||||
setRotationAngle(cube_r37, 0.0F, 0.0F, -2.0944F);
|
||||
cube_r37.setTextureOffset(162, 178).addBox(-6.0F, 0.0F, -17.5F, 6.0F, 1.0F, 32.0F, 0.0F, false);
|
||||
cube_r38 = new ModelRenderer(this);
|
||||
cube_r38.setRotationPoint(5.0F, 9.0F, 20.0F);
|
||||
Body.addChild(cube_r38);
|
||||
setRotationAngle(cube_r38, 0.1515F, -0.0869F, -1.0538F);
|
||||
cube_r38.setTextureOffset(0, 182).addBox(-0.1927F, -3.9414F, -0.5209F, 6.0F, 4.0F, 15.0F, 0.0F, false);
|
||||
cube_r39 = new ModelRenderer(this);
|
||||
cube_r39.setRotationPoint(-5.0F, 9.0F, 20.0F);
|
||||
Body.addChild(cube_r39);
|
||||
setRotationAngle(cube_r39, 0.1515F, 0.0869F, 1.0538F);
|
||||
cube_r39.setTextureOffset(82, 118).addBox(-5.8073F, -4.9414F, -0.5209F, 6.0F, 5.0F, 15.0F, 0.0F, false);
|
||||
cube_r40 = new ModelRenderer(this);
|
||||
cube_r40.setRotationPoint(-8.0F, 0.5F, 20.0F);
|
||||
Body.addChild(cube_r40);
|
||||
setRotationAngle(cube_r40, 0.1745F, 0.0F, 1.5708F);
|
||||
cube_r40.setTextureOffset(0, 144).addBox(-6.5F, -4.0F, 0.0F, 10.0F, 4.0F, 34.0F, 0.0F, true);
|
||||
cube_r41 = new ModelRenderer(this);
|
||||
cube_r41.setRotationPoint(8.0F, 0.5F, 20.0F);
|
||||
Body.addChild(cube_r41);
|
||||
setRotationAngle(cube_r41, 0.1745F, 0.0F, -1.5708F);
|
||||
cube_r41.setTextureOffset(0, 144).addBox(-3.5F, -4.0F, 0.0F, 10.0F, 4.0F, 34.0F, 0.0F, false);
|
||||
propeller = new ModelRenderer(this);
|
||||
propeller.setRotationPoint(0.0F, 1.0F, -20.5F);
|
||||
Body.addChild(propeller);
|
||||
cube_r42 = new ModelRenderer(this);
|
||||
cube_r42.setRotationPoint(0.0F, -7.0F, 29.5F);
|
||||
propeller.addChild(cube_r42);
|
||||
setRotationAngle(cube_r42, 0.0F, 0.0F, -1.5708F);
|
||||
cube_r42.setTextureOffset(32, 0).addBox(-9.0F, -2.0F, -32.0F, 4.0F, 4.0F, 3.0F, 0.0F, false);
|
||||
cube_r42.setTextureOffset(0, 260).addBox(-22.0F, -15.0F, -29.0F, 30.0F, 30.0F, 0.0F, 0.0F, false);
|
||||
cube_r42.setTextureOffset(4, 0).addBox(-8.0F, -1.0F, -29.0F, 2.0F, 2.0F, 1.0F, 0.0F, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue,
|
||||
float alpha) {
|
||||
Body.render(matrixStack, buffer, packedLight, packedOverlay, red, green, blue, alpha);
|
||||
}
|
||||
|
||||
public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
|
||||
modelRenderer.rotateAngleX = x;
|
||||
modelRenderer.rotateAngleY = y;
|
||||
modelRenderer.rotateAngleZ = z;
|
||||
}
|
||||
@Override
|
||||
public void setRotationAngles(VehicleBaseEntity entity, float f, float f1, float f2, float f3, float f4) {
|
||||
Aeroplane aeroplane = (Aeroplane)entity;
|
||||
Body.rotateAngleY = (float)Math.toRadians((aeroplane.GetVehicleYaw()) );
|
||||
Body.rotateAngleX = (float)Math.toRadians((aeroplane.GetVehiclePitch()));
|
||||
Body.rotateAngleZ = (float)Math.toRadians((aeroplane.GetVehicleRoll()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package net.halbear.hvf.Entity;
|
||||
|
||||
import net.halbear.hvf.Util.VehicleData.EngineCategories;
|
||||
import net.halbear.hvf.Util.VehicleData.VehicleBuildInfo;
|
||||
import net.halbear.hvf.Util.VehicleData.VehicleClassification;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.network.IPacket;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
import net.minecraft.network.datasync.EntityDataManager;
|
||||
import net.minecraft.util.ActionResultType;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.network.NetworkHooks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VehicleBaseEntity extends Entity {
|
||||
|
||||
private Map<String, DataParameter<Float>> VEHICLE_SYNCHED_FLOAT_PARAMETERS = new HashMap<>();
|
||||
private Map<String, DataParameter<Integer>> VEHICLE_SYNCHED_INT_PARAMETERS = new HashMap<>();
|
||||
private Map<String, DataParameter<Boolean>> VEHICLE_SYNCHED_BOOLEAN_PARAMETERS = new HashMap<>();
|
||||
private Map<String, Float> BASE_FLOAT_PARAMETERS = new HashMap<>();
|
||||
private Map<String, Integer> BASE_INT_PARAMETERS = new HashMap<>();
|
||||
private Map<String, Boolean> BASE_BOOLEAN_PARAMETERS = new HashMap<>();
|
||||
private VehicleClassification vehicleClassification;
|
||||
private Vector3d[] VehicleSeatOffsets;
|
||||
private EngineCategories EngineType;
|
||||
|
||||
public VehicleBaseEntity(EntityType<?> entityTypeIn, World worldIn, Vector3d[] VehicleSeatOffsets, VehicleBuildInfo vehicleBuildInfo) {
|
||||
super(entityTypeIn, worldIn);
|
||||
this.VehicleSeatOffsets = VehicleSeatOffsets;
|
||||
vehicleClassification = vehicleBuildInfo.GetVehicleClassification();
|
||||
EngineType = vehicleBuildInfo.GetEngineType();
|
||||
switch (vehicleClassification){
|
||||
case Aeroplane:
|
||||
VEHICLE_SYNCHED_INT_PARAMETERS.put("ENGINE_COUNT", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.VARINT));
|
||||
BASE_INT_PARAMETERS.put("ENGINE_COUNT",(Integer) vehicleBuildInfo.GetEngineCount());
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("MAX_ENGINE_RPM", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("MAX_ENGINE_RPM",(float)vehicleBuildInfo.GetMaxEngineRPM());
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("WING_SPAN", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("WING_SPAN",(float)vehicleBuildInfo.GetWingSpan());
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("ORIENTATION_ROLL", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("ORIENTATION_ROLL",0f);
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("ORIENTATION_YAW", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("ORIENTATION_YAW",0f);
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("ORIENTATION_PITCH", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("ORIENTATION_PITCH",0f);
|
||||
break;
|
||||
case Zepplin:
|
||||
VEHICLE_SYNCHED_INT_PARAMETERS.put("ENGINE_COUNT", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.VARINT));
|
||||
BASE_INT_PARAMETERS.put("ENGINE_COUNT",(Integer) vehicleBuildInfo.GetEngineCount());
|
||||
VEHICLE_SYNCHED_INT_PARAMETERS.put("GAS_CEL_COUNT", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.VARINT));
|
||||
BASE_INT_PARAMETERS.put("GAS_CEL_COUNT",(Integer)vehicleBuildInfo.GetGasCelCount());
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("MAX_ENGINE_RPM", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("MAX_ENGINE_RPM",(float)vehicleBuildInfo.GetMaxEngineRPM());
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.put("GAS_CEL_CAPACITY", EntityDataManager.createKey(VehicleBaseEntity.class, DataSerializers.FLOAT));
|
||||
BASE_FLOAT_PARAMETERS.put("GAS_CEL_CAPACITY",(float)vehicleBuildInfo.GetGasCelCapacity());
|
||||
break;
|
||||
case Ship:
|
||||
break;
|
||||
}
|
||||
VEHICLE_SYNCHED_INT_PARAMETERS.forEach((VariableName, VehicleParameters)->{
|
||||
this.dataManager.register(VehicleParameters, BASE_INT_PARAMETERS.get(VariableName));
|
||||
});
|
||||
VEHICLE_SYNCHED_FLOAT_PARAMETERS.forEach((VariableName, VehicleParameters)->{
|
||||
this.dataManager.register(VehicleParameters, BASE_FLOAT_PARAMETERS.get(VariableName));
|
||||
});
|
||||
VEHICLE_SYNCHED_BOOLEAN_PARAMETERS.forEach((VariableName, VehicleParameters)->{
|
||||
this.dataManager.register(VehicleParameters, BASE_BOOLEAN_PARAMETERS.get(VariableName));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void SetIntDataValue(String ValueName, Integer Value){
|
||||
if(VEHICLE_SYNCHED_INT_PARAMETERS.containsKey(ValueName)) this.dataManager.set(VEHICLE_SYNCHED_INT_PARAMETERS.get(ValueName),Value);
|
||||
}
|
||||
public Integer GetIntDataValue(String ValueName){
|
||||
return this.dataManager.get(VEHICLE_SYNCHED_INT_PARAMETERS.get(ValueName));
|
||||
}
|
||||
|
||||
public void SetFloatDataValue(String ValueName, Float Value){
|
||||
if(VEHICLE_SYNCHED_FLOAT_PARAMETERS.containsKey(ValueName)) this.dataManager.set(VEHICLE_SYNCHED_FLOAT_PARAMETERS.get(ValueName),Value);
|
||||
}
|
||||
public Float GetFloatDataValue(String ValueName){
|
||||
return this.dataManager.get(VEHICLE_SYNCHED_FLOAT_PARAMETERS.get(ValueName));
|
||||
}
|
||||
|
||||
public void SetBooleanDataValue(String ValueName, Boolean Value){
|
||||
if(VEHICLE_SYNCHED_BOOLEAN_PARAMETERS.containsKey(ValueName)) this.dataManager.set(VEHICLE_SYNCHED_BOOLEAN_PARAMETERS.get(ValueName),Value);
|
||||
}
|
||||
public Boolean GetBooleanDataValue(String ValueName){
|
||||
return this.dataManager.get(VEHICLE_SYNCHED_BOOLEAN_PARAMETERS.get(ValueName));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditional(CompoundNBT compound) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void writeAdditional(CompoundNBT compound) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPacket<?> createSpawnPacket() {
|
||||
return NetworkHooks.getEntitySpawningPacket(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeCollidedWith(){return true;}
|
||||
|
||||
@Override
|
||||
protected boolean canFitPassenger(Entity passenger) {
|
||||
return this.getPassengers().size() < VehicleSeatOffsets.length;
|
||||
}
|
||||
@Override
|
||||
public ActionResultType processInitialInteract(PlayerEntity player, Hand hand) {
|
||||
if (this.getPassengers().size() < VehicleSeatOffsets.length && !player.isPassenger()) {
|
||||
if (!this.world.isRemote()) {
|
||||
return player.startRiding(this) ? ActionResultType.CONSUME : ActionResultType.PASS;
|
||||
}
|
||||
return ActionResultType.func_233537_a_(this.world.isRemote());
|
||||
}
|
||||
return ActionResultType.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity getControllingPassenger() {
|
||||
return this.getPassengers().isEmpty() ? null : this.getPassengers().get(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePassenger(Entity passenger) {
|
||||
if (this.isPassenger(passenger)) {
|
||||
int seatIndex = this.getPassengers().indexOf(passenger);
|
||||
if (seatIndex >= 0 && seatIndex < VehicleSeatOffsets.length) {
|
||||
Vector3d localOffset = VehicleSeatOffsets[seatIndex];
|
||||
Vector3d rotatedOffset = localOffset.rotateYaw((float) Math.toRadians(-this.rotationYaw));
|
||||
passenger.setPosition(
|
||||
this.getPosX() + rotatedOffset.x,
|
||||
this.getPosY() + rotatedOffset.y + passenger.getMountedYOffset(),
|
||||
this.getPosZ() + rotatedOffset.z
|
||||
);
|
||||
} else {
|
||||
super.updatePassenger(passenger);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package net.halbear.hvf;
|
||||
|
||||
import net.halbear.hvf.Registry.ModEntities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.InterModComms;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent;
|
||||
import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
// The value here should match an entry in the META-INF/mods.toml file
|
||||
@Mod("hals_vehicle_framework")
|
||||
public class Halsvehicleframework {
|
||||
public static final String MOD_ID = "hals_vehicle_framework";
|
||||
// Directly reference a log4j logger.
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
|
||||
public Halsvehicleframework() {
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC);
|
||||
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff);
|
||||
|
||||
IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
//register the mod elements on the mod event bus (loads them)
|
||||
ModEntities.ENTITY_TYPES.register(bus);
|
||||
// Register ourselves for server and other game events we are interested in
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
}
|
||||
|
||||
private void setup(final FMLCommonSetupEvent event) {
|
||||
// some preinit code
|
||||
LOGGER.info("HELLO FROM PREINIT");
|
||||
LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName());
|
||||
}
|
||||
|
||||
private void doClientStuff(final FMLClientSetupEvent event) {
|
||||
// do something that can only be done on the client
|
||||
LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings);
|
||||
}
|
||||
|
||||
private void enqueueIMC(final InterModEnqueueEvent event) {
|
||||
// some example code to dispatch IMC to another mod
|
||||
InterModComms.sendTo("hals_vehicle_framework", "helloworld", () -> {
|
||||
LOGGER.info("Hello world from the MDK");
|
||||
return "Hello world";
|
||||
});
|
||||
}
|
||||
|
||||
private void processIMC(final InterModProcessEvent event) {
|
||||
// some example code to receive and process InterModComms from other mods
|
||||
LOGGER.info("Got IMC {}", event.getIMCStream().map(m -> m.getMessageSupplier().get()).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// You can use SubscribeEvent and let the Event Bus discover methods to call
|
||||
@SubscribeEvent
|
||||
public void onServerStarting(FMLServerStartingEvent event) {
|
||||
// do something when the server starts
|
||||
LOGGER.info("HELLO from server starting");
|
||||
}
|
||||
|
||||
// You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD
|
||||
// Event bus for receiving Registry Events)
|
||||
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public static class RegistryEvents {
|
||||
@SubscribeEvent
|
||||
public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) {
|
||||
// register a new block here
|
||||
LOGGER.info("HELLO from Register Block");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package net.halbear.hvf.Registry.EventHandlers;
|
||||
|
||||
import net.halbear.hvf.Entity.Example.Renderer.AeroplaneRenderer;
|
||||
import net.halbear.hvf.Halsvehicleframework;
|
||||
import net.halbear.hvf.Registry.ModEntities;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = Halsvehicleframework.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
|
||||
public class ClientEventHandler {
|
||||
@SafeVarargs
|
||||
public static void SetCollectionRenderType(RenderType type, RegistryObject<Block>... blocks_list) { //hal
|
||||
for (RegistryObject<Block> blockRegistryObject : blocks_list) {
|
||||
RenderTypeLookup.setRenderLayer(blockRegistryObject.get(), type);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public static void init(final FMLClientSetupEvent event) {
|
||||
RenderingRegistry.registerEntityRenderingHandler(ModEntities.AEROPLANE.get(), AeroplaneRenderer::new);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package net.halbear.hvf.Registry;
|
||||
|
||||
import net.halbear.hvf.Entity.Example.Aeroplane;
|
||||
import net.halbear.hvf.Halsvehicleframework;
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.RegistryObject;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
//@Mod.EventBusSubscriber(modid = "hem", bus = Mod.EventBusSubscriber.Bus.MOD)
|
||||
public class ModEntities {
|
||||
public static DeferredRegister<EntityType<?>> ENTITY_TYPES = DeferredRegister.create(ForgeRegistries.ENTITIES, Halsvehicleframework.MOD_ID);
|
||||
|
||||
public static final RegistryObject<EntityType<Aeroplane>> AEROPLANE =
|
||||
ENTITY_TYPES.register("aeroplane", ()-> EntityType.Builder.create(Aeroplane::new,
|
||||
EntityClassification.MISC ).size(3f,8f).build(new ResourceLocation(Halsvehicleframework.MOD_ID, "aeroplane").toString()));
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package net.halbear.hvf.Registry;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.tags.EntityTypeTags;
|
||||
import net.minecraft.tags.ITag;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ModEntityTags {
|
||||
public static final ITag.INamedTag<EntityType<?>> CAMERA_AFFECTED_VEHICLE = EntityTypeTags.createOptional(new ResourceLocation("forge:hvf_camera_affected_vehicle"));
|
||||
|
||||
public static boolean doesEntityHaveCameraPreset(EntityType<?> EntityType){
|
||||
return EntityType.isContained(CAMERA_AFFECTED_VEHICLE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package net.halbear.hvf.Util.Client;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
|
||||
public class VehicleCameraPreset {
|
||||
private Vector3f CamOffset = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
private Vector3f CamTransformations = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
public Vector3f OriginalCamOffset = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
public Vector3f OriginalCamTransformations = new Vector3f(0.0f, 0.0f, 0.0f);
|
||||
private float CamFOV = 70.0f;
|
||||
private float CamFOVExternal = 70.0f;
|
||||
|
||||
public VehicleCameraPreset(Vector3f CamOffset, Vector3f CamTransformations, float FOV, float FOV3rdPerson){
|
||||
OriginalCamOffset = CamOffset;
|
||||
OriginalCamTransformations = CamTransformations;
|
||||
this.CamOffset = CamOffset;
|
||||
this.CamTransformations = CamTransformations;
|
||||
this.CamFOV = FOV;
|
||||
this.CamFOVExternal = FOV3rdPerson;
|
||||
}
|
||||
|
||||
public VehicleCameraPreset Clone(){
|
||||
return new VehicleCameraPreset(this.CamOffset, this.CamTransformations, this.CamFOV, this.CamFOVExternal);
|
||||
}
|
||||
|
||||
public Vector3f GetCameraOffsets(){
|
||||
return CamOffset;
|
||||
}
|
||||
public Vector3f GetCameraTransformations(){
|
||||
return CamTransformations;
|
||||
}
|
||||
public float GetCameraFOV(){
|
||||
return CamFOV;
|
||||
}
|
||||
public float Get3rdPersonCameraFOV(){
|
||||
return CamFOVExternal;
|
||||
}
|
||||
|
||||
public void SetCameraOffsets(Vector3f newCamOffset){CamOffset = newCamOffset;}
|
||||
public void SetCameraTransformations(Vector3f newCamTransformation){ CamTransformations = newCamTransformation; }
|
||||
public void SetCameraFOV(float NewFOV){ CamFOV = NewFOV;}
|
||||
public void Set3rdPersonCameraFOV(float NewExternalFOV){CamFOVExternal = NewExternalFOV;}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package net.halbear.hvf.Util.Client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.PointOfView;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraftforge.client.event.EntityViewRenderEvent;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class VehicleCameraSettings {
|
||||
private static VehicleCameraPreset CurrentPreset = new VehicleCameraPreset(new Vector3f(0,0,0),new Vector3f(0,0,0),70,70);
|
||||
private static EntityType<?> CurrentEntity;
|
||||
private static boolean HvfVehicle = false;
|
||||
public static Vector3f GetCameraOffsets(){
|
||||
return CurrentPreset.GetCameraOffsets();
|
||||
}
|
||||
|
||||
public static Map<EntityType<?>, VehicleCameraPreset> CameraPresets = new HashMap<>();
|
||||
|
||||
public static void AddEntityCameraPreset(EntityType<?> entityType, VehicleCameraPreset vehicleCameraPreset){
|
||||
CameraPresets.put(entityType, vehicleCameraPreset);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void PlayerTickEvent(TickEvent.PlayerTickEvent event) {
|
||||
if(!event.player.world.isRemote()) return;
|
||||
if (event.phase != TickEvent.Phase.END) {
|
||||
return;
|
||||
}
|
||||
if (event.player != null && event.player.isPassenger() && event.player.getRidingEntity() != null
|
||||
&& CurrentEntity != event.player.getRidingEntity().getType()) {
|
||||
Entity Current = event.player.getRidingEntity();
|
||||
CurrentEntity = Current.getType();
|
||||
HvfVehicle = CameraPresets.containsKey(CurrentEntity);
|
||||
if (HvfVehicle) {
|
||||
CurrentPreset = CameraPresets.get(CurrentEntity).Clone();
|
||||
}
|
||||
}
|
||||
if(CurrentPreset == null) return;
|
||||
if ((!event.player.isPassenger() || !HvfVehicle)
|
||||
&& (CurrentPreset.Get3rdPersonCameraFOV() != (float) Minecraft.getInstance().gameSettings.fov
|
||||
|| CurrentPreset.GetCameraFOV() != (float) Minecraft.getInstance().gameSettings.fov || CurrentPreset.GetCameraOffsets().getX() != 0 || CurrentPreset.GetCameraOffsets().getY() != 0
|
||||
|| CurrentPreset.GetCameraOffsets().getZ() != 0 || CurrentPreset.GetCameraTransformations().getX() != 0 || CurrentPreset.GetCameraTransformations().getY() != 0
|
||||
|| CurrentPreset.GetCameraTransformations().getZ() != 0)) {
|
||||
CurrentPreset.SetCameraOffsets(new Vector3f(0.0f, 0.0f, 0.0f));// reset if the players not riding an entity and if any the values aren't 0
|
||||
CurrentPreset.SetCameraTransformations(new Vector3f(0.0f, 0.0f, 0.0f));
|
||||
CurrentPreset.SetCameraFOV((float) Minecraft.getInstance().gameSettings.fov);
|
||||
CurrentPreset.Set3rdPersonCameraFOV((float) Minecraft.getInstance().gameSettings.fov);
|
||||
if (!event.player.isPassenger())
|
||||
CurrentEntity = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onCameraSetup(EntityViewRenderEvent.CameraSetup event) { // sets the Yaw, Roll, and Pitch for the camera, ONLY if its a HEM vehcile as to avoid unnecessary ticks
|
||||
if (HvfVehicle) {
|
||||
event.setRoll(event.getRoll() + CurrentPreset.GetCameraTransformations().getX());
|
||||
event.setYaw(event.getYaw() + CurrentPreset.GetCameraTransformations().getY());
|
||||
event.setPitch(event.getPitch() + CurrentPreset.GetCameraTransformations().getZ());
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onCameraSetup(EntityViewRenderEvent.FOVModifier event) { // sets the FOV
|
||||
if (HvfVehicle) {
|
||||
Minecraft minecraftInstance = Minecraft.getInstance();
|
||||
if (minecraftInstance.player != null && minecraftInstance.gameRenderer != null) {
|
||||
PointOfView Cam = minecraftInstance.gameSettings.getPointOfView();
|
||||
if (Cam == PointOfView.FIRST_PERSON) {
|
||||
event.setFOV(CurrentPreset.GetCameraFOV());
|
||||
} else {
|
||||
event.setFOV(CurrentPreset.Get3rdPersonCameraFOV());
|
||||
}
|
||||
}
|
||||
} else if (event.getFOV() != Minecraft.getInstance().gameSettings.fov) {
|
||||
event.setFOV(Minecraft.getInstance().gameSettings.fov);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.halbear.hvf.Util.Mixin;
|
||||
|
||||
import net.halbear.hvf.Halsvehicleframework;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||
import net.minecraft.client.settings.PointOfView;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.IBlockReader;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import static net.halbear.hvf.Util.Client.VehicleCameraSettings.GetCameraOffsets;
|
||||
|
||||
@Mixin(ActiveRenderInfo.class)
|
||||
public abstract class CameraMixin {
|
||||
@Inject(method = {"update", "func_216772_a"}, at = @At(value = "TAIL"),cancellable = true, remap = true)
|
||||
private void update(IBlockReader currentRenderedLevel, Entity entity, boolean isDetached, boolean isMirrored, float partialTicks, CallbackInfo ci){
|
||||
|
||||
if(entity.isPassenger() && Minecraft.getInstance().gameSettings.getPointOfView() != PointOfView.FIRST_PERSON && entity.getRidingEntity().getType().getRegistryName().getNamespace().equals(Halsvehicleframework.MOD_ID)){
|
||||
Vector3f Position = GetCameraOffsets();
|
||||
this.movePosition(-this.calcCameraDistance(Position.getZ()), Position.getY(), Position.getX());
|
||||
}
|
||||
}
|
||||
@Shadow(aliases = {"move", "func_216782_a"})
|
||||
protected abstract void movePosition(double p_216782_1_, double p_216782_3_, double p_216782_5_);
|
||||
@Shadow(aliases = {"getMaxZoom", "func_216779_a"}) protected abstract double calcCameraDistance(double p_216779_1_);
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package net.halbear.hvf.Util.VehicleData;
|
||||
|
||||
public enum EngineCategories {
|
||||
Aircraft_Propeller,
|
||||
Aircraft_Jet_Engine,
|
||||
Ship_Propeller,
|
||||
Car_Petrol_Engine,
|
||||
Car_Diesel_Engine,
|
||||
Steam_Ship_Engine,
|
||||
Steam_Locomotive,
|
||||
Rocket_Engine
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package net.halbear.hvf.Util.VehicleData;
|
||||
|
||||
public class VehicleBuildInfo {
|
||||
private VehicleClassification vehicleClassification;
|
||||
private int EngineCount;
|
||||
private EngineCategories EngineType;
|
||||
private int GasCelCount;
|
||||
private float MaxSpeedMS;
|
||||
private float MaxEngineRPM;
|
||||
private float WingSpanMeters;
|
||||
private float GasCelCapacity;
|
||||
|
||||
public VehicleBuildInfo(VehicleClassification vehicleClassification){
|
||||
this.vehicleClassification = vehicleClassification;
|
||||
}
|
||||
public VehicleBuildInfo SetEngineType(EngineCategories EngineType){
|
||||
this.EngineType = EngineType;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetGasCelCount(int GasCelCount){
|
||||
this.GasCelCount = GasCelCount;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetEngineCount(int EngineCount){
|
||||
this.EngineCount = EngineCount;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetMaxSpeedMS(float MaxSpeedMS){
|
||||
this.MaxSpeedMS = MaxSpeedMS;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetMaxEngineRPM(float MaxEngineRPM){
|
||||
this.MaxEngineRPM = MaxEngineRPM;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetWingSpan(float WingSpanMeters){
|
||||
this.WingSpanMeters = WingSpanMeters;
|
||||
return this;
|
||||
}
|
||||
public VehicleBuildInfo SetGasCelCapacity(float GasCelCapacity){
|
||||
this.GasCelCapacity = GasCelCapacity;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public VehicleClassification GetVehicleClassification(){
|
||||
return vehicleClassification;
|
||||
}
|
||||
public int GetEngineCount(){
|
||||
return EngineCount;
|
||||
}
|
||||
public EngineCategories GetEngineType(){
|
||||
return EngineType;
|
||||
}
|
||||
public int GetGasCelCount(){
|
||||
return GasCelCount;
|
||||
}
|
||||
public float GetMaxSpeedMS(){return MaxSpeedMS;}
|
||||
public float GetMaxEngineRPM(){return MaxEngineRPM;}
|
||||
public float GetWingSpan(){return WingSpanMeters;}
|
||||
public float GetGasCelCapacity(){return GasCelCapacity;}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package net.halbear.hvf.Util.VehicleData;
|
||||
|
||||
public enum VehicleClassification {
|
||||
Aeroplane,
|
||||
Zepplin,
|
||||
HotAirBalloon,
|
||||
Ship,
|
||||
WheeledLandVehicle,
|
||||
TrackedLandVehicle,
|
||||
RailVehicle,
|
||||
RailCarriage,
|
||||
Sail_Ship
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
# This is an example mods.toml file. It contains the data relating to the loading mods.
|
||||
# There are several mandatory fields (#mandatory), and many more that are optional (#optional).
|
||||
# The overall format is standard TOML format, v0.5.0.
|
||||
# Note that there are a couple of TOML lists in this file.
|
||||
# Find more information on toml format here: https://github.com/toml-lang/toml
|
||||
# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml
|
||||
modLoader = "javafml" #mandatory
|
||||
# A version range to match for said mod loader - for regular FML @Mod it will be the forge version
|
||||
loaderVersion = "[36,)" #mandatory This is typically bumped every Minecraft version by Forge. See our download page for lists of versions.
|
||||
# The license for you mod. This is mandatory metadata and allows for easier comprehension of your redistributive properties.
|
||||
# Review your options at https://choosealicense.com/. All rights reserved is the default copyright stance, and is thus the default here.
|
||||
license = "${mod_license}"
|
||||
# A URL to refer people to when problems occur with this mod
|
||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||
# A list of mods - how many allowed here is determined by the individual mod loader
|
||||
[[mods]] #mandatory
|
||||
# The modid of the mod
|
||||
modId = "hals_vehicle_framework" #mandatory
|
||||
# The version number of the mod
|
||||
version = "${file.jarVersion}" #mandatory
|
||||
# A display name for the mod
|
||||
displayName = "Hals Vehicle Framework" #mandatory
|
||||
# A URL to query for updates for this mod. See the JSON update specification https://docs.minecraftforge.net/en/latest/misc/updatechecker/
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional
|
||||
# A URL for the "homepage" for this mod, displayed in the mod UI
|
||||
displayURL = "https://halbear.net/" #optional
|
||||
# A file name (in the root of the mod JAR) containing a logo for display
|
||||
#logoFile="hals_vehicle_framework.png" #optional
|
||||
# A text field displayed in the mod UI
|
||||
#credits="Thanks for this example mod goes to Java" #optional
|
||||
# A text field displayed in the mod UI
|
||||
authors = "halbear1" #optional
|
||||
# The description text for the mod (multi line!) (#mandatory)
|
||||
description = '''${mod_description}'''
|
||||
# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional.
|
||||
[[dependencies."hals_vehicle_framework"]] #optional
|
||||
# the modid of the dependency
|
||||
modId = "forge" #mandatory
|
||||
# Does this dependency have to exist - if not, ordering below must be specified
|
||||
mandatory = true #mandatory
|
||||
# The version range of the dependency
|
||||
versionRange = "[36,)" #mandatory
|
||||
# An ordering relationship for the dependency - BEFORE or AFTER required if the dependency is not mandatory
|
||||
# BEFORE - This mod is loaded BEFORE the dependency
|
||||
# AFTER - This mod is loaded AFTER the dependency
|
||||
ordering = "NONE"
|
||||
# Side this dependency is applied on - BOTH, CLIENT, or SERVER
|
||||
side = "BOTH"# Here's another dependency
|
||||
[[dependencies."hals_vehicle_framework"]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
# This version range declares a minimum of the current minecraft version up to but not including the next major version
|
||||
versionRange = "[1.16.5,1.17)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
||||
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 5.3 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 9.7 KiB |
|
After Width: | Height: | Size: 6.0 KiB |
|
After Width: | Height: | Size: 550 B |
|
After Width: | Height: | Size: 5.1 KiB |
|
After Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 26 KiB |
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "net.halbear.hvf.Util.Mixin",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"client": [
|
||||
"CameraMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
},
|
||||
"refmap": "hem.mixin-refmap.json"
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "hals_vehicle_framework resources",
|
||||
"pack_format": 6
|
||||
}
|
||||
}
|
||||