39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
	
		
			1 KiB
		
	
	
	
		
			Java
		
	
	
	
	
	
| package net.minecraft.server.packs.repository;
 | |
| 
 | |
| import net.minecraft.ChatFormatting;
 | |
| import net.minecraft.network.chat.Component;
 | |
| import net.minecraft.util.InclusiveRange;
 | |
| 
 | |
| public enum PackCompatibility {
 | |
| 	TOO_OLD("old"),
 | |
| 	TOO_NEW("new"),
 | |
| 	COMPATIBLE("compatible");
 | |
| 
 | |
| 	private final Component description;
 | |
| 	private final Component confirmation;
 | |
| 
 | |
| 	private PackCompatibility(final String type) {
 | |
| 		this.description = Component.translatable("pack.incompatible." + type).withStyle(ChatFormatting.GRAY);
 | |
| 		this.confirmation = Component.translatable("pack.incompatible.confirm." + type);
 | |
| 	}
 | |
| 
 | |
| 	public boolean isCompatible() {
 | |
| 		return this == COMPATIBLE;
 | |
| 	}
 | |
| 
 | |
| 	public static PackCompatibility forVersion(InclusiveRange<Integer> range, int version) {
 | |
| 		if ((Integer)range.maxInclusive() < version) {
 | |
| 			return TOO_OLD;
 | |
| 		} else {
 | |
| 			return version < range.minInclusive() ? TOO_NEW : COMPATIBLE;
 | |
| 		}
 | |
| 	}
 | |
| 
 | |
| 	public Component getDescription() {
 | |
| 		return this.description;
 | |
| 	}
 | |
| 
 | |
| 	public Component getConfirmation() {
 | |
| 		return this.confirmation;
 | |
| 	}
 | |
| }
 |