Compare commits

...
7 Commits
Author SHA1 Message Date
DreamMasterXXL d2a086ac02 bump version 2020-05-10 14:01:46 +02:00
Glease 859a79a824 Actually remove the debug prints
GTNewHorizons/GT-New-Horizons-Modpack#6061
2020-05-10 18:53:18 +08:00
Dream-Master 00c31a6158 bump version 2020-03-27 21:27:04 +01:00
bartimaeusnek 5db5b712ce Fixed Mutation Coniditons (#5)
+ reduced usage of reflexion
+ inlined code

Signed-off-by: bartimaeusnek <[email protected]>
2020-03-27 14:12:42 +01:00
Dream-Master 9cac9a14df bump version 2020-03-23 22:29:01 +01:00
bartimaeusnek 43f98e9cca fixed method not found exception
wrong class for get Method call... i hate reflexion >_>
2020-03-23 17:18:25 +01:00
Dream-Master ff4c09324b update gradle 2020-03-23 13:57:14 +01:00
10 changed files with 21 additions and 33 deletions

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ mcversion=1.7.10
forgeversion=10.13.4.1614-1.7.10
version_major=4
version_minor=2
version_patch=24
version_patch=27
Binary file not shown.
+2 -2
View File
@@ -1,6 +1,6 @@
#Wed Jul 02 15:54:47 CDT 2014
#Sat Jan 04 01:52:14 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4.1-bin.zip
@@ -15,6 +15,8 @@ import forestry.api.apiculture.IBeeGenome;
import forestry.api.apiculture.IBeeHousing;
import forestry.api.apiculture.IJubilanceProvider;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.ItemStackUtil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -52,7 +54,7 @@ public class JubilanceRequiresResource implements IJubilanceProvider {
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
return blockRequired.equals(stk); //this way to prevent NPEs
return InventoryUtil.isItemEqual(blockRequired, stk, true, true); //ffs dont compare itemsstacks with equal >_> and why tf didnt i got this until i debugged it? im getting old..
}
}
@@ -15,6 +15,8 @@ import forestry.api.genetics.IAllele;
import forestry.api.genetics.IGenome;
import forestry.api.genetics.IMutationCondition;
import forestry.core.utils.BlockUtil;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.StringUtil;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
@@ -51,7 +53,7 @@ public class MutationConditionRequiresResource implements IMutationCondition {
(TileEntity tile) -> (tile instanceof IBeeHousing)
);
return blockRequired.equals(stk) ? 1f : 0f;
return InventoryUtil.isItemEqual(blockRequired, stk, true, true) ? 1 : 0;
}
@Override
@@ -200,12 +200,12 @@ public abstract class RecipeUtil {
// Only move the recipes if the last one was beyond 500 in the recipeMap (in GTNH about 57k recipes)
if (matchingIndex.get(matchingIndex.size()-1) > 500) {
List recipeMap = CraftingManager.getInstance().getRecipeList();
System.out.println( "Highest recipe found at " + matchingIndex.get(matchingIndex.size()-1) + ", moving " + matchingIndex.size() + " to front" );
System.out.println( "Size of recipe map " + recipeMap.size() );
// System.out.println( "Highest recipe found at " + matchingIndex.get(matchingIndex.size()-1) + ", moving " + matchingIndex.size() + " to front" );
// System.out.println( "Size of recipe map " + recipeMap.size() );
for (index = 0; index < matchingIndex.size(); index++) { // index is reused here, it goes through the matching groups.
// Remove recipe and add back at the front
int target = matchingIndex.get(index); // remove requires int
System.out.println("Removing recipe at " + target);
// System.out.println("Removing recipe at " + target);
recipeMap.remove(target);
recipeMap.add(0,matchingRecipeMap.get(index));
}
@@ -231,16 +231,14 @@ public abstract class BlockUtil {
}
private static Class<? extends Block> BW_MetaGenerated_WerkstoffBlocksClass;
private static Method getDamage;
private static Block BWBlocks;
private static boolean bw = Loader.isModLoaded("bartworks");
static {
if (bw)
try {
BW_MetaGenerated_WerkstoffBlocksClass = (Class<? extends Block>) Class.forName("com.github.bartimaeusnek.bartworks.system.material.BW_MetaGenerated_WerkstoffBlocks");
getDamage = BW_MetaGenerated_WerkstoffBlocksClass.getMethod("getDamageValue", World.class, int.class, int.class, int.class);
BWBlocks = (Block) Class.forName("com.github.bartimaeusnek.bartworks.system.material.WerkstoffLoader").getField("BWBlocks").get(null);
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException | NoSuchMethodException e) {
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
@@ -257,12 +255,7 @@ public abstract class BlockUtil {
block = world.getBlock(x, y - depth, z);
if (bw && BW_MetaGenerated_WerkstoffBlocksClass.isInstance(block)) {
try {
return new ItemStack(BWBlocks, 1, (Integer) getDamage.invoke(block, world, x, y - depth, z));
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
return null;
}
return new ItemStack(BWBlocks, 1, block.getDamageValue(world, x, y - depth, z));
}
return new ItemStack(block, 1, world.getBlockMetadata(x, y - depth, z));
@@ -105,10 +105,7 @@ public abstract class InventoryUtil {
if (a.getItemDamage() != b.getItemDamage()) {
return false;
}
if (a.stackTagCompound != null && !a.stackTagCompound.equals(b.stackTagCompound)) {
return false;
}
return true;
return a.stackTagCompound == null || a.stackTagCompound.equals(b.stackTagCompound);
}
/**
@@ -137,9 +134,7 @@ public abstract class InventoryUtil {
if (isWildcard(a) || isWildcard(b)) {
return true;
}
if (a.getItemDamage() != b.getItemDamage()) {
return false;
}
return a.getItemDamage() == b.getItemDamage();
}
return true;
}
@@ -157,8 +157,8 @@ public abstract class ItemStackUtil {
int reqCount = 0;
for (ItemStack offer : condensedOffered) {
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (matchTags ? ItemStack.areItemStackTagsEqual(req, offer) : true)) {
int stackCount = (int) Math.floor(offer.stackSize / req.stackSize);
if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (!matchTags || ItemStack.areItemStackTagsEqual(req, offer))) {
int stackCount = (int) Math.floor( (float) offer.stackSize / (float) req.stackSize);
reqCount = Math.max(reqCount, stackCount);
}
}
@@ -316,7 +316,7 @@ public abstract class ItemStackUtil {
public static ItemStack copyWithRandomSize(ItemStack template, int max, Random rand) {
int size = rand.nextInt(max);
ItemStack created = template.copy();
created.stackSize = size <= 0 ? 1 : size > created.getMaxStackSize() ? created.getMaxStackSize() : size;
created.stackSize = size <= 0 ? 1 : Math.min(size, created.getMaxStackSize());
return created;
}
@@ -35,9 +35,7 @@ public abstract class ModUtil {
VersionRange versionRange = VersionParser.parseRange(versionRangeString);
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(modname, versionRange);
if (!requiredVersion.containsVersion(modVersion)) {
return false;
}
return requiredVersion.containsVersion(modVersion);
}
return true;
@@ -69,9 +67,7 @@ public abstract class ModUtil {
DefaultArtifactVersion givenVersion = new DefaultArtifactVersion(apiName, apiVersionString);
DefaultArtifactVersion requiredVersion = new DefaultArtifactVersion(apiName, versionRange);
if (!requiredVersion.containsVersion(givenVersion)) {
return false;
}
return requiredVersion.containsVersion(givenVersion);
}
return true;