mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Cleanup and move duck interfaces to a dedicated package
This commit is contained in:
parent
1cea2bf391
commit
7b58fdb6ba
25 changed files with 82 additions and 95 deletions
|
@ -5,7 +5,7 @@ import com.minelittlepony.unicopia.ability.magic.spell.HomingSpell;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
import com.minelittlepony.unicopia.ability.magic.spell.Situation;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.SpellTraits;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
import com.minelittlepony.unicopia.ability.magic.spell.trait.Trait;
|
||||||
import com.minelittlepony.unicopia.entity.LavaAffine;
|
import com.minelittlepony.unicopia.entity.duck.LavaAffine;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
|
||||||
|
|
||||||
public interface CapeHolder {
|
|
||||||
void callUpdateCapeAngles();
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Hand;
|
|
||||||
|
|
||||||
public interface ItemWielder {
|
|
||||||
void updateItemUsage(Hand hand, ItemStack stack, int time);
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
|
||||||
|
|
||||||
public interface Jumper {
|
|
||||||
boolean isJumping();
|
|
||||||
}
|
|
|
@ -1,16 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
|
||||||
|
|
||||||
public interface Leaner {
|
|
||||||
float getLeaningPitch();
|
|
||||||
|
|
||||||
void setLeaningPitch(float pitch);
|
|
||||||
|
|
||||||
float getLastLeaningPitch();
|
|
||||||
|
|
||||||
void setLastLeaningPitch(float pitch);
|
|
||||||
|
|
||||||
default void copyFrom(Leaner other) {
|
|
||||||
setLeaningPitch(other.getLeaningPitch());
|
|
||||||
setLastLeaningPitch(other.getLastLeaningPitch());
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
|
||||||
|
|
||||||
public interface MotionChecker {
|
|
||||||
void setPreventMotionChecks(boolean enabled);
|
|
||||||
}
|
|
|
@ -7,9 +7,9 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.Unicopia;
|
import com.minelittlepony.unicopia.Unicopia;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.entity.ItemWielder;
|
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.EntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.entity.Removeable;
|
|
||||||
import com.minelittlepony.unicopia.util.Registries;
|
import com.minelittlepony.unicopia.util.Registries;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
@ -105,7 +105,7 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
public void copyBaseAttributes(LivingEntity from, Entity to, Vec3d positionOffset) {
|
public void copyBaseAttributes(LivingEntity from, Entity to, Vec3d positionOffset) {
|
||||||
// Set first because position calculations rely on it
|
// Set first because position calculations rely on it
|
||||||
to.age = from.age;
|
to.age = from.age;
|
||||||
((Removeable)to).setRemovalReason(from.getRemovalReason());
|
((EntityDuck)to).setRemovalReason(from.getRemovalReason());
|
||||||
to.setOnGround(from.isOnGround());
|
to.setOnGround(from.isOnGround());
|
||||||
|
|
||||||
if (!from.world.isClient) {
|
if (!from.world.isClient) {
|
||||||
|
@ -146,8 +146,8 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
|
|
||||||
to.updatePosition(x, y, z);
|
to.updatePosition(x, y, z);
|
||||||
|
|
||||||
if (to instanceof FallingBlockEntity) {
|
if (to instanceof FallingBlockEntity fbe) {
|
||||||
((FallingBlockEntity)to).setFallingBlockPos(from.getBlockPos());
|
fbe.setFallingBlockPos(from.getBlockPos());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
to.copyPositionAndRotation(from);
|
to.copyPositionAndRotation(from);
|
||||||
|
@ -170,13 +170,11 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
to.horizontalSpeed = from.horizontalSpeed;
|
to.horizontalSpeed = from.horizontalSpeed;
|
||||||
to.prevHorizontalSpeed = from.prevHorizontalSpeed;
|
to.prevHorizontalSpeed = from.prevHorizontalSpeed;
|
||||||
to.setOnGround(from.isOnGround());
|
to.setOnGround(from.isOnGround());
|
||||||
to.setInvulnerable(from.isInvulnerable() || (from instanceof PlayerEntity && ((PlayerEntity)from).getAbilities().creativeMode));
|
to.setInvulnerable(from.isInvulnerable() || (from instanceof PlayerEntity player && player.getAbilities().creativeMode));
|
||||||
|
|
||||||
to.distanceTraveled = from.distanceTraveled;
|
to.distanceTraveled = from.distanceTraveled;
|
||||||
|
|
||||||
if (to instanceof LivingEntity) {
|
if (to instanceof LivingEntity l) {
|
||||||
LivingEntity l = (LivingEntity)to;
|
|
||||||
|
|
||||||
l.headYaw = from.headYaw;
|
l.headYaw = from.headYaw;
|
||||||
l.prevHeadYaw = from.prevHeadYaw;
|
l.prevHeadYaw = from.prevHeadYaw;
|
||||||
l.bodyYaw = from.bodyYaw;
|
l.bodyYaw = from.bodyYaw;
|
||||||
|
@ -205,19 +203,19 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
copyInventory(from, l);
|
copyInventory(from, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to instanceof TameableEntity) {
|
if (to instanceof TameableEntity tameable) {
|
||||||
((TameableEntity)to).setSitting(from.isSneaking());
|
tameable.setSitting(from.isSneaking());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to instanceof AbstractSkeletonEntity) {
|
if (to instanceof AbstractSkeletonEntity skeleton) {
|
||||||
((AbstractSkeletonEntity)to).setAttacking(from.getItemUseTimeLeft() > 0);
|
skeleton.setAttacking(from.getItemUseTimeLeft() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (to instanceof ItemWielder) {
|
if (to instanceof LivingEntityDuck duck) {
|
||||||
((ItemWielder)to).updateItemUsage(from.getActiveHand(), from.getActiveItem(), from.getItemUseTimeLeft());
|
duck.updateItemUsage(from.getActiveHand(), from.getActiveItem(), from.getItemUseTimeLeft());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (from.age < 100 || from instanceof PlayerEntity && (((PlayerEntity)from).isCreative() || ((PlayerEntity)from).isSpectator())) {
|
if (from.age < 100 || from instanceof PlayerEntity player && (player.isCreative() || player.isSpectator())) {
|
||||||
to.extinguish();
|
to.extinguish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +249,7 @@ public class EntityBehaviour<T extends Entity> {
|
||||||
|
|
||||||
protected boolean isSneakingOnGround(Caster<?> source) {
|
protected boolean isSneakingOnGround(Caster<?> source) {
|
||||||
Entity e = source.getEntity();
|
Entity e = source.getEntity();
|
||||||
return e.isSneaking() && (e.isOnGround() && !(e instanceof PlayerEntity && ((PlayerEntity)e).getAbilities().flying));
|
return e.isSneaking() && (e.isOnGround() && !(e instanceof PlayerEntity player && player.getAbilities().flying));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static <T extends Entity> void register(Supplier<EntityBehaviour<T>> behaviour, EntityType<?>... types) {
|
public static <T extends Entity> void register(Supplier<EntityBehaviour<T>> behaviour, EntityType<?>... types) {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity.behaviour;
|
package com.minelittlepony.unicopia.entity.behaviour;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.entity.CapeHolder;
|
import com.minelittlepony.unicopia.entity.duck.*;
|
||||||
import com.minelittlepony.unicopia.entity.Leaner;
|
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -10,8 +9,8 @@ import net.minecraft.entity.player.PlayerEntity;
|
||||||
public class PlayerBehaviour extends EntityBehaviour<PlayerEntity> {
|
public class PlayerBehaviour extends EntityBehaviour<PlayerEntity> {
|
||||||
@Override
|
@Override
|
||||||
public void update(Caster<?> source, PlayerEntity entity, Disguise spell) {
|
public void update(Caster<?> source, PlayerEntity entity, Disguise spell) {
|
||||||
if (source instanceof Pony) {
|
if (source instanceof Pony pony) {
|
||||||
PlayerEntity pFrom = ((Pony)source).getMaster();
|
PlayerEntity pFrom = pony.getMaster();
|
||||||
|
|
||||||
entity.capeX = pFrom.capeX;
|
entity.capeX = pFrom.capeX;
|
||||||
entity.capeY = pFrom.capeY;
|
entity.capeY = pFrom.capeY;
|
||||||
|
@ -20,7 +19,7 @@ public class PlayerBehaviour extends EntityBehaviour<PlayerEntity> {
|
||||||
entity.prevCapeY = pFrom.prevCapeY;
|
entity.prevCapeY = pFrom.prevCapeY;
|
||||||
entity.prevCapeZ = pFrom.prevCapeZ;
|
entity.prevCapeZ = pFrom.prevCapeZ;
|
||||||
} else {
|
} else {
|
||||||
((CapeHolder)entity).callUpdateCapeAngles();
|
((PlayerEntityDuck)entity).callUpdateCapeAngles();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (source.getEntity().getPose() != entity.getPose()) {
|
if (source.getEntity().getPose() != entity.getPose()) {
|
||||||
|
@ -29,8 +28,8 @@ public class PlayerBehaviour extends EntityBehaviour<PlayerEntity> {
|
||||||
if (source.getEntity().isSwimming() != entity.isSwimming()) {
|
if (source.getEntity().isSwimming() != entity.isSwimming()) {
|
||||||
entity.setSwimming(source.getEntity().isSwimming());
|
entity.setSwimming(source.getEntity().isSwimming());
|
||||||
}
|
}
|
||||||
if (source.getEntity() instanceof Leaner) {
|
if (source.getEntity() instanceof LivingEntityDuck duck) {
|
||||||
((Leaner)entity).copyFrom(((Leaner)source.getEntity()));
|
duck.copyLeaningAnglesFrom(((LivingEntityDuck)source.getEntity()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity.RemovalReason;
|
import net.minecraft.entity.Entity.RemovalReason;
|
||||||
|
|
||||||
public interface Removeable {
|
public interface EntityDuck {
|
||||||
void setRemovalReason(RemovalReason reason);
|
void setRemovalReason(RemovalReason reason);
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
public interface LavaAffine {
|
public interface LavaAffine {
|
||||||
void setLavaAffine(boolean lavaAffine);
|
void setLavaAffine(boolean lavaAffine);
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
public interface LivingEntityDuck {
|
||||||
|
void updateItemUsage(Hand hand, ItemStack stack, int time);
|
||||||
|
|
||||||
|
boolean isJumping();
|
||||||
|
|
||||||
|
float getLeaningPitch();
|
||||||
|
|
||||||
|
void setLeaningPitch(float pitch);
|
||||||
|
|
||||||
|
float getLastLeaningPitch();
|
||||||
|
|
||||||
|
void setLastLeaningPitch(float pitch);
|
||||||
|
|
||||||
|
default void copyLeaningAnglesFrom(LivingEntityDuck other) {
|
||||||
|
setLeaningPitch(other.getLeaningPitch());
|
||||||
|
setLastLeaningPitch(other.getLastLeaningPitch());
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
|
public interface PlayerEntityDuck {
|
||||||
|
void callUpdateCapeAngles();
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
package com.minelittlepony.unicopia.entity;
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.minelittlepony.unicopia.entity.duck;
|
||||||
|
|
||||||
|
public interface ServerPlayerEntityDuck {
|
||||||
|
void setPreventMotionChecks(boolean enabled);
|
||||||
|
}
|
|
@ -9,6 +9,8 @@ import com.minelittlepony.unicopia.ability.magic.spell.effect.SpellType;
|
||||||
import com.minelittlepony.unicopia.advancement.UCriteria;
|
import com.minelittlepony.unicopia.advancement.UCriteria;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
import com.minelittlepony.unicopia.entity.*;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.LivingEntityDuck;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.Leaner;
|
||||||
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
import com.minelittlepony.unicopia.entity.player.MagicReserves.Bar;
|
||||||
import com.minelittlepony.unicopia.item.AmuletItem;
|
import com.minelittlepony.unicopia.item.AmuletItem;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
@ -231,7 +233,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
cancelFlight();
|
cancelFlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entity.isClimbing() && (entity.horizontalCollision || ((Jumper)entity).isJumping())) {
|
if (entity.isClimbing() && (entity.horizontalCollision || ((LivingEntityDuck)entity).isJumping())) {
|
||||||
velocity.y = -0.2F;
|
velocity.y = -0.2F;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.*;
|
import org.spongepowered.asm.mixin.injection.*;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.LavaAffine;
|
import com.minelittlepony.unicopia.entity.duck.LavaAffine;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.data.*;
|
import net.minecraft.entity.data.*;
|
||||||
|
@ -67,5 +67,4 @@ abstract class MixinBoatEntity extends Entity implements LavaAffine {
|
||||||
public boolean isLavaAffine() {
|
public boolean isLavaAffine() {
|
||||||
return dataTracker.get(IS_LAVA_BOAT);
|
return dataTracker.get(IS_LAVA_BOAT);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,9 +4,10 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import com.minelittlepony.unicopia.entity.RotatedView;
|
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
import com.minelittlepony.unicopia.entity.Equine;
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
import com.minelittlepony.unicopia.entity.Living;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.RotatedView;
|
||||||
|
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.entity.ai.brain.Brain;
|
import net.minecraft.entity.ai.brain.Brain;
|
||||||
|
|
|
@ -6,14 +6,14 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.LavaAffine;
|
import com.minelittlepony.unicopia.entity.duck.LavaAffine;
|
||||||
import com.minelittlepony.unicopia.entity.Removeable;
|
import com.minelittlepony.unicopia.entity.duck.EntityDuck;
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.Entity.RemovalReason;
|
import net.minecraft.entity.Entity.RemovalReason;
|
||||||
|
|
||||||
@Mixin(Entity.class)
|
@Mixin(Entity.class)
|
||||||
abstract class MixinEntity implements Removeable {
|
abstract class MixinEntity implements EntityDuck {
|
||||||
@Override
|
@Override
|
||||||
@Accessor
|
@Accessor
|
||||||
public abstract void setRemovalReason(RemovalReason reason);
|
public abstract void setRemovalReason(RemovalReason reason);
|
||||||
|
|
|
@ -15,14 +15,10 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import com.minelittlepony.unicopia.ability.magic.Caster;
|
import com.minelittlepony.unicopia.ability.magic.Caster;
|
||||||
import com.minelittlepony.unicopia.ability.magic.SpellPredicate;
|
import com.minelittlepony.unicopia.ability.magic.SpellPredicate;
|
||||||
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
|
import com.minelittlepony.unicopia.ability.magic.spell.AbstractDisguiseSpell;
|
||||||
import com.minelittlepony.unicopia.entity.Creature;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
|
||||||
import com.minelittlepony.unicopia.entity.behaviour.EntityAppearance;
|
import com.minelittlepony.unicopia.entity.behaviour.EntityAppearance;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.*;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
|
||||||
import com.minelittlepony.unicopia.entity.ItemWielder;
|
|
||||||
import com.minelittlepony.unicopia.entity.Jumper;
|
|
||||||
import com.minelittlepony.unicopia.entity.Leaner;
|
|
||||||
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
@ -34,7 +30,7 @@ import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
@Mixin(LivingEntity.class)
|
@Mixin(LivingEntity.class)
|
||||||
abstract class MixinLivingEntity extends Entity implements PonyContainer<Equine<?>>, ItemWielder, Jumper, Leaner {
|
abstract class MixinLivingEntity extends Entity implements PonyContainer<Equine<?>>, LivingEntityDuck {
|
||||||
@Shadow
|
@Shadow
|
||||||
protected ItemStack activeItemStack;
|
protected ItemStack activeItemStack;
|
||||||
@Shadow
|
@Shadow
|
||||||
|
|
|
@ -6,11 +6,9 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
import com.minelittlepony.unicopia.entity.Creature;
|
|
||||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
import com.minelittlepony.unicopia.entity.*;
|
||||||
import com.minelittlepony.unicopia.entity.RotatedView;
|
import com.minelittlepony.unicopia.entity.duck.RotatedView;
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
|
||||||
import com.minelittlepony.unicopia.entity.Living;
|
|
||||||
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
import com.minelittlepony.unicopia.entity.PonyContainer;
|
||||||
import com.minelittlepony.unicopia.entity.CapeHolder;
|
import com.minelittlepony.unicopia.entity.duck.PlayerEntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.Equine;
|
import com.minelittlepony.unicopia.entity.Equine;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import com.mojang.datafixers.util.Either;
|
import com.mojang.datafixers.util.Either;
|
||||||
|
@ -28,7 +28,7 @@ import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
@Mixin(PlayerEntity.class)
|
@Mixin(PlayerEntity.class)
|
||||||
abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<Pony>, CapeHolder {
|
abstract class MixinPlayerEntity extends LivingEntity implements PonyContainer<Pony>, PlayerEntityDuck {
|
||||||
private MixinPlayerEntity() { super(null, null); }
|
private MixinPlayerEntity() { super(null, null); }
|
||||||
@Override
|
@Override
|
||||||
@Invoker("updateCapeAngles")
|
@Invoker("updateCapeAngles")
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.MotionChecker;
|
import com.minelittlepony.unicopia.entity.duck.ServerPlayerEntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.network.NetworkThreadUtils;
|
import net.minecraft.network.NetworkThreadUtils;
|
||||||
|
@ -45,7 +45,7 @@ abstract class MixinServerPlayNetworkHandler implements EntityTrackingListener,
|
||||||
private void setPreventMotionChecks(boolean motionChecks) {
|
private void setPreventMotionChecks(boolean motionChecks) {
|
||||||
ServerPlayerEntity player = ((ServerPlayNetworkHandler)(Object)this).player;
|
ServerPlayerEntity player = ((ServerPlayNetworkHandler)(Object)this).player;
|
||||||
prevMotionChecks = player.isInTeleportationState();
|
prevMotionChecks = player.isInTeleportationState();
|
||||||
((MotionChecker)player).setPreventMotionChecks(motionChecks);
|
((ServerPlayerEntityDuck)player).setPreventMotionChecks(motionChecks);
|
||||||
player.fallDistance = 0;
|
player.fallDistance = 0;
|
||||||
floating = false;
|
floating = false;
|
||||||
floatingTicks = 0;
|
floatingTicks = 0;
|
||||||
|
|
|
@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.PonyContainer;
|
import com.minelittlepony.unicopia.entity.PonyContainer;
|
||||||
import com.minelittlepony.unicopia.entity.MotionChecker;
|
import com.minelittlepony.unicopia.entity.duck.ServerPlayerEntityDuck;
|
||||||
import com.minelittlepony.unicopia.entity.player.Pony;
|
import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
|
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -15,7 +15,7 @@ import net.minecraft.screen.ScreenHandlerListener;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
import net.minecraft.server.network.ServerPlayerEntity;
|
||||||
|
|
||||||
@Mixin(ServerPlayerEntity.class)
|
@Mixin(ServerPlayerEntity.class)
|
||||||
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer<Pony>, MotionChecker {
|
abstract class MixinServerPlayerEntity extends PlayerEntity implements ScreenHandlerListener, PonyContainer<Pony>, ServerPlayerEntityDuck {
|
||||||
MixinServerPlayerEntity() {super(null, null, 0, null, null);}
|
MixinServerPlayerEntity() {super(null, null, 0, null, null);}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,8 +13,8 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.BlockDestructionManager;
|
import com.minelittlepony.unicopia.BlockDestructionManager;
|
||||||
import com.minelittlepony.unicopia.entity.RotatedView;
|
|
||||||
import com.minelittlepony.unicopia.entity.behaviour.EntityAppearance;
|
import com.minelittlepony.unicopia.entity.behaviour.EntityAppearance;
|
||||||
|
import com.minelittlepony.unicopia.entity.duck.RotatedView;
|
||||||
|
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.entity.RotatedView;
|
import com.minelittlepony.unicopia.entity.duck.RotatedView;
|
||||||
|
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.world.chunk.WorldChunk;
|
import net.minecraft.world.chunk.WorldChunk;
|
||||||
|
|
Loading…
Reference in a new issue