Optimize PlankType$ExtraBiomesPlank.getStack() (#39)

This commit is contained in:
miozune authored and GitHub committed 2023-10-21 10:55:44 +02:00
1 parent b5ac446e55
commit e497b9505a
6 files changed
+25 -15

No files matched your search

@@ -8,6 +8,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import binnie.core.Mods;
import binnie.core.block.TileEntityMetadata;
import binnie.extratrees.ExtraTrees;
import binnie.extratrees.api.CarpentryManager;
@@ -17,6 +18,8 @@ import binnie.extratrees.block.decor.FenceType;
public class WoodManager {
private static List<IPlankType> allPlankTypes;
public static IPlankType getPlankType(int index) {
IDesignMaterial wood = CarpentryManager.carpentryInterface.getWoodMaterial(index);
if (wood instanceof IPlankType) {
@@ -97,16 +100,18 @@ public class WoodManager {
}
public static List<IPlankType> getAllPlankTypes() {
if (allPlankTypes != null) {
return allPlankTypes;
}
List<IPlankType> list = new ArrayList<>();
Collections.addAll(list, PlankType.ExtraTreePlanks.values());
Collections.addAll(list, PlankType.ForestryPlanks.values());
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) {
if (type.getStack() != null) {
list.add(type);
}
if (Mods.extraBiomes.active()) {
Collections.addAll(list, PlankType.ExtraBiomesPlank.values());
}
Collections.addAll(list, PlankType.VanillaPlanks.values());
allPlankTypes = list;
return list;
}