Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
296 changes: 287 additions & 9 deletions build.gradle

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@
*/
dependencies {
api("codechicken:codechickenlib:3.2.3.358") // CCL 3.2.3.358
devOnlyNonPublishable(rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:5519022")) // CEu 2.8.10
devOnlyNonPublishable(rfg.deobf("curse.maven:gregicality-multiblocks-564858:5619513")) // GCYM 1.2.11
//devOnlyNonPublishable(rfg.deobf("curse.maven:gregtech-ce-unofficial-557242:5519022")) // CEu 2.8.10
//devOnlyNonPublishable(rfg.deobf("curse.maven:gregicality-multiblocks-564858:5121714")) // GCYM 1.2.8
devOnlyNonPublishable(rfg.deobf(project.files("libs/gregtech-1.12.2-2.9.0-beta_build-b24ff3e-dev.jar"))) // CEu 2.9-pr
devOnlyNonPublishable(rfg.deobf(project.files("libs/GregicalityMultiblocks-1.3.0_build-b24ff3e-dev.jar"))) // GCYM for CEu 2.9-pr


api("com.cleanroommc:modularui:2.5.0-rc4") { transitive = false }
api("com.cleanroommc:groovyscript:1.2.0-hotfix1") { transitive = false }
api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700")
api rfg.deobf("curse.maven:ctm-267602:2915363") // CTM 1.0.2.31

api("com.cleanroommc:groovyscript:1.1.1") { transitive = false } // GrS 1.1.1
api("CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-4.1.20.700") // CrT 4.1.20.689
api("com.cleanroommc:modularui:2.4.3") // MUI 2.4.3
api("appeng:ae2-uel:v0.56.4") { transitive = false }

// Debug Forestry
compileOnly rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387
if (project.forestry.toBoolean()) {
runtimeOnlyNonPublishable rfg.deobf("curse.maven:forestry-59751:2684780") // Forestry 5.8.2.387
}

}
Binary file not shown.
Binary file not shown.
14 changes: 0 additions & 14 deletions src/main/java/kono/ceu/materialreplication/MRConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
@Config(modid = MRValues.MODID)
public class MRConfig {

@Config.Name("MetaTileEntityID Option")
@Config.RequiresMcRestart
public static IdOption id = new IdOption();

@Config.Comment("Config option of materials for Deconstruction/Replication")
@Config.Name("Material Options")
@Config.RequiresMcRestart
Expand Down Expand Up @@ -41,16 +37,6 @@ public class MRConfig {
@Config.RequiresMcRestart
public static StartTier tier = new StartTier();

public static class IdOption {

@Config.Comment({ "Change the starting ID of the MetaTileEntityID used by this add-on.",
"By Default, this add-on starts MetaTileEntityIDs of 20000.",
"Only change this if the crash is caused by a duplicate MTEIDs.",
"WARNING: If you change it, the one already created will disappear or be changed to another one." })
@Config.RangeInt(min = 11000, max = 32200)
public int startId = 20000;
}

public static class MaterialOption {

// TODO Make Blacklist from Config
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kono.ceu.materialreplication;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Config;
import net.minecraftforge.common.config.ConfigManager;
import net.minecraftforge.fml.client.event.ConfigChangedEvent;
Expand All @@ -15,13 +16,14 @@
import kono.ceu.materialreplication.api.util.MRValues;
import kono.ceu.materialreplication.api.util.Mods;
import kono.ceu.materialreplication.common.CommonProxy;
import kono.ceu.materialreplication.common.machines.MRMetaTileEntities;

@Mod(modid = MRValues.MODID,
name = MRValues.MODNAME,
version = Tags.VERSION,
acceptedMinecraftVersions = "[1.12, 1.12.2]",
dependencies = GTInternalTags.DEP_VERSION_STRING + "required-after:" + Mods.Names.GREGICALITY_MULTIBLOCKS + ";" +
"after:" + Mods.Names.FORESTRY + ";")
dependencies = GTInternalTags.DEP_VERSION_STRING + "required-after:" + Mods.Names.MODULRAUI + ";" +
"required-after:" + Mods.Names.GREGICALITY_MULTIBLOCKS + ";" + "after:" + Mods.Names.FORESTRY)

public class MaterialReplication {

Expand All @@ -35,7 +37,9 @@ public class MaterialReplication {

@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(this);
proxy.preInit(event);
MRMetaTileEntities.init();
}

@Mod.EventHandler
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package kono.ceu.materialreplication.api.recipes;

import static kono.ceu.materialreplication.api.util.MRValues.mrId;
import static kono.ceu.materialreplication.loaders.recipe.MRMachineRecipeLoader.hasOnlyMolten;

import java.util.ArrayList;
Expand All @@ -13,8 +14,10 @@
import gregtech.api.gui.widgets.ProgressWidget;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.RecipeMapBuilder;
import gregtech.api.recipes.RecipeMaps;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.ui.RecipeMapUI;
import gregtech.api.unification.material.Material;
import gregtech.api.unification.material.properties.PropertyKey;
import gregtech.api.unification.ore.OrePrefix;
Expand All @@ -26,37 +29,40 @@
import kono.ceu.materialreplication.api.gui.MRGuiTextures;
import kono.ceu.materialreplication.api.recipes.builders.ReplicatorRecipeBuilder;
import kono.ceu.materialreplication.api.recipes.machines.IReplicatorRecipeMap;
import kono.ceu.materialreplication.api.recipes.machines.RecipeMapReplicator;
import kono.ceu.materialreplication.api.recipes.machines.RecipeMapScrapMaker;
import kono.ceu.materialreplication.api.unification.materials.flags.MRMaterialFlags;
import kono.ceu.materialreplication.common.items.MRMetaItems;

public class MRRecipeMaps {

// Deconstractor
public static final RecipeMap<SimpleRecipeBuilder> DECONSTRUCTION_RECIPES = new RecipeMap<>("deconstruction",
1, 1, 1, 2, // Max(itemIn, itemOut, fluidIn, fluidOut)
new SimpleRecipeBuilder(), false)
.setSound(GTSoundEvents.CENTRIFUGE)
.setSlotOverlay(false, false, GuiTextures.DUST_OVERLAY) // Item Input
.setSlotOverlay(false, true, GuiTextures.LIGHTNING_OVERLAY_2) // Fluid Input
.setSlotOverlay(true, true, false, GuiTextures.MOLECULAR_OVERLAY_3) // Fluid Output1
.setSlotOverlay(true, true, true, GuiTextures.MOLECULAR_OVERLAY_4) // Fluid Output2
.setProgressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, ProgressWidget.MoveType.HORIZONTAL);
public static final RecipeMap<SimpleRecipeBuilder> DECONSTRUCTION_RECIPES = new RecipeMapBuilder<>("deconstruction",
new SimpleRecipeBuilder())
.itemInputs(1).itemOutputs(1)
.fluidInputs(1).fluidOutputs(2)
.itemSlotOverlay(GuiTextures.DUST_OVERLAY, false)
.itemSlotOverlay(GuiTextures.DUST_OVERLAY, true)
.fluidSlotOverlay(GuiTextures.LIGHTNING_OVERLAY_2, false)
.fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_3, true, false)
.fluidSlotOverlay(GuiTextures.MOLECULAR_OVERLAY_4, true, true)
.sound(GTSoundEvents.CENTRIFUGE)
.progressBar(GuiTextures.PROGRESS_BAR_MASS_FAB, ProgressWidget.MoveType.HORIZONTAL)
.build();

// Replicator
public static final RecipeMap<ReplicatorRecipeBuilder> REPLICATION_RECIPES = new RecipeMapReplicator("replication",
2, 1, 2, 1, new ReplicatorRecipeBuilder(), false)
.setSound(GTSoundEvents.ASSEMBLER)
.setSlotOverlay(false, false, GuiTextures.DATA_ORB_OVERLAY)
.setSlotOverlay(false, false, MRGuiTextures.USB_OVERLAY) // Item Input
.setSlotOverlay(false, true, false, GuiTextures.ATOMIC_OVERLAY_1) // Fluid Input 1
.setSlotOverlay(false, true, true, GuiTextures.ATOMIC_OVERLAY_2) // Fluid Input 2
.setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY) // Item Output
.setSlotOverlay(true, true, GuiTextures.VIAL_OVERLAY_1) // Fluid Output
.setProgressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, ProgressWidget.MoveType.HORIZONTAL)
.allowEmptyOutput()
.onRecipeBuild(recipeBuilder -> {
// toDo Use RecipeMapReplicator<> instead of RecipeMapBuilder<>
public static final RecipeMap<ReplicatorRecipeBuilder> REPLICATION_RECIPES = new RecipeMapBuilder<>("replication",
new ReplicatorRecipeBuilder())
.itemInputs(1).itemOutputs(1)
.fluidInputs(2).fluidOutputs(1)
.itemSlotOverlay(MRGuiTextures.USB_OVERLAY, false)
.itemSlotOverlay(GuiTextures.DUST_OVERLAY, true)
.fluidSlotOverlay(GuiTextures.ATOMIC_OVERLAY_1, false, false)
.fluidSlotOverlay(GuiTextures.ATOMIC_OVERLAY_2, false, true)
.fluidSlotOverlay(GuiTextures.VIAL_OVERLAY_1, true)
.progressBar(GuiTextures.PROGRESS_BAR_REPLICATOR, ProgressWidget.MoveType.HORIZONTAL)
.sound(GTSoundEvents.ASSEMBLER)
.onBuild(mrId("replication_research"), recipeBuilder -> {
if (!recipeBuilder.scanRecipe()) return;

String replicateId = recipeBuilder.getReplicateID();
Expand All @@ -74,7 +80,6 @@ public class MRRecipeMaps {

List<Material> materialDusts = new ArrayList<>();
List<Material> materialFluids = new ArrayList<>();

if (!replicateMaterial.hasFlag(MRMaterialFlags.DISABLE_REPLICATION)) {
// Has Dust Property?
if (replicateMaterial.hasProperty(PropertyKey.DUST)) {
Expand All @@ -95,7 +100,6 @@ public class MRRecipeMaps {
.EUt(recipeBuilder.getVoltage())
.duration(recipeBuilder.getDuration())
.buildAndRegister();

}

for (Material materialFluid : materialFluids) {
Expand All @@ -115,14 +119,14 @@ public class MRRecipeMaps {
}
scanner.buildAndRegister();
}
});
}).build();

// Scrapper
public static final RecipeMap<SimpleRecipeBuilder> SCRAPMAKER_RECIPES = new RecipeMapScrapMaker("scrapper",
1, 1, 1, 0,
new SimpleRecipeBuilder(), false)
.setSound(GTSoundEvents.MACERATOR)
.setSlotOverlay(true, false, GuiTextures.DUST_OVERLAY)
.setSlotOverlay(false, true, GuiTextures.LIGHTNING_OVERLAY_2) // Fluid Input
.setProgressBar(GuiTextures.PROGRESS_BAR_RECYCLER, ProgressWidget.MoveType.HORIZONTAL);
new SimpleRecipeBuilder(), recipeMap -> {
RecipeMapUI<?> ui = new RecipeMapUI<>(recipeMap, true, true, true, false, false);
ui.setItemSlotOverlay(GuiTextures.DUST_OVERLAY, true);
ui.setFluidSlotOverlay(GuiTextures.LIGHTNING_OVERLAY_2, false);
return ui;
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import net.minecraft.nbt.NBTTagCompound;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.jetbrains.annotations.NotNull;

import gregtech.api.GregTechAPI;
import gregtech.api.recipes.Recipe;
Expand All @@ -20,7 +21,7 @@
import gregtech.api.util.ValidationResult;

import kono.ceu.materialreplication.api.recipes.machines.IReplicatorRecipeMap;
import kono.ceu.materialreplication.api.recipes.properties.ReplicateProperty;
import kono.ceu.materialreplication.api.recipes.properties.impl.ReplicateProperty;

public class ReplicatorRecipeBuilder extends RecipeBuilder<ReplicatorRecipeBuilder> {

Expand All @@ -37,7 +38,7 @@ public ReplicatorRecipeBuilder(Recipe recipe, RecipeMap<ReplicatorRecipeBuilder>
super(recipe, recipeMap);
}

public ReplicatorRecipeBuilder(ReplicatorRecipeBuilder recipeBuilder) {
public ReplicatorRecipeBuilder(@NotNull ReplicatorRecipeBuilder recipeBuilder) {
super(recipeBuilder);
this.replicationMaterial = recipeBuilder.replicationMaterial;
this.Duration = recipeBuilder.Duration;
Expand All @@ -50,12 +51,12 @@ public ReplicatorRecipeBuilder copy() {
}

@Override
public boolean applyProperty(@Nonnull String key, Object value) {
public boolean applyPropertyCT(@Nonnull String key, @NotNull Object value) {
if (key.equals(ReplicateProperty.KEY)) {
this.replicate(value.toString());
return true;
}
return super.applyProperty(key, value);
return super.applyPropertyCT(key, value);
}

protected ReplicatorRecipeBuilder replicate(@Nonnull String replicateID) {
Expand All @@ -73,7 +74,7 @@ public ReplicatorRecipeBuilder replicate(@Nonnull Material replicationMaterial)
}

public ReplicatorRecipeBuilder replicate(@Nonnull Material replicationMaterial, int time, int EUt) {
return replicate(replicationMaterial, replicationMaterial.toString(), time, EUt);
return replicate(replicationMaterial, replicationMaterial.getRegistryName(), time, EUt);
}

public ReplicatorRecipeBuilder replicate(@Nonnull Material replicationMaterial, @Nonnull String replicateID,
Expand Down Expand Up @@ -105,9 +106,7 @@ public ValidationResult<Recipe> build() {
ValidationResult<Recipe> result = super.build();
if (result.getType() == EnumValidationResult.VALID && !this.outputs.isEmpty() &&
!this.outputs.get(0).isEmpty()) {
if (!recipePropertyStorage.hasRecipeProperty(ReplicateProperty.getInstance())) {
this.applyProperty(ReplicateProperty.getInstance(), this.outputs.get(0).getTranslationKey());
}
this.applyProperty(ReplicateProperty.getInstance(), this.outputs.get(0).getTranslationKey());
}
return result;
}
Expand All @@ -131,7 +130,7 @@ public boolean scanRecipe() {

public String getReplicateID() {
return this.recipePropertyStorage == null ? "" :
this.recipePropertyStorage.getRecipePropertyValue(ReplicateProperty.getInstance(), "");
this.recipePropertyStorage.get(ReplicateProperty.getInstance(), "");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,34 @@

import javax.annotation.Nonnull;

import org.jetbrains.annotations.NotNull;

import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.ui.RecipeMapUIFunction;
import gregtech.api.util.EnumValidationResult;
import gregtech.api.util.ValidationResult;
import gregtech.core.sound.GTSoundEvents;

import kono.ceu.materialreplication.api.recipes.builders.ReplicatorRecipeBuilder;
import kono.ceu.materialreplication.api.recipes.properties.ReplicateProperty;
import kono.ceu.materialreplication.api.recipes.properties.impl.ReplicateProperty;

import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;

public class RecipeMapReplicator extends RecipeMap<ReplicatorRecipeBuilder> implements IReplicatorRecipeMap {
// Implemented for now (unused)
public class RecipeMapReplicator<R extends RecipeBuilder<R>> extends RecipeMap<R> implements IReplicatorRecipeMap {

private final Map<String, Set<Recipe>> replicateEntries = new Object2ObjectOpenHashMap<>();

public RecipeMapReplicator(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs,
int maxFluidOutputs, ReplicatorRecipeBuilder defaultRecipe, boolean isHidden) {
super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden);
public RecipeMapReplicator(@NotNull String unlocalizedName, @NotNull R defaultRecipe,
@NotNull RecipeMapUIFunction recipeMapUI) {
super(unlocalizedName, defaultRecipe, recipeMapUI, 2, 1, 2, 1);
setSound(GTSoundEvents.ASSEMBLER);
}

@Override
public boolean addRecipe(ValidationResult<Recipe> validationResult) {
public boolean addRecipe(@NotNull ValidationResult<Recipe> validationResult) {
super.addRecipe(validationResult);
if (validationResult.getType() == EnumValidationResult.INVALID) {
Recipe recipe = validationResult.getResult();
Expand All @@ -40,7 +46,7 @@ public boolean addRecipe(ValidationResult<Recipe> validationResult) {
}

@Override
public boolean removeRecipe(Recipe recipe) {
public boolean removeRecipe(@NotNull Recipe recipe) {
boolean result = super.removeRecipe(recipe);
if (result && recipe.hasProperty(ReplicateProperty.getInstance())) {
String replicateId = recipe.getProperty(ReplicateProperty.getInstance(), "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,19 @@
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;

import org.jetbrains.annotations.NotNull;

import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.ingredients.GTRecipeItemInput;
import gregtech.api.recipes.ui.RecipeMapUIFunction;

public class RecipeMapScrapMaker extends RecipeMap<SimpleRecipeBuilder> {

public RecipeMapScrapMaker(String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs,
int maxFluidOutputs, SimpleRecipeBuilder defaultRecipe, boolean isHidden) {
super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipe, isHidden);
public RecipeMapScrapMaker(@NotNull String unlocalizedName, @NotNull SimpleRecipeBuilder defaultRecipe,
@NotNull RecipeMapUIFunction recipeMapUI) {
super(unlocalizedName, defaultRecipe, recipeMapUI, 1, 1, 1, 0);
}

@Override
Expand Down
Loading