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

Supporting Multiblocks for Fission #2575

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package gregtech.api.capability.impl;

import gregtech.api.GTValues;
import gregtech.api.metatileentity.multiblock.RecipeMapPrimitiveMultiblockController;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.metatileentity.multiblock.RecipeMapMultiblockController;
import gregtech.api.recipes.logic.OCParams;
import gregtech.api.recipes.logic.OCResult;
import gregtech.api.recipes.recipeproperties.IRecipePropertyStorage;
Expand All @@ -12,10 +11,10 @@
/**
* Recipe Logic for a Multiblock that does not require power.
*/
public class PrimitiveRecipeLogic extends AbstractRecipeLogic {
public class PrimitiveRecipeLogic extends MultiblockRecipeLogic {

public PrimitiveRecipeLogic(RecipeMapPrimitiveMultiblockController tileEntity, RecipeMap<?> recipeMap) {
super(tileEntity, recipeMap);
public PrimitiveRecipeLogic(RecipeMapMultiblockController tileEntity) {
super(tileEntity);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,11 @@
import java.util.ArrayList;
import java.util.List;

public abstract class RecipeMapPrimitiveMultiblockController extends MultiblockWithDisplayBase {

protected PrimitiveRecipeLogic recipeMapWorkable;
public abstract class RecipeMapPrimitiveMultiblockController extends RecipeMapMultiblockController {

public RecipeMapPrimitiveMultiblockController(ResourceLocation metaTileEntityId, RecipeMap<?> recipeMap) {
super(metaTileEntityId);
this.recipeMapWorkable = new PrimitiveRecipeLogic(this, recipeMap);
super(metaTileEntityId, recipeMap);
this.recipeMapWorkable = new PrimitiveRecipeLogic(this);
initializeAbilities();
}

Expand Down
65 changes: 65 additions & 0 deletions src/main/java/gregtech/api/recipes/RecipeMaps.java
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,71 @@ public final class RecipeMaps {
.sound(GTSoundEvents.MOTOR)
.build();

/**
* Example:
*
* <pre>
* RecipeMap.HEAT_EXCHANGER_RECIPES.recipeBuilder()
* .circuitMeta(1)
* .fluidInputs(DistilledWater.getFluid(1000), HotHighPressureSteam.getFluid(100))
* .fluidOutputs(Steam.getFluid(96000), DistilledWater.getFluid(100))
* .duration(1)
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<PrimitiveRecipeBuilder> HEAT_EXCHANGER_RECIPES = new RecipeMapBuilder<>(
"heat_exchanger",
new PrimitiveRecipeBuilder())
.itemInputs(1)
.fluidInputs(2)
.fluidOutputs(2)
.progressBar(GuiTextures.PROGRESS_BAR_ARROW_MULTIPLE, MoveType.HORIZONTAL)
.sound(GTSoundEvents.COOLING)
.build();

/**
* Example:
*
* <pre>
* RecipeMap.SPENT_FUEL_POOL_RECIPES.recipeBuilder()
* .input(OrePrefix.fuelRodHotDepleted, Materials.LEU235)
* .output(OrePrefix.fuelRodDepleted, Materials.LEU235)
* .duration(1000)
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> SPENT_FUEL_POOL_RECIPES = new RecipeMapBuilder<>(
"spent_fuel_pool",
new SimpleRecipeBuilder())
.itemInputs(1)
.itemOutputs(1)
.fluidInputs(1)
.fluidOutputs(1)
.progressBar(GuiTextures.PROGRESS_BAR_BATH, MoveType.HORIZONTAL)
.build();

/**
* Example:
*
* <pre>
* GAS_CENTRIFUGE_RECIPES.recipeBuilder().duration(800).EUt(VA[HV])
* .fluidInputs(UraniumHexafluoride.getFluid(1000))
* .fluidOutputs(LowEnrichedUraniumHexafluoride.getFluid(100))
* .fluidOutputs(DepletedUraniumHexafluoride.getFluid(900))
* .buildAndRegister();
* </pre>
*/
@ZenProperty
public static final RecipeMap<SimpleRecipeBuilder> GAS_CENTRIFUGE_RECIPES = new RecipeMapBuilder<>("gas_centrifuge",
new SimpleRecipeBuilder())
.fluidInputs(1)
.fluidOutputs(2)
.progressBar(GuiTextures.PROGRESS_BAR_MIXER, MoveType.CIRCULAR)
.sound(GTSoundEvents.CENTRIFUGE)
.build();

//////////////////////////////////////
// Fuel Recipe Maps //
//////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,12 @@ public class Textures {
"multiblock/network_switch");
public static final OrientedOverlayRenderer POWER_SUBSTATION_OVERLAY = new OrientedOverlayRenderer(
"multiblock/power_substation");
public static final OrientedOverlayRenderer SPENT_FUEL_POOL_OVERLAY = new OrientedOverlayRenderer(
"multiblock/spent_fuel_pool");
public static final OrientedOverlayRenderer HEAT_EXCHANGER_OVERLAY = new OrientedOverlayRenderer(
"multiblock/heat_exchanger");
public static final OrientedOverlayRenderer GAS_CENTRIFUGE_OVERLAY = new OrientedOverlayRenderer(
"multiblock/gas_centrifuge");

public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer(
"machines/alloy_smelter");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/gregtech/common/CommonProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public static void registerBlocks(RegistryEvent.Register<Block> event) {
registry.register(CLEANROOM_CASING);
registry.register(COMPUTER_CASING);
registry.register(BATTERY_BLOCK);
registry.register(NUCLEAR_CASING);
registry.register(FOAM);
registry.register(REINFORCED_FOAM);
registry.register(PETRIFIED_FOAM);
Expand Down Expand Up @@ -174,6 +175,7 @@ public static void registerBlocks(RegistryEvent.Register<Block> event) {
registry.register(METAL_SHEET);
registry.register(LARGE_METAL_SHEET);
registry.register(STUDS);
registry.register(PANELLING);

for (BlockLamp block : LAMPS.values()) registry.register(block);
for (BlockLamp block : BORDERLESS_LAMPS.values()) registry.register(block);
Expand Down Expand Up @@ -278,6 +280,8 @@ public static void registerItems(RegistryEvent.Register<Item> event) {
registry.register(createItemBlock(block, LampItemBlock::new));
}
registry.register(createItemBlock(ASPHALT, VariantItemBlock::new));
registry.register(createItemBlock(NUCLEAR_CASING, VariantItemBlock::new));
registry.register(createItemBlock(PANELLING, VariantItemBlock::new));
for (StoneVariantBlock block : STONE_BLOCKS.values()) {
registry.register(createItemBlock(block, VariantItemBlock::new));
}
Expand Down
54 changes: 54 additions & 0 deletions src/main/java/gregtech/common/blocks/BlockNuclearCasing.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package gregtech.common.blocks;

import gregtech.api.block.IStateHarvestLevel;
import gregtech.api.block.VariantActiveBlock;

import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.IStringSerializable;

import org.jetbrains.annotations.NotNull;

public class BlockNuclearCasing extends VariantActiveBlock<BlockNuclearCasing.NuclearCasingType> {

public BlockNuclearCasing() {
super(Material.IRON);
setTranslationKey("nuclear_casing");
setHardness(5.0f);
setResistance(10.0f);
setSoundType(SoundType.METAL);
setDefaultState(getState(NuclearCasingType.SPENT_FUEL_CASING));
}

@Override
public boolean isOpaqueCube(IBlockState state) {
return state != getState(NuclearCasingType.GAS_CENTRIFUGE_COLUMN);
}

public enum NuclearCasingType implements IStringSerializable, IStateHarvestLevel {

SPENT_FUEL_CASING("spent_fuel_casing", 2),
GAS_CENTRIFUGE_HEATER("gas_centrifuge_heater", 1),
GAS_CENTRIFUGE_COLUMN("gas_centrifuge_column", 2);

NuclearCasingType(String name, int harvestLevel) {
this.name = name;
this.harvestLevel = harvestLevel;
}

private final String name;
private final int harvestLevel;

@NotNull
@Override
public String getName() {
return this.name;
}

@Override
public int getHarvestLevel(IBlockState state) {
return this.harvestLevel;
}
}
}
50 changes: 50 additions & 0 deletions src/main/java/gregtech/common/blocks/BlockPanelling.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package gregtech.common.blocks;

import gregtech.api.block.VariantBlock;

import net.minecraft.block.SoundType;
import net.minecraft.util.IStringSerializable;

public class BlockPanelling extends VariantBlock<BlockPanelling.PanellingType> {
bruberu marked this conversation as resolved.
Show resolved Hide resolved

public BlockPanelling() {
super(net.minecraft.block.material.Material.IRON);
setTranslationKey("panelling");
setHardness(2.0f);
setResistance(5.0f);
setSoundType(SoundType.METAL);
setHarvestLevel("wrench", 2);
setDefaultState(getState(PanellingType.WHITE));
}

public enum PanellingType implements IStringSerializable {

WHITE("white"),
ORANGE("orange"),
MAGENTA("magenta"),
LIGHT_BLUE("light_blue"),
YELLOW("yellow"),
LIME("lime"),
PINK("pink"),
GRAY("gray"),
LIGHT_GRAY("light_gray"),
CYAN("cyan"),
PURPLE("purple"),
BLUE("blue"),
BROWN("brown"),
GREEN("green"),
RED("red"),
BLACK("black");

private final String name;

PanellingType(String name) {
this.name = name;
}

@Override
public String getName() {
return this.name;
}
}
}
8 changes: 8 additions & 0 deletions src/main/java/gregtech/common/blocks/MetaBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ private MetaBlocks() {}
public static BlockCleanroomCasing CLEANROOM_CASING;
public static BlockComputerCasing COMPUTER_CASING;
public static BlockBatteryPart BATTERY_BLOCK;
public static BlockNuclearCasing NUCLEAR_CASING;

public static final EnumMap<EnumDyeColor, BlockLamp> LAMPS = new EnumMap<>(EnumDyeColor.class);
public static final EnumMap<EnumDyeColor, BlockLamp> BORDERLESS_LAMPS = new EnumMap<>(EnumDyeColor.class);
Expand Down Expand Up @@ -174,6 +175,7 @@ private MetaBlocks() {}
public static BlockColored METAL_SHEET;
public static BlockColored LARGE_METAL_SHEET;
public static BlockColored STUDS;
public static BlockPanelling PANELLING;

public static final Map<Material, BlockCompressed> COMPRESSED = new Object2ObjectOpenHashMap<>();
public static final Map<Material, BlockFrame> FRAMES = new Object2ObjectOpenHashMap<>();
Expand Down Expand Up @@ -263,6 +265,8 @@ public static void init() {
COMPUTER_CASING.setRegistryName("computer_casing");
BATTERY_BLOCK = new BlockBatteryPart();
BATTERY_BLOCK.setRegistryName("battery_block");
NUCLEAR_CASING = new BlockNuclearCasing();
NUCLEAR_CASING.setRegistryName("nuclear_casing");

for (EnumDyeColor color : EnumDyeColor.values()) {
BlockLamp block = new BlockLamp(color);
Expand Down Expand Up @@ -336,6 +340,8 @@ public static void init() {
STUDS = new BlockColored(net.minecraft.block.material.Material.CARPET, "studs", 1.5f, 2.5f, SoundType.CLOTH,
EnumDyeColor.BLACK);
STUDS.setRegistryName("studs");
PANELLING = new BlockPanelling();
PANELLING.setRegistryName("panelling");

createGeneratedBlock(m -> m.hasProperty(PropertyKey.DUST) && m.hasFlag(GENERATE_FRAME),
MetaBlocks::createFrameBlock);
Expand Down Expand Up @@ -469,6 +475,7 @@ public static void registerItemModels() {
registerItemModel(COMPUTER_CASING);
registerItemModel(BATTERY_BLOCK);
registerItemModel(ASPHALT);
registerItemModel(PANELLING);
for (StoneVariantBlock block : STONE_BLOCKS.values())
registerItemModel(block);
registerItemModelWithOverride(RUBBER_LOG, ImmutableMap.of(BlockLog.LOG_AXIS, EnumAxis.Y));
Expand Down Expand Up @@ -507,6 +514,7 @@ public static void registerItemModels() {
FUSION_CASING.onModelRegister();
MULTIBLOCK_CASING.onModelRegister();
TRANSPARENT_CASING.onModelRegister();
NUCLEAR_CASING.onModelRegister();

for (BlockLamp lamp : LAMPS.values()) lamp.onModelRegister();
for (BlockLamp lamp : BORDERLESS_LAMPS.values()) lamp.onModelRegister();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import gregtech.common.metatileentities.multi.electric.MetaTileEntityElectricBlastFurnace;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityFluidDrill;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityFusionReactor;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityGasCentrifuge;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityHPCA;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityImplosionCompressor;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityLargeChemicalReactor;
Expand All @@ -67,6 +68,7 @@
import gregtech.common.metatileentities.multi.electric.MetaTileEntityProcessingArray;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityPyrolyseOven;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityResearchStation;
import gregtech.common.metatileentities.multi.electric.MetaTileEntitySpentFuelPool;
import gregtech.common.metatileentities.multi.electric.MetaTileEntityVacuumFreezer;
import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityCentralMonitor;
import gregtech.common.metatileentities.multi.electric.centralmonitor.MetaTileEntityMonitorScreen;
Expand Down Expand Up @@ -332,6 +334,9 @@ public class MetaTileEntities {
public static MetaTileEntityNetworkSwitch NETWORK_SWITCH;
public static MetaTileEntityPowerSubstation POWER_SUBSTATION;
public static MetaTileEntityActiveTransformer ACTIVE_TRANSFORMER;
public static MetaTileEntityHeatExchanger HEAT_EXCHANGER;
public static MetaTileEntitySpentFuelPool SPENT_FUEL_POOL;
public static MetaTileEntityGasCentrifuge GAS_CENTRIFUGE;

// STORAGE SECTION
public static MetaTileEntityTankValve WOODEN_TANK_VALVE;
Expand Down Expand Up @@ -774,6 +779,10 @@ public static void init() {
ACTIVE_TRANSFORMER = registerMetaTileEntity(1042,
new MetaTileEntityActiveTransformer(gregtechId("active_transformer")));

SPENT_FUEL_POOL = registerMetaTileEntity(1044, new MetaTileEntitySpentFuelPool(gregtechId("spent_fuel_pool")));
HEAT_EXCHANGER = registerMetaTileEntity(1045, new MetaTileEntityHeatExchanger(gregtechId("heat_exchanger")));
GAS_CENTRIFUGE = registerMetaTileEntity(1046, new MetaTileEntityGasCentrifuge(gregtechId("gas_centrifuge")));

// MISC MTE's START: IDs 1150-2000

// Import/Export Buses/Hatches, IDs 1150-1209
Expand Down
Loading