Merge branch 'dev' of fantabos.co:ftbsc/bscv into dev
This commit is contained in:
commit
7640b4f6b8
2 changed files with 35 additions and 1 deletions
|
@ -77,9 +77,13 @@ public class Boscovicino implements ICommons {
|
|||
}
|
||||
|
||||
public static void log(String message) {
|
||||
log(message, true);
|
||||
}
|
||||
|
||||
public static void log(String message, boolean overlay) {
|
||||
LOGGER.info(message);
|
||||
if (MC.player != null) {
|
||||
MC.player.displayClientMessage(new StringTextComponent(message), true);
|
||||
MC.player.displayClientMessage(new StringTextComponent(message), overlay);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,17 +3,37 @@ package ftbsc.bscv.modules.hud;
|
|||
import com.google.auto.service.AutoService;
|
||||
import ftbsc.bscv.api.ILoadable;
|
||||
import ftbsc.bscv.modules.HudModule;
|
||||
import ftbsc.bscv.tools.Setting;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
|
||||
import static ftbsc.bscv.tools.Text.TextBuilder;
|
||||
import static ftbsc.bscv.Boscovicino.log;
|
||||
|
||||
@AutoService(ILoadable.class)
|
||||
public class PlayerList extends HudModule {
|
||||
|
||||
public final ForgeConfigSpec.ConfigValue<Boolean> notify;
|
||||
|
||||
public PlayerList() {
|
||||
super();
|
||||
|
||||
this.notify = Setting.Bool.builder()
|
||||
.fallback(false)
|
||||
.name("notify")
|
||||
.comment("notify when players enter render distance")
|
||||
.build(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void onRenderOverlay(RenderGameOverlayEvent event) {
|
||||
if (event.getType() != ElementType.TEXT) return;
|
||||
|
@ -34,4 +54,14 @@ public class PlayerList extends HudModule {
|
|||
offset += MC.font.lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityEntersRenderdistance(EntityJoinWorldEvent event) {
|
||||
if (!notify.get()) return;
|
||||
if (event.getEntity() instanceof PlayerEntity){
|
||||
PlayerEntity player = (PlayerEntity) event.getEntity();
|
||||
if (MC.player != null && player.getId() == MC.player.getId()) return;
|
||||
log(String.format("%s spotted", player.getDisplayName().getString()), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue