mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-03-03 16:51:28 +01:00
More cleanup! Haza!
This commit is contained in:
parent
7b58fdb6ba
commit
0ffa55a20c
8 changed files with 28 additions and 33 deletions
|
@ -19,7 +19,7 @@ public class BlazeBehaviour extends EntityBehaviour<BlazeEntity> {
|
||||||
|
|
||||||
Entity src = source.getEntity();
|
Entity src = source.getEntity();
|
||||||
|
|
||||||
if (src.isOnGround() || src instanceof PlayerEntity && ((PlayerEntity)src).getAbilities().flying) {
|
if (src.isOnGround() || src instanceof PlayerEntity player && player.getAbilities().flying) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ public class BlazeBehaviour extends EntityBehaviour<BlazeEntity> {
|
||||||
|
|
||||||
if (fireballsFired > 0) {
|
if (fireballsFired > 0) {
|
||||||
if (!entity.isSilent()) {
|
if (!entity.isSilent()) {
|
||||||
entity.world.syncWorldEvent((PlayerEntity)null, WorldEvents.BLAZE_SHOOTS, entity.getBlockPos(), 0);
|
entity.world.syncWorldEvent(null, WorldEvents.BLAZE_SHOOTS, entity.getBlockPos(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d rot = player.getEntity().getRotationVec(1);
|
Vec3d rot = player.getEntity().getRotationVec(1);
|
||||||
|
|
|
@ -23,10 +23,7 @@ public class ChickenBehaviour extends EntityBehaviour<ChickenEntity> {
|
||||||
public void update(Caster<?> source, ChickenEntity entity, Disguise spell) {
|
public void update(Caster<?> source, ChickenEntity entity, Disguise spell) {
|
||||||
entity.eggLayTime = Integer.MAX_VALUE;
|
entity.eggLayTime = Integer.MAX_VALUE;
|
||||||
|
|
||||||
if (source instanceof Pony) {
|
if (source instanceof Pony player) {
|
||||||
Pony player = (Pony)source;
|
|
||||||
|
|
||||||
|
|
||||||
if (player.sneakingChanged()) {
|
if (player.sneakingChanged()) {
|
||||||
ItemStack egg = entity.getEquippedStack(EquipmentSlot.OFFHAND);
|
ItemStack egg = entity.getEquippedStack(EquipmentSlot.OFFHAND);
|
||||||
|
|
||||||
|
@ -53,7 +50,7 @@ public class ChickenBehaviour extends EntityBehaviour<ChickenEntity> {
|
||||||
|
|
||||||
Entity src = source.getEntity();
|
Entity src = source.getEntity();
|
||||||
|
|
||||||
if (src.isOnGround() || src instanceof PlayerEntity && ((PlayerEntity)src).getAbilities().flying) {
|
if (src.isOnGround() || src instanceof PlayerEntity player && player.getAbilities().flying) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,8 +17,8 @@ public class EndermanBehaviour extends EntityBehaviour<EndermanEntity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack stack = source.getMaster().getStackInHand(Hand.MAIN_HAND);
|
ItemStack stack = source.getMaster().getStackInHand(Hand.MAIN_HAND);
|
||||||
if (stack.getItem() instanceof BlockItem) {
|
if (stack.getItem() instanceof BlockItem bi) {
|
||||||
entity.setCarriedBlock(((BlockItem)stack.getItem()).getBlock().getDefaultState());
|
entity.setCarriedBlock(bi.getBlock().getDefaultState());
|
||||||
} else {
|
} else {
|
||||||
entity.setCarriedBlock(null);
|
entity.setCarriedBlock(null);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,8 +46,8 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
||||||
entity.handleFallDamage(distance, damageMultiplier, cause);
|
entity.handleFallDamage(distance, damageMultiplier, cause);
|
||||||
|
|
||||||
BlockState state = entity.getBlockState();
|
BlockState state = entity.getBlockState();
|
||||||
if (state.getBlock() instanceof FallingBlock) {
|
if (state.getBlock() instanceof FallingBlock fb) {
|
||||||
((FallingBlock)state.getBlock()).onLanding(entity.world, entity.getBlockPos(), state, state, entity);
|
fb.onLanding(entity.world, entity.getBlockPos(), state, state, entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,8 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
||||||
return configure(MixinFallingBlockEntity.createInstance(entity.world, entity.getX(), entity.getY() + 1, entity.getZ(), lowerState), block);
|
return configure(MixinFallingBlockEntity.createInstance(entity.world, entity.getX(), entity.getY() + 1, entity.getZ(), lowerState), block);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (block instanceof BlockEntityProvider) {
|
if (block instanceof BlockEntityProvider bep) {
|
||||||
context.addBlockEntity(((BlockEntityProvider)block).createBlockEntity(entity.getBlockPos(), state));
|
context.addBlockEntity(bep.createBlockEntity(entity.getBlockPos(), state));
|
||||||
}
|
}
|
||||||
|
|
||||||
return configure(entity, block);
|
return configure(entity, block);
|
||||||
|
@ -106,10 +106,7 @@ public class FallingBlockBehaviour extends EntityBehaviour<FallingBlockEntity> {
|
||||||
|
|
||||||
BlockEntity be = disguise.getBlockEntity();
|
BlockEntity be = disguise.getBlockEntity();
|
||||||
|
|
||||||
if (source instanceof Pony && be instanceof Tickable && (be instanceof ChestBlockEntity || be instanceof EnderChestBlockEntity)) {
|
if (source instanceof Pony player && be instanceof Tickable ceb && (be instanceof ChestBlockEntity || be instanceof EnderChestBlockEntity)) {
|
||||||
Pony player = (Pony)source;
|
|
||||||
Tickable ceb = (Tickable)disguise.getBlockEntity();
|
|
||||||
|
|
||||||
if (player.sneakingChanged()) {
|
if (player.sneakingChanged()) {
|
||||||
be.onSyncedBlockEvent(1, isSneakingOnGround(source) ? 1 : 0);
|
be.onSyncedBlockEvent(1, isSneakingOnGround(source) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.minelittlepony.unicopia.entity.player.Pony;
|
||||||
import net.minecraft.entity.mob.GhastEntity;
|
import net.minecraft.entity.mob.GhastEntity;
|
||||||
import net.minecraft.entity.projectile.FireballEntity;
|
import net.minecraft.entity.projectile.FireballEntity;
|
||||||
import net.minecraft.util.math.Vec3d;
|
import net.minecraft.util.math.Vec3d;
|
||||||
|
import net.minecraft.world.WorldEvents;
|
||||||
|
|
||||||
public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
||||||
|
|
||||||
|
@ -18,11 +19,11 @@ public class GhastBehaviour extends MobBehaviour<GhastEntity> {
|
||||||
|
|
||||||
if (sneaking) {
|
if (sneaking) {
|
||||||
if (!entity.isSilent()) {
|
if (!entity.isSilent()) {
|
||||||
entity.world.syncWorldEvent(null, 1015, entity.getBlockPos(), 0);
|
entity.world.syncWorldEvent(null, WorldEvents.GHAST_WARNS, entity.getBlockPos(), 0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!entity.isSilent()) {
|
if (!entity.isSilent()) {
|
||||||
entity.world.syncWorldEvent(null, 1016, entity.getBlockPos(), 0);
|
entity.world.syncWorldEvent(null, WorldEvents.GHAST_SHOOTS, entity.getBlockPos(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d rot = player.getEntity().getRotationVec(1);
|
Vec3d rot = player.getEntity().getRotationVec(1);
|
||||||
|
|
|
@ -12,14 +12,16 @@ public class HoppingBehaviour extends EntityBehaviour<LivingEntity> {
|
||||||
if (player.getEntity().isOnGround()) {
|
if (player.getEntity().isOnGround()) {
|
||||||
if (player.getEntity().getVelocity().horizontalLengthSquared() > 0.01) {
|
if (player.getEntity().getVelocity().horizontalLengthSquared() > 0.01) {
|
||||||
player.getMaster().jump();
|
player.getMaster().jump();
|
||||||
if (entity instanceof RabbitEntity) {
|
startJump(entity);
|
||||||
((RabbitEntity)entity).startJump();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else if (player.landedChanged()) {
|
} else if (player.landedChanged()) {
|
||||||
if (entity instanceof RabbitEntity) {
|
startJump(entity);
|
||||||
((RabbitEntity)entity).startJump();
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startJump(LivingEntity entity) {
|
||||||
|
if (entity instanceof RabbitEntity rabbit) {
|
||||||
|
rabbit.startJump();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,11 +25,9 @@ public class MinecartBehaviour extends EntityBehaviour<AbstractMinecartEntity> {
|
||||||
entity.setPitch(0);
|
entity.setPitch(0);
|
||||||
entity.prevPitch = 0;
|
entity.prevPitch = 0;
|
||||||
|
|
||||||
if (source.getEntity() instanceof LivingEntity) {
|
if (source.getEntity() instanceof LivingEntity living) {
|
||||||
int hurt = ((LivingEntity)source.getEntity()).hurtTime;
|
if (living.hurtTime > 0) {
|
||||||
|
entity.setDamageWobbleTicks(living.hurtTime);
|
||||||
if (hurt > 0) {
|
|
||||||
entity.setDamageWobbleTicks(hurt);
|
|
||||||
entity.setDamageWobbleStrength(1);
|
entity.setDamageWobbleStrength(1);
|
||||||
entity.setDamageWobbleSide(20 + (int)source.getEntity().fallDistance / 10);
|
entity.setDamageWobbleSide(20 + (int)source.getEntity().fallDistance / 10);
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,17 +297,17 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
|
|
||||||
if (isFlying() && !entity.isFallFlying()) {
|
if (isFlying() && !entity.isFallFlying()) {
|
||||||
|
|
||||||
float pitch = ((Leaner)entity).getLeaningPitch();
|
float pitch = ((LivingEntityDuck)entity).getLeaningPitch();
|
||||||
if (pitch < 1) {
|
if (pitch < 1) {
|
||||||
if (pitch < 0.9F) {
|
if (pitch < 0.9F) {
|
||||||
pitch += 0.1F;
|
pitch += 0.1F;
|
||||||
}
|
}
|
||||||
pitch += 0.09F;
|
pitch += 0.09F;
|
||||||
((Leaner)entity).setLeaningPitch(Math.max(0, pitch));
|
((LivingEntityDuck)entity).setLeaningPitch(Math.max(0, pitch));
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.limbAngle = 20 + (float)Math.cos(entity.age / 7F) - 0.5F;
|
entity.limbAngle = 20 + (float)Math.cos(entity.age / 7F) - 0.5F;
|
||||||
entity.limbDistance = this.thrustScale;
|
entity.limbDistance = thrustScale;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue