mirror of
https://github.com/CivMC/Civ.git
synced 2026-07-18 00:20:44 +00:00
Update MapColours class
This commit is contained in:
@@ -11,7 +11,9 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import vg.civcraft.mc.civmodcore.utilities.CivLogger;
|
||||
|
||||
/**
|
||||
* <a href="https://minecraft.fandom.com/wiki/Map_item_format#Base_colors">Reference</a>
|
||||
* This is a mapped version of NMS class {@link MaterialMapColor} to make setting pixel colours easier.
|
||||
*
|
||||
* <a href="https://minecraft.fandom.com/wiki/Map_item_format#Base_colors">Read more.</a>
|
||||
*/
|
||||
public enum MapColours {
|
||||
|
||||
@@ -74,6 +76,7 @@ public enum MapColours {
|
||||
WARPED_STEM(MaterialMapColor.af),
|
||||
WARPED_HYPHAE(MaterialMapColor.ag),
|
||||
WARPED_WART_BLOCK(MaterialMapColor.ah);
|
||||
// TODO: Add the new map colours after they're added to the fandom wiki
|
||||
|
||||
private final MaterialMapColor nms;
|
||||
|
||||
@@ -86,17 +89,18 @@ public enum MapColours {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
final Set<MaterialMapColor> coreMapColours = Set.of(Stream.of(values())
|
||||
final Set<MaterialMapColor> cmcMapColours = Stream.of(values())
|
||||
.map(MapColours::asNMS)
|
||||
.toArray(MaterialMapColor[]::new));
|
||||
final Set<MaterialMapColor> baseMapColours = Set.of(Stream.of(MaterialMapColor.a)
|
||||
.collect(Collectors.toSet());
|
||||
final Set<MaterialMapColor> nmsMapColours = Stream.of(MaterialMapColor.a)
|
||||
.filter(Objects::nonNull)
|
||||
.toArray(MaterialMapColor[]::new));
|
||||
final Collection<MaterialMapColor> missing = CollectionUtils.disjunction(coreMapColours, baseMapColours);
|
||||
if (!missing.isEmpty()) {
|
||||
.collect(Collectors.toSet());
|
||||
final Collection<MaterialMapColor> missingColours = CollectionUtils.disjunction(cmcMapColours, nmsMapColours);
|
||||
if (!missingColours.isEmpty()) {
|
||||
final CivLogger logger = CivLogger.getLogger(MapColours.class);
|
||||
logger.warning("The following map colours are missing: " + missing.stream()
|
||||
.map(e -> Integer.toString(e.am))
|
||||
logger.warning("The following map colours are missing: " + missingColours.stream()
|
||||
/** {@link MaterialMapColor#MaterialMapColor(int, int)} "id" parameter */
|
||||
.map(colour -> Integer.toString(colour.am))
|
||||
.collect(Collectors.joining(",")));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user