Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Nov 25, 2023
1 parent b862cb7 commit dc40f12
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package gregtech.integration.exnihilo;

import exnihilocreatio.registries.manager.ExNihiloRegistryManager;
import gregtech.api.GTValues;
import gregtech.api.GregTechAPI;
import gregtech.api.gui.GuiTextures;
import gregtech.api.gui.resources.SteamTexture;
import gregtech.api.gui.widgets.ProgressWidget;
Expand Down Expand Up @@ -44,14 +42,12 @@
import static gregtech.api.unification.ore.OrePrefix.Flags.ENABLE_UNIFICATION;
import static gregtech.common.metatileentities.MetaTileEntities.*;


@GregTechModule(
moduleID = GregTechModules.MODULE_EN,
containerID = GTValues.MODID,
modDependencies = GTValues.MODID_EN,
name = "GregTech ExNihiloCreatio integration",
descriptionKey = "gregtech.modules.en_integration.description"
)
name = "GregTech Ex Nihilo Creatio Integration",
description = "Ex Nihilo Integration Module")
public class ExNihiloModule extends IntegrationSubmodule {

// Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public MetaTileEntity createMetaTileEntity(IGregTechTileEntity metaTileEntityHol

@Override
protected IItemHandlerModifiable createImportItemHandler() {
return new NotifiableItemStackHandler(2, this, false);
return new NotifiableItemStackHandler(this, 2, this, false);
}

@Override
protected IItemHandlerModifiable createExportItemHandler() {
return new NotifiableItemStackHandler(30, this, true);
return new NotifiableItemStackHandler(this, 30, this, true);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import gregtech.api.recipes.ModHandler;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.chance.output.ChancedOutputLogic;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.Materials;
Expand Down Expand Up @@ -54,8 +55,8 @@ private static void processChunk(OrePrefix orePrefix, Material material, OreProp
public static void registerGTRecipes() {
// Machine Recipes
MetaTileEntityLoader.registerMachineRecipe(SIEVES, "CPC", "FMF", "OSO", 'M', HULL, 'C', CIRCUIT, 'O', CABLE, 'F', CONVEYOR, 'S', new ItemStack(ModBlocks.sieve), 'P', PISTON);
ModHandler.addShapedRecipe("steam_sieve_bronze", STEAM_SIEVE_BRONZE.getStackForm(), "BPB", "BMB", "BSB", 'B', new UnificationEntry(OrePrefix.pipeSmallFluid, Materials.Bronze), 'M', MetaBlocks.STEAM_CASING.getItemVariant(BRONZE_HULL), 'S', new ItemStack(ModBlocks.sieve), 'P', Blocks.PISTON);
ModHandler.addShapedRecipe("steam_sieve_steel", STEAM_SIEVE_STEEL.getStackForm(), "BPB", "WMW", "BBB", 'B', new UnificationEntry(OrePrefix.pipeSmallFluid, Materials.WroughtIron), 'M', STEAM_SIEVE_BRONZE.getStackForm(), 'W', new UnificationEntry(OrePrefix.plate, Materials.WroughtIron), 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel));
ModHandler.addShapedRecipe(true, "steam_sieve_bronze", STEAM_SIEVE_BRONZE.getStackForm(), "BPB", "BMB", "BSB", 'B', new UnificationEntry(OrePrefix.pipeSmallFluid, Materials.Bronze), 'M', MetaBlocks.STEAM_CASING.getItemVariant(BRONZE_HULL), 'S', new ItemStack(ModBlocks.sieve), 'P', Blocks.PISTON);
ModHandler.addShapedRecipe(true, "steam_sieve_steel", STEAM_SIEVE_STEEL.getStackForm(), "BPB", "WMW", "BBB", 'B', new UnificationEntry(OrePrefix.pipeSmallFluid, Materials.WroughtIron), 'M', STEAM_SIEVE_BRONZE.getStackForm(), 'W', new UnificationEntry(OrePrefix.plate, Materials.WroughtIron), 'P', new UnificationEntry(OrePrefix.plate, Materials.Steel));
}

// Has to be done in init phase because of ExNi registering outside the Registry event
Expand All @@ -68,12 +69,15 @@ public static void registerExNihiloRecipes() {
SimpleRecipeBuilder builder = SIEVE_RECIPES.recipeBuilder().notConsumable(recipe.getMesh()).inputs(stack);

for (Siftable siftable : ExNihiloRegistryManager.SIEVE_REGISTRY.getDrops(stack)) {
if (siftable.getMeshLevel() == recipe.getMesh().getMetadata())
if ((int) (siftable.getChance() * (float) Recipe.getMaxChancedValue()) >= Recipe.getMaxChancedValue()) {
if (siftable.getDrop() == null) continue;
if (siftable.getMeshLevel() == recipe.getMesh().getMetadata()) {
int maxChance = ChancedOutputLogic.getMaxChancedValue();
if ((int) (siftable.getChance() * (float) maxChance) >= maxChance) {
builder.outputs(siftable.getDrop().getItemStack());
} else {
builder.chancedOutput(siftable.getDrop().getItemStack(), (int) (siftable.getChance() * (float) Recipe.getMaxChancedValue()), 200);
builder.chancedOutput(siftable.getDrop().getItemStack(), (int) (siftable.getChance() * (float) maxChance), 200);
}
}
}
builder.buildAndRegister();
}
Expand Down

0 comments on commit dc40f12

Please sign in to comment.