mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Changelings disguised as spiders can climb walls
This commit is contained in:
parent
a4c0d936f4
commit
376058ae61
1 changed files with 20 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
package com.minelittlepony.unicopia.mixin;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
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.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
|
@ -8,18 +11,24 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import com.minelittlepony.unicopia.ability.magic.spell.DisguiseSpell;
|
||||
import com.minelittlepony.unicopia.entity.Creature;
|
||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||
import com.minelittlepony.unicopia.entity.Equine;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.mob.SpiderEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
abstract class MixinLivingEntity extends Entity implements PonyContainer<Equine<?>> {
|
||||
|
||||
@Shadow
|
||||
private Optional<BlockPos> climbingPos;
|
||||
|
||||
private Equine<?> caster;
|
||||
|
||||
private MixinLivingEntity() { super(null, null); }
|
||||
|
@ -37,6 +46,17 @@ abstract class MixinLivingEntity extends Entity implements PonyContainer<Equine<
|
|||
return caster;
|
||||
}
|
||||
|
||||
@Inject(method = "isClimbing()Z", at = @At("HEAD"), cancellable = true)
|
||||
public void onIsClimbing(CallbackInfoReturnable<Boolean> info) {
|
||||
if (get() instanceof Pony && horizontalCollision) {
|
||||
DisguiseSpell disguise = ((Pony)get()).getSpell(DisguiseSpell.class, false);
|
||||
if (disguise != null && disguise.getDisguise() instanceof SpiderEntity) {
|
||||
climbingPos = Optional.of(getBlockPos());
|
||||
info.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "canSee(Lnet/minecraft/entity/Entity;)Z", at = @At("HEAD"), cancellable = true)
|
||||
private void onCanSee(Entity other, CallbackInfoReturnable<Boolean> info) {
|
||||
if (get().isInvisible()) {
|
||||
|
|
Loading…
Reference in a new issue