mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed players still taking lava damage when riding a boat in lava
This commit is contained in:
parent
8b38c54df0
commit
617869519d
5 changed files with 23 additions and 5 deletions
|
@ -2,6 +2,11 @@ package com.minelittlepony.unicopia.entity.duck;
|
|||
|
||||
import net.minecraft.entity.Entity.RemovalReason;
|
||||
|
||||
public interface EntityDuck {
|
||||
public interface EntityDuck extends LavaAffine {
|
||||
void setRemovalReason(RemovalReason reason);
|
||||
|
||||
@Override
|
||||
default void setLavaAffine(boolean lavaAffine) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package com.minelittlepony.unicopia.entity.duck;
|
||||
|
||||
import com.minelittlepony.unicopia.entity.Equine;
|
||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.Hand;
|
||||
|
||||
public interface LivingEntityDuck {
|
||||
public interface LivingEntityDuck extends PonyContainer<Equine<?>> {
|
||||
void updateItemUsage(Hand hand, ItemStack stack, int time);
|
||||
|
||||
boolean isJumping();
|
||||
|
|
|
@ -6,18 +6,19 @@ import org.spongepowered.asm.mixin.injection.*;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.minelittlepony.unicopia.entity.duck.LavaAffine;
|
||||
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.data.*;
|
||||
import net.minecraft.entity.vehicle.BoatEntity;
|
||||
import net.minecraft.fluid.Fluid;
|
||||
import net.minecraft.nbt.NbtCompound;
|
||||
import net.minecraft.particle.ParticleTypes;
|
||||
import net.minecraft.tag.FluidTags;
|
||||
import net.minecraft.tag.TagKey;
|
||||
|
||||
@Mixin(BoatEntity.class)
|
||||
abstract class MixinBoatEntity extends Entity implements LavaAffine {
|
||||
|
||||
private static final TrackedData<Boolean> IS_LAVA_BOAT = DataTracker.registerData(BoatEntity.class, TrackedDataHandlerRegistry.BOOLEAN);
|
||||
|
||||
MixinBoatEntity() { super(null, null); }
|
||||
|
@ -61,6 +62,9 @@ abstract class MixinBoatEntity extends Entity implements LavaAffine {
|
|||
@Override
|
||||
public void setLavaAffine(boolean lavaAffine) {
|
||||
dataTracker.set(IS_LAVA_BOAT, lavaAffine);
|
||||
if (lavaAffine) {
|
||||
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, this, 10);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -18,9 +18,15 @@ abstract class MixinEntity implements EntityDuck {
|
|||
@Accessor
|
||||
public abstract void setRemovalReason(RemovalReason reason);
|
||||
|
||||
@Override
|
||||
public boolean isLavaAffine() {
|
||||
Entity self = (Entity)(Object)this;
|
||||
return self.hasVehicle() && ((LavaAffine)self.getVehicle()).isLavaAffine();
|
||||
}
|
||||
|
||||
@Inject(method = "isFireImmune", at = @At("HEAD"), cancellable = true)
|
||||
private void onIsFireImmune(CallbackInfoReturnable<Boolean> info) {
|
||||
if (this instanceof LavaAffine e && e.isLavaAffine()) {
|
||||
if (isLavaAffine()) {
|
||||
info.setReturnValue(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ import net.minecraft.util.Hand;
|
|||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
@Mixin(LivingEntity.class)
|
||||
abstract class MixinLivingEntity extends Entity implements PonyContainer<Equine<?>>, LivingEntityDuck {
|
||||
abstract class MixinLivingEntity extends Entity implements LivingEntityDuck {
|
||||
@Shadow
|
||||
protected ItemStack activeItemStack;
|
||||
@Shadow
|
||||
|
|
Loading…
Reference in a new issue