/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.MapCodec */ package net.minecraft.server.dialog.action; import com.mojang.serialization.MapCodec; import java.util.Collections; import java.util.EnumMap; import java.util.Map; import java.util.Optional; import net.minecraft.network.chat.ClickEvent; import net.minecraft.server.dialog.action.Action; import net.minecraft.util.Util; public record StaticAction(ClickEvent value) implements Action { public static final Map> WRAPPED_CODECS = Util.make(() -> { EnumMap result = new EnumMap(ClickEvent.Action.class); for (ClickEvent.Action action : (ClickEvent.Action[])ClickEvent.Action.class.getEnumConstants()) { if (!action.isAllowedFromServer()) continue; MapCodec mapCodec = action.valueCodec(); result.put(action, mapCodec.xmap(StaticAction::new, StaticAction::value)); } return Collections.unmodifiableMap(result); }); public MapCodec codec() { return WRAPPED_CODECS.get(this.value.action()); } @Override public Optional createAction(Map parameters) { return Optional.of(this.value); } }