Skip to content

Commit

Permalink
Merge branch 'master' into alex/reflection
Browse files Browse the repository at this point in the history
  • Loading branch information
Dream-Master authored Sep 20, 2024
2 parents 49184cd + 24ab986 commit 0e6e19f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
20 changes: 16 additions & 4 deletions src/functionalTest/java/kubatech/test/EIGTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.File;
import java.util.Map;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
Expand All @@ -46,6 +45,8 @@
import net.minecraft.world.storage.WorldInfo;
import net.minecraftforge.common.DimensionManager;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Test;

import gregtech.api.GregTechAPI;
Expand All @@ -56,6 +57,7 @@
import ic2.core.Ic2Items;
import ic2.core.crop.TileEntityCrop;
import ic2.core.item.ItemCropSeed;
import kubatech.Tags;
import kubatech.api.eig.EIGDropTable;
import kubatech.tileentity.gregtech.multiblock.MTEExtremeIndustrialGreenhouse;
import kubatech.tileentity.gregtech.multiblock.eigbuckets.EIGIC2Bucket;
Expand All @@ -66,6 +68,8 @@ public class EIGTests {
private static final int EIG_SIMULATION_TIME = 24 * HOURS;
private static final int NUMBER_OF_TESTS_TO_DO = 1000;

private static final Logger LOG = LogManager.getLogger(Tags.MODID);

static World myWorld;

public EIGTests() {
Expand Down Expand Up @@ -252,14 +256,17 @@ void EIGDrops() {
if (stackToTest == null) {
stackToTest = expected.entrySet()
.stream()
.max(Map.Entry.comparingByValue())
.filter(
x -> x.getKey()
.isItemEqual(Ic2Items.resin))
.findFirst()
.get()
.getKey();
}

realAvg += expected.getItemAmount(stackToTest);
// EIG with ic2 crops doesn't actually have variance, it uses very precise approximations that create
// accurate growth rate and drop quality approximations.
// accurate growth rate and drop quantity approximations.
eigAvg += generated.getItemAmount(stackToTest);
}
realAvg /= NUMBER_OF_TESTS_TO_DO;
Expand All @@ -270,7 +277,12 @@ void EIGDrops() {
System.out.println(debugInfo);

// We aim for about 99% accuracy over here.
assertTrue(accuracy >= 0.99d);
if (accuracy < 0.99d) {
LOG.warn(String.format("accuracy check failed! %.5f running secondary check", accuracy));
assertTrue(
eigAvg >= 1049.81851 - 0.00001 && eigAvg <= 1049.81851 + 0.00001,
String.format("secondary check failed, expected 1049.81851 +- 0.00001 got %.5f", eigAvg));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class AntimatterGenerator extends MTEExtendedPowerMultiBlockBase
private long euCapacity = 0;
private long euLastCycle = 0;
private float annihilationEfficiency = 0f;
public static final long ANTIMATTER_FUEL_VALUE = 1_000_000_000_000L;

private static final ClassValue<IStructureDefinition<AntimatterGenerator>> STRUCTURE_DEFINITION = new ClassValue<IStructureDefinition<AntimatterGenerator>>() {

Expand Down Expand Up @@ -202,7 +203,7 @@ public void createEU(long antimatter, FluidStack catalyst) {
float efficiency = Math
.min(((float) antimatter / (float) catalystCount), ((float) catalystCount / (float) antimatter));
this.annihilationEfficiency = efficiency;
generatedEU = (long) ((Math.pow(antimatter, modifier) * 1e12) * efficiency);
generatedEU = (long) ((Math.pow(antimatter, modifier) * ANTIMATTER_FUEL_VALUE) * efficiency);
}

if (wirelessEnabled && modifier >= 1.03F) {
Expand Down Expand Up @@ -328,7 +329,7 @@ protected MultiblockTooltipBuilder createTooltip() {
+ "voided"
+ EnumChatFormatting.GRAY)
.addSeparator()
.addInfo("Antimatter base energy value: 1,000,000,000 EU/L")
.addInfo("Antimatter base energy value: " + GTUtility.formatNumbers(ANTIMATTER_FUEL_VALUE) + " EU/L")
.addInfo("Energy production is exponentially increased depending on the matter used:")
.addInfo("Molten Copper: 1.00")
.addInfo("Molten SC UIV Base: 1.02")
Expand Down

0 comments on commit 0e6e19f

Please sign in to comment.