Skip to content

Commit

Permalink
use EntityStatus constants
Browse files Browse the repository at this point in the history
  • Loading branch information
DaFuqs committed Jan 2, 2025
1 parent 044bf5b commit ae064b0
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public boolean trigger(ServerWorld world, BlockPos blockPos, BlockState state, @
InWorldInteractionHelper.decrementAndSpawnRemainder(itemEntity, 1);

animalEntity.setLoveTicks(LOVE_TICKS);
world.sendEntityStatus(animalEntity, (byte) 18);
world.sendEntityStatus(animalEntity, EntityStatuses.ADD_BREEDING_PARTICLES);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static boolean teleportTo(ServerWorld world, Entity entity, BlockPos bloc
double boundingBoxY = entity.getBoundingBox().getYLength(); // bouncy
if (entity instanceof ServerPlayerEntity serverPlayerEntity) {
serverPlayerEntity.teleport((ServerWorld) serverPlayerEntity.getWorld(), mutable.getX() + 0.5, mutable.getY() + boundingBoxY, mutable.getZ() + 0.5, serverPlayerEntity.getYaw(), serverPlayerEntity.getPitch());
world.sendEntityStatus(serverPlayerEntity, (byte) 46); // particles
world.sendEntityStatus(serverPlayerEntity, EntityStatuses.ADD_BREEDING_PARTICLES);
return true;
} else if (entity instanceof LivingEntity livingEntity) {
boolean success = livingEntity.teleport(mutable.getX() + 0.5, mutable.getY() + boundingBoxY, mutable.getZ() + 0.5, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ protected void onCollision(HitResult hitResult) {
super.onCollision(hitResult);
World world = this.getWorld();
if (!world.isClient()) {
world.sendEntityStatus(this, (byte) 3);
world.sendEntityStatus(this, EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES);

if (hitResult.getType() == HitResult.Type.BLOCK) {
BlockPos landingPos = getCorrectedBlockPos(hitResult.getPos());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void onCollision(HitResult hitResult) {
}
}

this.getWorld().sendEntityStatus(this, (byte) 3);
this.getWorld().sendEntityStatus(this, EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES);

if (!stack.isEmpty()) {
Entity owner = this.getOwner();
Expand All @@ -57,7 +57,7 @@ protected void onCollision(HitResult hitResult) {

@Override
public void handleStatus(byte status) {
if (status == 3) {
if (status == EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES) {
ItemStack itemStack = this.getItem();
ParticleEffect particleEffect = (itemStack.isEmpty() ? ParticleTypes.ITEM_SNOWBALL : new ItemStackParticleEffect(ParticleTypes.ITEM, itemStack));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected void onEntityHit(EntityHitResult entityHitResult) {
PlayerEntity playerOwner = owner instanceof PlayerEntity player ? player : null;
ModularExplosionDefinition.explode((ServerWorld) world, entityHitResult.getEntity().getBlockPos(), playerOwner, getStack());
}
world.sendEntityStatus(this, (byte) 1);
world.sendEntityStatus(this, EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES);

remove(Entity.RemovalReason.DISCARDED);
}
Expand All @@ -48,7 +48,7 @@ protected void onBlockHit(BlockHitResult blockHitResult) {
PlayerEntity playerOwner = owner instanceof PlayerEntity player ? player : null;
ModularExplosionDefinition.explode((ServerWorld) world, blockHitResult.getBlockPos(), blockHitResult.getSide().getOpposite(), playerOwner, getStack());
}
world.sendEntityStatus(this, (byte) 2);
world.sendEntityStatus(this, EntityStatuses.PLAY_DEATH_SOUND_OR_ADD_PROJECTILE_HIT_PARTICLES);

remove(Entity.RemovalReason.DISCARDED);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ public int use(ItemStack usedItem) {
if (this.hookedEntity != null) {
this.pullHookedEntity(this.hookedEntity);
SpectrumAdvancementCriteria.FISHING_ROD_HOOKED.trigger((ServerPlayerEntity) playerEntity, usedItem, this, null, Collections.emptyList());
this.getWorld().sendEntityStatus(this, (byte) 31);
this.getWorld().sendEntityStatus(this, EntityStatuses.PULL_HOOKED_ENTITY);
i = this.hookedEntity instanceof ItemEntity ? 3 : 5;
} else if (this.hookCountdown > 0) {
if (!tryCatchEntity(usedItem, playerEntity, (ServerWorld) this.getWorld(), this.getBlockPos())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public static void register() {
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 900, 1));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 100, 1));
entity.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 800, 0));
entity.getWorld().sendEntityStatus(entity, (byte) 35);
entity.getWorld().sendEntityStatus(entity, EntityStatuses.USE_TOTEM_OF_UNDYING);

return false;
}
Expand Down

0 comments on commit ae064b0

Please sign in to comment.