Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nano forge (for now, might do PCB factory in this PR too) #80

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
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
Empty file added hi
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@

import com.zorbatron.zbgt.api.recipes.builders.CALRecipeBuilder;
import com.zorbatron.zbgt.api.recipes.builders.CoALRecipeBuilder;
import com.zorbatron.zbgt.api.recipes.builders.NanoForgeRecipeBuilder;
import com.zorbatron.zbgt.api.recipes.builders.PreciseAssemblerRecipeBuilder;
import com.zorbatron.zbgt.api.recipes.maps.RecipeMapCAL;
import com.zorbatron.zbgt.api.recipes.maps.RecipeMapCoAL;
import com.zorbatron.zbgt.api.recipes.maps.RecipeMapNanoForge;
import com.zorbatron.zbgt.api.recipes.maps.RecipeMapPreciseAssembler;

import gregtech.api.GTValues;
Expand Down Expand Up @@ -38,6 +40,11 @@ public final class ZBGTRecipeMaps {
}
});

public static final RecipeMap<NanoForgeRecipeBuilder> NANO_FORGE_RECIPES = new RecipeMapNanoForge<>(
"nano_forge_recipes",
new NanoForgeRecipeBuilder())
.setProgressBar(GuiTextures.PROGRESS_BAR_CIRCUIT, ProgressWidget.MoveType.HORIZONTAL);

