Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Minecart as an option to autoremount #523

Merged
merged 3 commits into from
Apr 9, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ import com.lambda.client.util.TimeUnit
import com.lambda.client.util.threads.safeListener
import net.minecraft.entity.Entity
import net.minecraft.entity.item.EntityBoat
import net.minecraft.entity.item.EntityMinecartEmpty

import net.minecraft.entity.passive.*
import net.minecraft.util.EnumHand
import net.minecraftforge.fml.common.gameevent.TickEvent

object AutoRemount : Module(
name = "AutoRemount",
description = "Automatically remounts your ridable entity",
description = "Automatically remounts your rideable entity",
category = Category.MOVEMENT
) {
private val boat by setting("Boats", true)
private val minecart by setting("Minecarts", true)
private val horse by setting("Horse", true)
private val skeletonHorse by setting("Skeleton Horse", true)
private val donkey by setting("Donkey", true)
Expand Down Expand Up @@ -50,13 +53,18 @@ object AutoRemount : Module(
}

private fun isValidEntity(entity: Entity): Boolean {
return boat && entity is EntityBoat
|| entity is EntityAnimal && !entity.isChild // FBI moment
&& (horse && entity is EntityHorse
|| skeletonHorse && entity is EntitySkeletonHorse
|| donkey && entity is EntityDonkey
|| mule && entity is EntityMule
|| pig && entity is EntityPig && entity.saddled
|| llama && entity is EntityLlama)
//check if entity is an animal and not a child
val matureAnimalCheck: Boolean = entity is EntityAnimal && !entity.isChild //FBI moment
return when (entity) {
is EntityBoat -> boat
is EntityMinecartEmpty -> minecart
is EntityHorse -> horse && matureAnimalCheck
is EntitySkeletonHorse -> skeletonHorse && matureAnimalCheck
is EntityDonkey -> donkey && matureAnimalCheck
is EntityMule -> mule && matureAnimalCheck
is EntityPig -> pig && entity.saddled && matureAnimalCheck
is EntityLlama -> llama && matureAnimalCheck
else -> false
}
}
}