34 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.server.dialog;
 | |
| 
 | |
| import io.netty.buffer.ByteBuf;
 | |
| import java.util.function.IntFunction;
 | |
| import net.minecraft.network.codec.ByteBufCodecs;
 | |
| import net.minecraft.network.codec.StreamCodec;
 | |
| import net.minecraft.util.ByIdMap;
 | |
| import net.minecraft.util.StringRepresentable;
 | |
| 
 | |
| public enum DialogAction implements StringRepresentable {
 | |
| 	CLOSE(0, "close"),
 | |
| 	NONE(1, "none"),
 | |
| 	WAIT_FOR_RESPONSE(2, "wait_for_response");
 | |
| 
 | |
| 	public static final IntFunction<DialogAction> BY_ID = ByIdMap.continuous(dialogAction -> dialogAction.id, values(), ByIdMap.OutOfBoundsStrategy.ZERO);
 | |
| 	public static final StringRepresentable.EnumCodec<DialogAction> CODEC = StringRepresentable.fromEnum(DialogAction::values);
 | |
| 	public static final StreamCodec<ByteBuf, DialogAction> STREAM_CODEC = ByteBufCodecs.idMapper(BY_ID, dialogAction -> dialogAction.id);
 | |
| 	private final int id;
 | |
| 	private final String name;
 | |
| 
 | |
| 	private DialogAction(final int id, final String name) {
 | |
| 		this.id = id;
 | |
| 		this.name = name;
 | |
| 	}
 | |
| 
 | |
| 	@Override
 | |
| 	public String getSerializedName() {
 | |
| 		return this.name;
 | |
| 	}
 | |
| 
 | |
| 	public boolean willUnpause() {
 | |
| 		return this == CLOSE || this == WAIT_FOR_RESPONSE;
 | |
| 	}
 | |
| }
 |