Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
uses: actions/upload-artifact@v4
if: success()
with:
name: mod-jars
path: build/libs/*.jar
name: mobends-ci-build
path: build/libs/*-all.jar
retention-days: 30

- name: Comment PR with artifact URLs
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
!/gradle
!/gradlew
!/gradlew.bat
!/README.md
!/LICENSE
46 changes: 42 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,21 @@ buildscript {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:3.+'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.72'
classpath 'com.github.johnrengelman.shadow:com.github.johnrengelman.shadow.gradle.plugin:4.0.4'
}
}

apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'kotlin'
apply plugin: 'maven-publish'
apply plugin: 'com.github.johnrengelman.shadow'

version = "${mod_version}-${getDate()}"
group = "goblinbob.mobends" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand All @@ -21,6 +26,18 @@ archivesBaseName = "MoBends_${minecraft_version}"
// Need this here so eclipse task generates correctly.
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8'

// Kotlin configuration
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}

minecraft {
// The mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD Snapshot are built nightly.
Expand Down Expand Up @@ -81,6 +98,12 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html

// Kotlin support
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.3.72'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.72'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72'
implementation 'org.jetbrains.kotlin:kotlin-reflect:1.3.72'

testCompile "junit:junit:4.11"
}

Expand All @@ -102,13 +125,19 @@ jar {

// Temporary fix for resources not being available during testing
// Comment this out upon publishing
sourceSets {main { output.resourcesDir = output.classesDir }}
// sourceSets {main { output.resourcesDir = output.classesDir }}

// Example configuration to allow publishing using the maven-publish task
// This is the preferred method to reobfuscate your jar file
jar.finalizedBy('reobfJar')
// Configure reobf to work on shadowJar instead of regular jar
reobf {
shadowJar {
// This will create a reobfuscated shadow jar
}
}
shadowJar.finalizedBy('reobfShadowJar')
// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
//publish.dependsOn('reobfJar')
//publish.dependsOn('reobfShadowJar')

processResources {
// this will ensure that this task is redone when the versions change.
Expand All @@ -129,10 +158,19 @@ processResources {
}
}

// Bundling the Kotlin standard library along with the mod
shadowJar {
dependencies {
include(dependency('org.jetbrains.kotlin:kotlin-stdlib'))
include(dependency('org.jetbrains.kotlin:kotlin-stdlib-jdk8'))
}
relocate 'kotlin', 'goblinbob.mobends.kotlin'
}

publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact shadowJar
}
}
repositories {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package goblinbob.mobends.standard.animation.bit.biped

import goblinbob.mobends.core.animation.bit.AnimationBit
import goblinbob.mobends.standard.data.BipedEntityData
import net.minecraft.entity.EntityLivingBase
import net.minecraft.util.math.MathHelper
import kotlin.math.PI
import kotlin.math.cos
import kotlin.math.max

/**
* Represents a jump animation bit for biped entities.
*/
class JumpAnimationBit<T : BipedEntityData<*>> : AnimationBit<T>() {
/**
* All constants that are shared across all bits of this type.
*/
companion object {
/*
* Holds the actions that the bits of this type perform.
* TODO: Used by bends-packs, but not sure for purpose exactly.
*/
private val ACTIONS = arrayOf("jump")
}

override fun getActions(entityData: T): Array<String> = ACTIONS

override fun onPlay(data: T) {
data.renderRotation.identity()
data.centerRotation.identity()
data.body.rotation.orientInstantX(20f)
data.rightLeg.rotation.orientInstantX(0f)
data.leftLeg.rotation.orientInstantX(0f)
data.rightForeLeg.rotation.orientInstantX(0f)
data.leftForeLeg.rotation.orientInstantX(0f)
data.rightArm.rotation.orientInstantZ(2f)
data.leftArm.rotation.orientInstantZ(-2f)
data.rightForeArm.rotation.orientInstantX(-20f)
data.leftForeArm.rotation.orientInstantX(-20f)
}

override fun perform(data: T) {
if (data.prevMotionY < 0 && data.motionY > 0) {
/*
* Restarting the animation if the player is going back up again after falling
* down.
*/
onPlay(data)
}

data.globalOffset.slideToZero(0.3f)
data.renderRotation.setSmoothness(0.3f).orientZero()
data.centerRotation.setSmoothness(0.7f).orientZero()
data.renderRightItemRotation.setSmoothness(0.3f).orientZero()
data.renderLeftItemRotation.setSmoothness(0.3f).orientZero()

val bodyRotationX = max(1.0f - data.ticksInAir * 0.1f, 0.0f)
data.body.rotation.setSmoothness(0.2f).orientX(bodyRotationX)
data.rightArm.rotation.setSmoothness(0.05f).orientZ(45f)
data.leftArm.rotation.setSmoothness(0.05f).orientZ(-45f)
data.rightForeArm.rotation.setSmoothness(0.3f).orientX(0f)
data.leftForeArm.rotation.setSmoothness(0.3f).orientX(0f)

data.head.rotation.orientX(data.headPitch.get() - bodyRotationX).rotateY(data.headYaw.get())

if (!data.isStillHorizontally()) {
val limbSwing = data.limbSwing.get() * 0.6662f
val limbSwingAmount = 0.7f * data.limbSwingAmount.get() / PI.toFloat() * 180f

data.rightLeg.rotation.setSmoothness(1.0f).orientX(-5f + MathHelper.cos(limbSwing) * limbSwingAmount)
data.leftLeg.rotation.setSmoothness(1.0f)
.orientX(-5f + MathHelper.cos(limbSwing + PI.toFloat()) * limbSwingAmount)

val limbSwingVar = (limbSwing / PI.toFloat()) % 2
data.leftForeLeg.rotation.setSmoothness(0.3f).orientX(if (limbSwingVar > 1) 45f else 0f)
data.rightForeLeg.rotation.setSmoothness(0.3f).orientX(if (limbSwingVar > 1) 0f else 45f)
data.leftForeArm.rotation.setSmoothness(0.3f)
.orientX((MathHelper.cos(limbSwing + PI.toFloat() / 2) / 2f + 0.5f) * -20f)
data.rightForeArm.rotation.setSmoothness(0.3f).orientX((MathHelper.cos(limbSwing) / 2f + 0.5f) * -20f)
} else {
data.rightLeg.rotation.setSmoothness(0.1f).orientZ(10f)
data.rightLeg.rotation.setSmoothness(0.3f).rotateX(-45f)
data.leftLeg.rotation.setSmoothness(0.1f).orientZ(-10f)
data.leftLeg.rotation.setSmoothness(0.3f).rotateX(-17f)
data.rightForeLeg.rotation.setSmoothness(0.3f).orientX(70f)
data.leftForeLeg.rotation.setSmoothness(0.3f).orientX(17f)
}
}
}