Skip to content

Added poi logger to RaidLogger #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,19 @@ public void onCenterMoved(Raid raid, BlockPos pos)
});
}

public void onPOIDetected(Raid raid, BlockPos pos, double distance)
{
if (!TISAdditionLoggerRegistry.__raid)
{
return;
}
this.log(() -> {
return new BaseText[]{Messenger.c(
tr("poi_detected", raid.getRaidId(), Messenger.coord(pos, DimensionWrapper.of(raid.getWorld())), distance)
)};
});
}

public enum InvalidateReason
{
DIFFICULTY_PEACEFUL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Slice;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

//#if MC >= 12005
//$$ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
Expand Down Expand Up @@ -260,4 +261,12 @@ private void raidLogger_onCenterMoved(BlockPos blockPos, CallbackInfo ci)
{
RaidLogger.getInstance().onCenterMoved((Raid)(Object)this, blockPos);
}

@Inject(
method = "method_20510", at = @At(value = "RETURN")
)
private void onPOIDetected(BlockPos blockPos, CallbackInfoReturnable<Double> cir)
{
RaidLogger.getInstance().onPOIDetected((Raid)(Object)this, blockPos, cir.getReturnValueD());
}
}
1 change: 1 addition & 0 deletions src/main/resources/assets/carpettisaddition/lang/en_us.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ carpettisaddition:
invalidated: 'Raid (id: %1$s) invalidated, reason: %2$s'
bad_omen_level_increased: 'Raid (id: %1$s) increased its bad omen level to %2$s'
center_moved: 'Raid (id: %1$s) moves its center to %2$s'
poi_detected: 'Raid (id: %1$s) detected POI at %2$s which is %3$s block(s) away from its center'
raid_invalidate_reason:
difficulty_peaceful: difficulty peaceful
gamerule_disable: gamerule disable
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/carpettisaddition/lang/zh_cn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ carpettisaddition:
invalidated: '袭击(id: %1$s)结束,原因为: %2$s'
bad_omen_level_increased: '袭击(id: %1$s)不祥之兆等级提升为%2$s'
center_moved: '袭击(id: %1$s)的中心点移动至%2$s'
poi_detected: '袭击(id: %1$s)在%2$s处检测到POI,距离其中心点%3$s个方块'
raid_invalidate_reason:
difficulty_peaceful: 难度被设为和平
gamerule_disable: 被游戏规则禁用
Expand Down