public static void modifyMaps() {
POLARIZER_RECIPES.setMaxFluidInputs(1);
POLARIZER_RECIPES.setMaxFluidOutputs(1);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package com.zorbatron.zbgt.api.recipes.builders;

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

import com.zorbatron.zbgt.api.recipes.properties.NanoForgeProperty;
import com.zorbatron.zbgt.api.util.ZBGTLog;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.MetaTileEntityNanoForge;

import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.util.EnumValidationResult;

public class NanoForgeRecipeBuilder extends RecipeBuilder<NanoForgeRecipeBuilder> {

public NanoForgeRecipeBuilder() {}

public NanoForgeRecipeBuilder(Recipe recipe, RecipeMap<NanoForgeRecipeBuilder> recipeMap) {
super(recipe, recipeMap);
}

public NanoForgeRecipeBuilder(RecipeBuilder<NanoForgeRecipeBuilder> recipeBuilder) {
super(recipeBuilder);
}

@Override
public NanoForgeRecipeBuilder copy() {
return new NanoForgeRecipeBuilder(this);
}

@Override
public boolean applyProperty(@NotNull String key, @Nullable Object value) {
if (key.equals(NanoForgeProperty.KEY)) {

return true;
}

return super.applyProperty(key, value);
}

public NanoForgeRecipeBuilder nanoForgeTier(int tier) {
int tiers = MetaTileEntityNanoForge.getNaniteTiers().size();
if (tier < 1) {
ZBGTLog.logger.error("Nano forge tier cannot be less than 1!",
new IllegalArgumentException());
this.recipeStatus = EnumValidationResult.INVALID;
} else if (tier > tiers) {
ZBGTLog.logger.error("Nano forge tier cannot be more than {}!",
tiers, new IllegalArgumentException());
this.recipeStatus = EnumValidationResult.INVALID;
}

applyProperty(NanoForgeProperty.getInstance(), tier);

return this;
}

public int getNanoForgeTier() {
return recipePropertyStorage == null ? 0 :
recipePropertyStorage.getRecipePropertyValue(NanoForgeProperty.getInstance(), 0);
}

@Override
public String toString() {
return new ToStringBuilder(this)
.append(super.toString())
.append(NanoForgeProperty.getInstance().getKey(), getNanoForgeTier())
.toString();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.zorbatron.zbgt.api.recipes.maps;

import org.jetbrains.annotations.NotNull;

import gregtech.api.recipes.RecipeBuilder;
import gregtech.api.recipes.RecipeMap;

public class RecipeMapNanoForge<R extends RecipeBuilder<R>> extends RecipeMap<R> {

public RecipeMapNanoForge(@NotNull String unlocalizedName, @NotNull R defaultRecipeBuilder) {
super(unlocalizedName, 6, 2, 3, 0, defaultRecipeBuilder, false);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.zorbatron.zbgt.api.recipes.properties;

import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;

import gregtech.api.recipes.recipeproperties.RecipeProperty;

public class NanoForgeProperty extends RecipeProperty<Integer> {

public static final String KEY = "nano_forge_tier";

public static NanoForgeProperty INSTANCE;

protected NanoForgeProperty() {
super(KEY, Integer.class);
}

public static NanoForgeProperty getInstance() {
if (INSTANCE == null) {
INSTANCE = new NanoForgeProperty();
}

return INSTANCE;
}

@Override
public void drawInfo(Minecraft minecraft, int x, int y, int color, Object value) {
minecraft.fontRenderer.drawString(I18n.format("zbgt.machine.nano_forge.tier", castValue(value)), x, y, color);
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/zorbatron/zbgt/api/render/ZBGTTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class ZBGTTextures {
public static SimpleOverlayRenderer IRIDIUM_CASING;

public static ICubeRenderer YOTTANK_CASING;
public static SimpleOverlayRenderer RADIANT_NAQUADAH_CASING;

public static void preInit() {
WATER_OVERLAY_INFINITY = new SimpleOverlayRenderer("overlay/machine/water_infinity");
Expand Down Expand Up @@ -64,6 +65,7 @@ public static void preInit() {
IRIDIUM_CASING = new SimpleOverlayRenderer("casings/material/iridium");

YOTTANK_CASING = new SidedCubeRenderer("casings/yottank");
RADIANT_NAQUADAH_CASING = new SimpleOverlayRenderer("casings/misc/radiant_naquadah");
}

public static SimpleOverlayRenderer getPrassTextureByTier(int tier) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
import com.zorbatron.zbgt.api.unification.material.materials.*;
import com.zorbatron.zbgt.api.unification.material.modifications.ZBGTMaterialExtraFlags;
import com.zorbatron.zbgt.api.unification.material.modifications.ZBGTMaterialExtraProperties;
import com.zorbatron.zbgt.api.unification.ore.ZBGTOrePrefix;

import gregtech.api.unification.material.Material;
import gregtech.common.items.MetaItems;

public final class ZBGTMaterials {

Expand Down Expand Up @@ -52,6 +54,8 @@ public final class ZBGTMaterials {
public static Material SpecialCeramics;

public static void init() {
MetaItems.addOrePrefix(ZBGTOrePrefix.nanites);

ZBGTElementMaterials.register();
ZBGTFirstDegreeMaterials.register();
ZBGTSecondDegreeMaterials.register();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.zorbatron.zbgt.api.unification.material.info;

import gregtech.api.unification.material.info.MaterialFlag;
import gregtech.api.unification.material.properties.PropertyKey;

public class ZBGTMaterialFlags {

public static final MaterialFlag GENERATE_NANITES = new MaterialFlag.Builder("generate_nanites")
.requireProps(PropertyKey.INGOT)
.build();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.zorbatron.zbgt.api.unification.material.info;

import gregtech.api.unification.material.info.MaterialIconType;

public class ZBGTMaterialIconType {

public static final MaterialIconType nanites = new MaterialIconType("nanites");
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import com.nomiceu.nomilabs.gregtech.material.registry.LabsMaterials;
import com.zorbatron.zbgt.api.ZBGTAPI;
import com.zorbatron.zbgt.api.unification.material.info.ZBGTMaterialFlags;

import gregicality.multiblocks.api.unification.GCYMMaterials;
import gregtech.api.unification.material.Material;
Expand All @@ -36,6 +37,7 @@ public static void register() {
frameBoxes();
smallGears();
longRods();
nanites();
rotors();
plates();
gears();
Expand Down Expand Up @@ -82,6 +84,12 @@ private static void longRods() {
setFlags(materials, GENERATE_LONG_ROD);
}

private static void nanites() {
Material[] materials = { Carbon, Iron, Copper, Silver, Gold, Neutronium, Glowstone };

setFlags(materials, ZBGTMaterialFlags.GENERATE_NANITES);
}

private static void rotors() {
List<Material> materials = new ArrayList<>(Arrays.asList(TinAlloy, Aluminium, TungstenCarbide));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static void register() {
}

private static void ingots() {
Material[] materials = { Cerium };
Material[] materials = { Cerium, Carbon };

for (Material material : materials) {
material.setProperty(INGOT, new IngotProperty());
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.zorbatron.zbgt.api.unification.ore;

import static gregtech.api.unification.ore.OrePrefix.Flags.ENABLE_UNIFICATION;

import com.zorbatron.zbgt.api.unification.material.info.ZBGTMaterialFlags;
import com.zorbatron.zbgt.api.unification.material.info.ZBGTMaterialIconType;

import gregtech.api.unification.ore.OrePrefix;

public class ZBGTOrePrefix {

public static final OrePrefix nanites = new OrePrefix("nanites", -1, null, ZBGTMaterialIconType.nanites,
ENABLE_UNIFICATION, mat -> mat.hasFlag(ZBGTMaterialFlags.GENERATE_NANITES));
}
9 changes: 9 additions & 0 deletions src/main/java/com/zorbatron/zbgt/common/ZBGTConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ public static class MultiblockSettings {
"Default: true" })
@Config.Name("Megas Need Mufflers")
public boolean megasNeedMufflers = true;

@Config.RequiresMcRestart
@Config.Comment({ "What nanites should be used to control the Nano Forge tier",
"Default: gregtech:carbon, gregtech:neutronium" })
@Config.Name("Nano Forge nanite tiered materials")
public String[] nanoForgeNanites = {
"gregtech:carbon",
"gregtech:neutronium"
};
}

@Config.Name("Recipe Settings")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum CasingType implements IStringSerializable {
COMPACT_FUSION_COIL_1("compact_fusion_coil_1"),
COMPACT_FUSION_COIL_2("compact_fusion_coil_2"),
COMPACT_FUSION_COIL_3("compact_fusion_coil_3"),
COMPACT_FUSION_COIL_4("compact_fusion_coil_4");
COMPACT_FUSION_COIL_4("compact_fusion_coil_4"),
RADIANT_NAQUADAH("radiant_naquadah");

private final String name;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.zorbatron.zbgt.common.metatileentities.multi.MetaTileEntityYOTTank;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.MetaTileEntityCircuitAssemblyLine;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.MetaTileEntityCoAL;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.MetaTileEntityNanoForge;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.large.*;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.mega.*;
import com.zorbatron.zbgt.common.metatileentities.multi.electric.quad.*;
Expand Down Expand Up @@ -37,15 +38,15 @@ public class ZBGTMetaTileEntities {
public static MetaTileEntityPreciseAssembler PRASS;
public static MetaTileEntityMegaFusionReactor[] MEGA_FUSION = new MetaTileEntityMegaFusionReactor[3];

public static MetaTileEntityYOTTank YOTTANK;
public static MetaTileEntityCoAL CoAL;
public static MetaTileEntityCircuitAssemblyLine CAL;
public static MetaTileEntityNanoForge NANO_FORGE;

public static MetaTileEntityQueebf QUAD_EBF;
public static MetaTileEntityQueezer QUEEZER;
public static MetaTileEntityQuacker QUACKER;

public static MetaTileEntityYOTTank YOTTANK;

public static MetaTileEntityLargeRockBreaker LARGE_ROCK_BREAKER;
public static MetaTileEntityLargeAirCollector LARGE_AIR_COLLECTOR;
public static MetaTileEntityLargeAlloySmelter LARGE_ALLOY_SMELTER;
Expand Down Expand Up @@ -150,5 +151,11 @@ public static void init() {

CAL = registerMetaTileEntity(18070,
new MetaTileEntityCircuitAssemblyLine(zbgtId("cal")));

NANO_FORGE = registerMetaTileEntity(18071,
new MetaTileEntityNanoForge(zbgtId("nano_forge")));

// PCB Factory - 18072
// Chem Plant - 18073
}
}
Loading