mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-07-06 20:12:52 +00:00

- Update EMI and REI integration, and fix some issues with the upgrade crafting hooks. - Just use smooth stone for recipes, not #c:stone. We're mirroring redstone's crafting recipes here. - Some cleanup to printouts. - Remote upgrade data generators - these can be replaced with the standard registry data generators. - Remove the API's PlatformHelper - we no longer have any platform-specific code in the API.
32 lines
917 B
Java
32 lines
917 B
Java
// SPDX-FileCopyrightText: 2020 The CC: Tweaked Developers
|
|
//
|
|
// SPDX-License-Identifier: MPL-2.0
|
|
|
|
package dan200.computercraft.shared.details;
|
|
|
|
import dan200.computercraft.shared.util.RegistryHelper;
|
|
import net.minecraft.core.Holder;
|
|
import net.minecraft.core.Registry;
|
|
import net.minecraft.tags.TagKey;
|
|
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
|
|
public final class DetailHelpers {
|
|
private DetailHelpers() {
|
|
}
|
|
|
|
public static <T> Map<String, Boolean> getTags(Holder.Reference<T> object) {
|
|
return getTags(object.tags());
|
|
}
|
|
|
|
public static <T> Map<String, Boolean> getTags(Stream<TagKey<T>> tags) {
|
|
return tags.collect(Collectors.toMap(x -> x.location().toString(), x -> true));
|
|
}
|
|
|
|
public static <T> String getId(Registry<T> registry, T entry) {
|
|
return RegistryHelper.getKeyOrThrow(registry, entry).toString();
|
|
}
|
|
}
|