Skip to content

Commit

Permalink
move flib integration registry stuff to prefreeze
Browse files Browse the repository at this point in the history
  • Loading branch information
AViewFromTheTop committed Dec 11, 2023
1 parent 36630f9 commit f463615
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ public FrozenLibIntegration() {
}

@Override
public void init() {
WilderSharedConstants.log("FrozenLib mod integration ran!", WilderSharedConstants.UNSTABLE_LOGGING);
public void initPreFreeze() {
WilderSharedConstants.log("FrozenLib pre-freeze mod integration ran!", WilderSharedConstants.UNSTABLE_LOGGING);
SpottingIconPredicate.register(WilderSharedConstants.id("stella"), entity -> entity.hasCustomName() && entity.getCustomName().getString().equalsIgnoreCase("stella"));
SoundPredicate.register(WilderSharedConstants.id("instrument"), new SoundPredicate.LoopPredicate<LivingEntity>() {

Expand All @@ -113,7 +113,7 @@ public Boolean firstTickTest(LivingEntity entity) {
}

@Override
public boolean test(LivingEntity entity) {
public boolean test(LivingEntity entity) {
if (firstCheck) {
firstCheck = false;
InteractionHand hand = !entity.getItemInHand(InteractionHand.MAIN_HAND).isEmpty() ? InteractionHand.MAIN_HAND : !entity.getItemInHand(InteractionHand.OFF_HAND).isEmpty() ? InteractionHand.OFF_HAND : null;
Expand All @@ -124,16 +124,21 @@ public boolean test(LivingEntity entity) {
}
return entity.getUseItem().getItem() instanceof InstrumentItem;
}
});
});
SoundPredicate.register(WilderSharedConstants.id("nectar"), (SoundPredicate.LoopPredicate<Firefly>) entity ->
!entity.isSilent() && entity.hasCustomName() && Objects.requireNonNull(entity.getCustomName()).getString().toLowerCase().contains("nectar")
!entity.isSilent() && entity.hasCustomName() && Objects.requireNonNull(entity.getCustomName()).getString().toLowerCase().contains("nectar")
);
SoundPredicate.register(WilderSharedConstants.id("enderman_anger"), (SoundPredicate.LoopPredicate<EnderMan>) entity -> {
if (entity.isSilent() || entity.isRemoved() || entity.isDeadOrDying()) {
return false;
}
return entity.isCreepy() || entity.hasBeenStaredAt();
});
}

@Override
public void init() {
WilderSharedConstants.log("FrozenLib mod integration ran!", WilderSharedConstants.UNSTABLE_LOGGING);

ServerWorldEvents.LOAD.register((server, level) -> PlayerDamageSourceSounds.addDamageSound(level.damageSources().cactus(), RegisterSounds.PLAYER_HURT_CACTUS, WilderSharedConstants.id("cactus")));

Expand Down

0 comments on commit f463615

Please sign in to comment.