diff options
author | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-16 19:01:11 -0400 |
---|---|---|
committer | My-Name-Is-Jeff <37018278+My-Name-Is-Jeff@users.noreply.github.com> | 2021-09-16 19:15:18 -0400 |
commit | ce3d5c9ef63bd706787cedba424b2d8235cb9978 (patch) | |
tree | fb7675f892145b2f2bf1e2f788237a0c1ed28845 /src/main | |
parent | 8475b10816526b09db5c7f83585f6305b2ba4107 (diff) | |
download | SkytilsMod-ce3d5c9ef63bd706787cedba424b2d8235cb9978.tar.gz SkytilsMod-ce3d5c9ef63bd706787cedba424b2d8235cb9978.tar.bz2 SkytilsMod-ce3d5c9ef63bd706787cedba424b2d8235cb9978.zip |
breefing dog
Diffstat (limited to 'src/main')
4 files changed, 51 insertions, 37 deletions
diff --git a/src/main/java/skytils/skytilsmod/mixins/transformers/entity/MixinEntityLivingBase.java b/src/main/java/skytils/skytilsmod/mixins/transformers/entity/MixinEntityLivingBase.java index 5ee1298c..9cebd32c 100644 --- a/src/main/java/skytils/skytilsmod/mixins/transformers/entity/MixinEntityLivingBase.java +++ b/src/main/java/skytils/skytilsmod/mixins/transformers/entity/MixinEntityLivingBase.java @@ -24,31 +24,40 @@ import net.minecraft.potion.Potion; import net.minecraft.util.EnumParticleTypes; import net.minecraft.world.World; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import skytils.skytilsmod.mixins.hooks.entity.EntityLivingBaseHookKt; +import skytils.skytilsmod.mixins.hooks.entity.EntityLivingBaseHook; @Mixin(EntityLivingBase.class) public abstract class MixinEntityLivingBase extends Entity { + @Unique + private final EntityLivingBaseHook hook = new EntityLivingBaseHook((EntityLivingBase) (Object) this); + public MixinEntityLivingBase(World worldIn) { super(worldIn); } @Inject(method = "isPotionActive(Lnet/minecraft/potion/Potion;)Z", at = @At("HEAD"), cancellable = true) private void modifyPotionActive(Potion potion, CallbackInfoReturnable<Boolean> cir) { - EntityLivingBaseHookKt.modifyPotionActive(potion, cir); + hook.modifyPotionActive(potion.id, cir); } @Inject(method = "isPotionActive(I)Z", at = @At("HEAD"), cancellable = true) private void modifyPotionActive(int potionId, CallbackInfoReturnable<Boolean> cir) { - EntityLivingBaseHookKt.modifyPotionActive(potionId, cir); + hook.modifyPotionActive(potionId, cir); } @Redirect(method = "onDeathUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;spawnParticle(Lnet/minecraft/util/EnumParticleTypes;DDDDDD[I)V")) private void spawnParticle(World world, EnumParticleTypes particleType, double xCoord, double yCoord, double zCoord, double xOffset, double yOffset, double zOffset, int[] p_175688_14_) { - EntityLivingBaseHookKt.removeDeathParticle(world, particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_); + hook.removeDeathParticle(world, particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, p_175688_14_); + } + + @Inject(method = "isChild", at = @At("HEAD"), cancellable = true) + private void setChildState(CallbackInfoReturnable<Boolean> cir) { + hook.isChild(cir); } } diff --git a/src/main/kotlin/skytils/skytilsmod/asm/transformers/SplashProgressTransformer.kt b/src/main/kotlin/skytils/skytilsmod/asm/transformers/SplashProgressTransformer.kt index bc9d869c..81efc414 100644 --- a/src/main/kotlin/skytils/skytilsmod/asm/transformers/SplashProgressTransformer.kt +++ b/src/main/kotlin/skytils/skytilsmod/asm/transformers/SplashProgressTransformer.kt @@ -65,7 +65,8 @@ fun injectSplashProgressTransformer() = modify("net.minecraftforge.fml.client.Sp object SplashProgressTransformer { val gifs = mapOf( 0.0 to ResourceLocation("skytils", "sychicpet.gif"), - 90.0 to ResourceLocation("skytils", "sychiccat.png"), + 88.5 to ResourceLocation("skytils", "sychiccat.png"), + 94.5 to ResourceLocation("skytils", "breefingdog.png"), 96.0 to ResourceLocation("skytils", "azoopet.gif"), 99.0 to ResourceLocation("skytils", "abdpfp.gif"), // this is the chance of winning the jackpot on the lottery, but even less due to a loss of precision diff --git a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/entity/EntityLivingBaseHook.kt b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/entity/EntityLivingBaseHook.kt index d0f941e0..980dc30d 100644 --- a/src/main/kotlin/skytils/skytilsmod/mixins/hooks/entity/EntityLivingBaseHook.kt +++ b/src/main/kotlin/skytils/skytilsmod/mixins/hooks/entity/EntityLivingBaseHook.kt @@ -17,43 +17,47 @@ */ package skytils.skytilsmod.mixins.hooks.entity -import skytils.skytilsmod.Skytils -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable -import net.minecraft.world.World -import net.minecraft.util.EnumParticleTypes +import net.minecraft.client.entity.EntityPlayerSP import net.minecraft.entity.EntityLivingBase -import net.minecraft.entity.Entity +import net.minecraft.entity.player.EntityPlayer import net.minecraft.potion.Potion -import org.spongepowered.asm.mixin.Mixin -import org.spongepowered.asm.mixin.injection.* -import skytils.skytilsmod.utils.* +import net.minecraft.util.EnumParticleTypes +import net.minecraft.world.World +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable +import skytils.skytilsmod.Skytils +import skytils.skytilsmod.utils.Utils +import kotlin.random.Random + +class EntityLivingBaseHook(val entity: EntityLivingBase) { + + val isBreefing by lazy { + Utils.inSkyblock && entity.name == "Breefing" && entity is EntityPlayer && Random.nextInt(100) < 3 + } -fun modifyPotionActive(potion: Potion, cir: CallbackInfoReturnable<Boolean>) { - if (!Utils.inSkyblock) return - if (Skytils.config.disableNightVision && potion === Potion.nightVision) { - cir.returnValue = false + fun modifyPotionActive(potionId: Int, cir: CallbackInfoReturnable<Boolean>) { + if (!Utils.inSkyblock) return + if (Skytils.config.disableNightVision && potionId == Potion.nightVision.id && entity is EntityPlayerSP) { + cir.returnValue = false + } } -} -fun modifyPotionActive(potionId: Int, cir: CallbackInfoReturnable<Boolean>) { - if (!Utils.inSkyblock) return - if (Skytils.config.disableNightVision && potionId == Potion.nightVision.id) { - cir.returnValue = false + fun removeDeathParticle( + world: World, + particleType: EnumParticleTypes, + xCoord: Double, + yCoord: Double, + zCoord: Double, + xOffset: Double, + yOffset: Double, + zOffset: Double, + p_175688_14_: IntArray + ) { + if (!(Skytils.config.hideDeathParticles && particleType == EnumParticleTypes.EXPLOSION_NORMAL)) { + world.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, *p_175688_14_) + } } -} -fun removeDeathParticle( - world: World, - particleType: EnumParticleTypes, - xCoord: Double, - yCoord: Double, - zCoord: Double, - xOffset: Double, - yOffset: Double, - zOffset: Double, - p_175688_14_: IntArray -) { - if (!(Skytils.config.hideDeathParticles && particleType == EnumParticleTypes.EXPLOSION_NORMAL)) { - world.spawnParticle(particleType, xCoord, yCoord, zCoord, xOffset, yOffset, zOffset, *p_175688_14_) + fun isChild(cir: CallbackInfoReturnable<Boolean>) { + cir.returnValue = isBreefing } -} +}
\ No newline at end of file diff --git a/src/main/resources/assets/skytils/breefingdog.png b/src/main/resources/assets/skytils/breefingdog.png Binary files differnew file mode 100644 index 00000000..96f9251e --- /dev/null +++ b/src/main/resources/assets/skytils/breefingdog.png |