Skip to content

Commit

Permalink
merge changes from upstream #1709
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Aug 15, 2021
1 parent db8a4a9 commit 2bede3b
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/main/java/gregtech/integration/jei/GTOreCategory.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public class GTOreCategory extends PrimitiveRecipeCategory<GTOreInfo, GTOreInfo>
protected List<Integer> dimensionIDs;
protected final int FONT_HEIGHT = Minecraft.getMinecraft().fontRenderer.FONT_HEIGHT;
protected final Map<Integer, String> namedDimensions = WorldGenRegistry.getNamedDimensions();
private final Map<DimensionType, IntSortedSet> dimMap = DimensionManager.getRegisteredDimensions();
private final Supplier<List<Integer>> dimension = this::getAllRegisteredDimensions;
private final int NUM_OF_SLOTS = 5;
private final int SLOT_WIDTH = 18;
Expand Down Expand Up @@ -193,30 +192,22 @@ private void drawVeinName(final FontRenderer fontRenderer) {

public List<Integer> getAllRegisteredDimensions() {
List<Integer> dims = new ArrayList<>();
/*
Gather the registered dimensions here instead of at the top of the class to catch very late registered dimensions
such as Advanced Rocketry
*/
Map<DimensionType, IntSortedSet> dimMap = DimensionManager.getRegisteredDimensions();
dimMap.values().stream()
.flatMap(Collection::stream)
.mapToInt(Integer::intValue)
.filter(num -> definition.getDimensionFilter().test(DimensionManager.createProviderFor(num)))
.forEach(dims::add);

//Slight cleanup of the list if Advanced Rocketry is installed
if (isModLoaded(MODID_AR)) {
try {
int[] plantDims = DimensionManager.getDimensions(DimensionType.byName("planet"));
int[] asteroidDims = DimensionManager.getDimensions(DimensionType.byName("asteroid"));
int[] spaceDims = DimensionManager.getDimensions(DimensionType.byName("space"));

//Add the Planets to the dimension list
Arrays.stream(plantDims)
.filter(num -> !dims.contains(num))
.filter(num -> definition.getDimensionFilter().test(DimensionManager.createProviderFor(num)))
.forEach(dims::add);

//Add the Asteroids to the dimension list
Arrays.stream(asteroidDims)
.filter(num -> !dims.contains(num))
.filter(num -> definition.getDimensionFilter().test(DimensionManager.createProviderFor(num)))
.forEach(dims::add);

//Remove Space from the dimension list
for (int spaceDim : spaceDims) {
if (dims.contains(spaceDim)) {
Expand Down

0 comments on commit 2bede3b

Please sign in to comment.