Compare commits

..
2 Commits
Author SHA1 Message Date
Martin Robertz 00c214ee5d update deps 2023-10-21 12:22:30 +02:00
miozune e497b9505a Optimize PlankType$ExtraBiomesPlank.getStack() (#39) 2023-10-21 10:55:44 +02:00
6 changed files with 26 additions and 16 deletions

No files matched your search

+7 -1
View File
@@ -26,7 +26,13 @@ whitelist.json
*.iml *.iml
*.ipr *.ipr
*.iws *.iws
src/main/resources/mixins.*.json src/main/resources/mixins.*([!.]).json
*.bat *.bat
*.DS_Store *.DS_Store
!gradlew.bat !gradlew.bat
.factorypath
addon.local.gradle
addon.local.gradle.kts
addon.late.local.gradle
addon.late.local.gradle.kts
layout.json
+2 -2
View File
@@ -1,4 +1,4 @@
//version: 1696952014 //version: 1697697256
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. Also, you may replace this file at any time if there is an update available.
@@ -798,7 +798,7 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.7') java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.3.17')
} }
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false} java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
+2 -1
View File
@@ -4,8 +4,9 @@ dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.6.14:dev') api('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev') implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.4.3-GTNH:dev') devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.4.5-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.36:api') compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.36:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly("curse.maven:extrabiomesxl-60041:2273301")
} }
+2
View File
@@ -12,6 +12,7 @@ public class Mods {
public static Mod forestry; public static Mod forestry;
public static Mod ic2; public static Mod ic2;
public static Mod botania; public static Mod botania;
public static Mod extraBiomes;
private static Item findItem(String modId, String name) { private static Item findItem(String modId, String name) {
Item stack = GameRegistry.findItem(modId, name); Item stack = GameRegistry.findItem(modId, name);
@@ -41,6 +42,7 @@ public class Mods {
Mods.forestry = new Mod("Forestry"); Mods.forestry = new Mod("Forestry");
Mods.ic2 = new Mod("IC2"); Mods.ic2 = new Mod("IC2");
Mods.botania = new Mod("Botania"); Mods.botania = new Mod("Botania");
Mods.extraBiomes = new Mod("ExtrabiomesXL");
} }
public static class Mod { public static class Mod {
@@ -8,13 +8,12 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import com.google.common.base.Optional;
import binnie.core.Mods; import binnie.core.Mods;
import binnie.core.block.TileEntityMetadata; import binnie.core.block.TileEntityMetadata;
import binnie.core.util.I18N; import binnie.core.util.I18N;
import binnie.extratrees.ExtraTrees; import binnie.extratrees.ExtraTrees;
import binnie.extratrees.api.CarpentryManager; import binnie.extratrees.api.CarpentryManager;
import extrabiomes.api.Stuff;
public class PlankType { public class PlankType {
@@ -267,13 +266,10 @@ public class PlankType {
@Override @Override
public ItemStack getStack() { public ItemStack getStack() {
try { if (!Mods.extraBiomes.active()) {
Class clss = Class.forName("extrabiomes.api.Stuff");
Block block = (Block) ((Optional) clss.getField("planks").get(null)).get();
return new ItemStack(block, 1, ordinal());
} catch (Exception e) {
return null; return null;
} }
return Stuff.planks.transform(block -> new ItemStack(block, 1, ordinal())).orNull();
} }
@Override @Override
@@ -8,6 +8,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import binnie.core.Mods;
import binnie.core.block.TileEntityMetadata; import binnie.core.block.TileEntityMetadata;
import binnie.extratrees.ExtraTrees; import binnie.extratrees.ExtraTrees;
import binnie.extratrees.api.CarpentryManager; import binnie.extratrees.api.CarpentryManager;
@@ -17,6 +18,8 @@ import binnie.extratrees.block.decor.FenceType;
public class WoodManager { public class WoodManager {
private static List<IPlankType> allPlankTypes;
public static IPlankType getPlankType(int index) { public static IPlankType getPlankType(int index) {
IDesignMaterial wood = CarpentryManager.carpentryInterface.getWoodMaterial(index); IDesignMaterial wood = CarpentryManager.carpentryInterface.getWoodMaterial(index);
if (wood instanceof IPlankType) { if (wood instanceof IPlankType) {
@@ -97,16 +100,18 @@ public class WoodManager {
} }
public static List<IPlankType> getAllPlankTypes() { public static List<IPlankType> getAllPlankTypes() {
if (allPlankTypes != null) {
return allPlankTypes;
}
List<IPlankType> list = new ArrayList<>(); List<IPlankType> list = new ArrayList<>();
Collections.addAll(list, PlankType.ExtraTreePlanks.values()); Collections.addAll(list, PlankType.ExtraTreePlanks.values());
Collections.addAll(list, PlankType.ForestryPlanks.values()); Collections.addAll(list, PlankType.ForestryPlanks.values());
for (IPlankType type : PlankType.ExtraBiomesPlank.values()) { if (Mods.extraBiomes.active()) {
if (type.getStack() != null) { Collections.addAll(list, PlankType.ExtraBiomesPlank.values());
list.add(type);
}
} }
Collections.addAll(list, PlankType.VanillaPlanks.values()); Collections.addAll(list, PlankType.VanillaPlanks.values());
allPlankTypes = list;
return list; return list;
} }