|
| 1 | +package com.denizenscript.clientizen.tags; |
| 2 | + |
| 3 | +import com.denizenscript.denizencore.DenizenCore; |
| 4 | +import com.denizenscript.denizencore.objects.ObjectTag; |
| 5 | +import com.denizenscript.denizencore.objects.core.ElementTag; |
| 6 | +import com.denizenscript.denizencore.objects.core.ListTag; |
| 7 | +import com.denizenscript.denizencore.objects.core.MapTag; |
| 8 | +import com.denizenscript.denizencore.objects.core.TimeTag; |
| 9 | +import com.denizenscript.denizencore.tags.PseudoObjectTagBase; |
| 10 | +import com.denizenscript.denizencore.tags.TagManager; |
| 11 | + |
| 12 | +public class ClientTagBase extends PseudoObjectTagBase<ClientTagBase> { |
| 13 | + |
| 14 | + public static ClientTagBase instance; |
| 15 | + |
| 16 | + public ClientTagBase() { |
| 17 | + instance = this; |
| 18 | + TagManager.registerStaticTagBaseHandler(ClientTagBase.class, "client", t -> instance); |
| 19 | + } |
| 20 | + |
| 21 | + @Override |
| 22 | + public void register() { |
| 23 | +// tagProcessor.registerTag(ListTag.class, "loaded_entities", (attribute, object) -> { |
| 24 | +// ListTag list = new ListTag(); |
| 25 | +// for (Entity entity : MinecraftClient.getInstance().world.getEntities()) { |
| 26 | +// list.addObject(new EntityTag(entity)); |
| 27 | +// } |
| 28 | +// return list; |
| 29 | +// }); |
| 30 | +// tagProcessor.registerTag(EntityTag.class, "target", (attribute, object) -> { |
| 31 | +// Entity target = MinecraftClient.getInstance().targetedEntity; |
| 32 | +// return target != null ? new EntityTag(target) : null; |
| 33 | +// }); |
| 34 | +// tagProcessor.registerTag(EntityTag.class, "self_entity", (attribute, object) -> { |
| 35 | +// return new EntityTag(MinecraftClient.getInstance().player); |
| 36 | +// }); |
| 37 | + tagProcessor.registerTag(ElementTag.class, ElementTag.class, "has_flag", (attribute, object, param) -> { |
| 38 | + return new ElementTag(DenizenCore.serverFlagMap.hasFlag(param.asString())); |
| 39 | + }); |
| 40 | + tagProcessor.registerTag(ObjectTag.class, ElementTag.class, "flag", (attribute, object, param) -> { |
| 41 | + return DenizenCore.serverFlagMap.doFlagTag(attribute); |
| 42 | + }); |
| 43 | + tagProcessor.registerTag(TimeTag.class, ElementTag.class, "flag_expiration", (attribute, object, param) -> { |
| 44 | + return DenizenCore.serverFlagMap.doFlagExpirationTag(attribute); |
| 45 | + }); |
| 46 | + tagProcessor.registerTag(ListTag.class, "list_flags", (attribute, object) -> { |
| 47 | + return DenizenCore.serverFlagMap.doListFlagsTag(attribute); |
| 48 | + }); |
| 49 | + tagProcessor.registerTag(MapTag.class, "flag_map", (attribute, object) -> { |
| 50 | + return DenizenCore.serverFlagMap.doFlagMapTag(attribute); |
| 51 | + }); |
| 52 | + } |
| 53 | +} |
0 commit comments