forked from anegostudios/vssurvivalmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debug.cs
52 lines (43 loc) · 1.46 KB
/
Debug.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using Newtonsoft.Json;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Vintagestory.API.Client;
using Vintagestory.API.Common;
using Vintagestory.API.MathTools;
using Vintagestory.API.Server;
using Vintagestory.GameContent;
namespace Vintagestory.ServerMods
{
public class DebugSystem : ModSystem
{
ICoreAPI api;
ICoreClientAPI capi;
public override bool ShouldLoad(EnumAppSide forSide)
{
return true;
}
public override void StartServerSide(ICoreServerAPI api)
{
this.api = api;
//api.RegisterCommand("anvildebug", "Anvil debug info", "", onAnvilDebug, "worldedit");
}
private void onAnvilDebug(IServerPlayer player, int groupId, CmdArgs args)
{
if (player.CurrentBlockSelection?.Position != null)
{
BlockEntityAnvil bea = api.World.BlockAccessor.GetBlockEntity(player.CurrentBlockSelection.Position) as BlockEntityAnvil;
if (bea == null)
{
player.SendMessage(groupId, "Not looking at an anvil", EnumChatType.CommandError);
return;
}
player.SendMessage(groupId, bea.PrintDebugText(), EnumChatType.CommandSuccess);
}
}
}
}