Skip to content

Commit

Permalink
Implement the sterile maintenance hatch (#66)
Browse files Browse the repository at this point in the history
* Init (idk how java works so this probably won't work! )

* spotlesase

* init

* Pink/purple overlay

* Lang and casing texture funny-ness

* More lang and spoblese

* Fix weird item placement in creative tabs

* Recipe :trollface:
  • Loading branch information
Zorbatron authored Oct 17, 2024
1 parent 24be0c3 commit ae5d72e
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 0 deletions.
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 @@ -13,6 +13,7 @@ public class ZBGTTextures {
public static SimpleOverlayRenderer ITEM_OVERLAY_INFINITY;
public static SimpleOverlayRenderer SWIRLY_INFINITY;
public static SimpleOverlayRenderer YOTTANK_ME_HATCH;
public static SimpleOverlayRenderer MAINTENANCE_OVERLAY_STERILE;

// GUI overlays
public static TextureArea ITEM_FLUID_OVERLAY;
Expand Down Expand Up @@ -42,6 +43,7 @@ public static void preInit() {
ITEM_OVERLAY_INFINITY = new SimpleOverlayRenderer("overlay/machine/item_infinity");
SWIRLY_INFINITY = new SimpleOverlayRenderer("overlay/machine/swirly_infinity");
YOTTANK_ME_HATCH = new SimpleOverlayRenderer("overlay/machine/yottank_me_hatch");
MAINTENANCE_OVERLAY_STERILE = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_sterile");

ITEM_FLUID_OVERLAY = TextureArea.fullImage("textures/gui/widget/item_fluid.png");
AUTO_PULL = TextureArea.fullImage("textures/gui/widget/auto_pull.png");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class ZBGTMetaTileEntities {
public static MetaTileEntitySuperInputBus SUPER_INPUT_BUS;
public static MetaTileEntityLargeParallelHatch[] ZBGT_PARALLEL_HATCHES = new MetaTileEntityLargeParallelHatch[7];
public static MetaTileEntityYOTTankMEHatch YOTTANK_ME_HATCH;
public static MetaTileEntitySterileCleaningHatch STERILE_CLEANING_HATCH;

public static MetaTileEntityMegaEBF MEGA_EBF;
public static MetaTileEntityMegaLCR MEGA_LCR;
Expand Down Expand Up @@ -94,6 +95,9 @@ public static void init() {
YOTTANK_ME_HATCH = registerMetaTileEntity(18017,
new MetaTileEntityYOTTankMEHatch(zbgtId("yottank_me_hatch"), GTValues.IV));

STERILE_CLEANING_HATCH = registerMetaTileEntity(18018,
new MetaTileEntitySterileCleaningHatch(zbgtId("sterile_cleaning_hatch")));

// 18050-18099 (50) reserved for multiblocks
MEGA_EBF = registerMetaTileEntity(18050,
new MetaTileEntityMegaEBF(zbgtId("mega_ebf")));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
package com.zorbatron.zbgt.common.metatileentities.multi.multiblockpart;

import static gregtech.api.metatileentity.multiblock.CleanroomType.CLEANROOM;
import static gregtech.api.metatileentity.multiblock.CleanroomType.STERILE_CLEANROOM;

import java.util.List;

import net.minecraft.client.resources.I18n;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.TextFormatting;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import org.jetbrains.annotations.Nullable;

import com.zorbatron.zbgt.api.render.ZBGTTextures;
import com.zorbatron.zbgt.common.metatileentities.ZBGTMetaTileEntities;

import codechicken.lib.render.CCRenderState;
import codechicken.lib.render.pipeline.IVertexOperation;
import codechicken.lib.vec.Matrix4;
import gregtech.api.GTValues;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity;
import gregtech.api.metatileentity.multiblock.*;
import gregtech.client.renderer.ICubeRenderer;
import gregtech.client.renderer.texture.Textures;
import gregtech.common.metatileentities.multi.multiblockpart.MetaTileEntityAutoMaintenanceHatch;

public class MetaTileEntitySterileCleaningHatch extends MetaTileEntityAutoMaintenanceHatch {

private static ICleanroomProvider DUMMY_CLEANROOM;

public MetaTileEntitySterileCleaningHatch(ResourceLocation metaTileEntityId) {
super(metaTileEntityId);

DUMMY_CLEANROOM = DummyCleanroom.createForAllTypes();
}

@Override
public MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
return new MetaTileEntitySterileCleaningHatch(metaTileEntityId);
}

@Override
public void addToMultiBlock(MultiblockControllerBase controllerBase) {
super.addToMultiBlock(controllerBase);
if (controllerBase instanceof ICleanroomReceiver cleanroomReceiver &&
cleanroomReceiver.getCleanroom() == null) {
cleanroomReceiver.setCleanroom(DUMMY_CLEANROOM);
}
}

@Override
public void addInformation(ItemStack stack, @Nullable World player, List<String> tooltip, boolean advanced) {
super.addInformation(stack, player, tooltip, advanced);
tooltip.add(I18n.format("gregtech.machine.maintenance_hatch.cleanroom_auto.tooltip.2"));
tooltip.add(String.format(" %s%s", TextFormatting.GREEN, I18n.format(CLEANROOM.getTranslationKey())));
tooltip.add(String.format(" %s%s", TextFormatting.GREEN, I18n.format(STERILE_CLEANROOM.getTranslationKey())));
}

@SideOnly(Side.CLIENT)
@Override
public void renderMetaTileEntity(CCRenderState renderState, Matrix4 translation, IVertexOperation[] pipeline) {
super.renderMetaTileEntity(renderState, translation, pipeline);
if (shouldRenderOverlay()) {
ZBGTTextures.MAINTENANCE_OVERLAY_STERILE.renderSided(getFrontFacing(), renderState, translation, pipeline);
}
}

@Override
public ICubeRenderer getBaseTexture() {
MultiblockControllerBase controller = getController();
if (controller != null) {
return this.hatchTexture = controller.getBaseTexture(this);
} else if (this.hatchTexture != null) {
if (hatchTexture != Textures.getInactiveTexture(hatchTexture)) {
return this.hatchTexture = Textures.getInactiveTexture(hatchTexture);
}
return this.hatchTexture;
} else {
return Textures.VOLTAGE_CASINGS[GTValues.UHV];
}
}

@Override
public void getSubItems(CreativeTabs creativeTab, NonNullList<ItemStack> subItems) {
subItems.add(ZBGTMetaTileEntities.STERILE_CLEANING_HATCH.getStackForm());
}
}
15 changes: 15 additions & 0 deletions src/main/java/com/zorbatron/zbgt/recipe/MultiblockPartRecipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
import static gregtech.api.recipes.RecipeMaps.ASSEMBLER_RECIPES;

import com.zorbatron.zbgt.api.recipes.ZBGTRecipeMaps;
import com.zorbatron.zbgt.api.unification.material.ZBGTMaterials;
import com.zorbatron.zbgt.common.ZBGTConfig;
import com.zorbatron.zbgt.common.items.ZBGTMetaItems;
import com.zorbatron.zbgt.common.metatileentities.ZBGTMetaTileEntities;
import com.zorbatron.zbgt.recipe.helpers.RecipeAssists;

import gregicality.multiblocks.api.unification.GCYMMaterials;
import gregicality.multiblocks.common.metatileentities.GCYMMetaTileEntities;
import gregtech.api.unification.material.Materials;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.common.items.MetaItems;
import gregtech.common.metatileentities.MetaTileEntities;

public class MultiblockPartRecipes {
Expand Down Expand Up @@ -39,6 +42,18 @@ private static void misc() {
.output(ZBGTMetaTileEntities.SUPER_INPUT_BUS)
.duration(20 * 5).EUt(VA[HV])
.buildAndRegister();

ZBGTRecipeMaps.PRECISE_ASSEMBLER_RECIPES.recipeBuilder()
.input(MetaTileEntities.CLEANING_MAINTENANCE_HATCH)
.input(MetaItems.BLACKLIGHT, 8)
.input(ZBGTMetaItems.GG_CIRCUIT_3, 2)
.input(OrePrefix.rotor, Materials.NaquadahAlloy)
.fluidInputs(ZBGTMaterials.Indalloy140.getFluid(L * 4))
.fluidInputs(Materials.Lubricant.getFluid(L * 2))
.output(ZBGTMetaTileEntities.STERILE_CLEANING_HATCH)
.casingTier(2)
.EUt(VA[UHV]).duration(20 * 15)
.buildAndRegister();
}

private static void largeParallelHatches() {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"animation": {
"interpolate": true,
"frametime": 10
}
}
3 changes: 3 additions & 0 deletions src/main/resources/assets/zbgt/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ zbgt.machine.yottank_me_hatch.priority=Priority
zbgt.machine.yottank_me_hatch.sticky.enabled=Disable sticky mode
zbgt.machine.yottank_me_hatch.sticky.disabled=Enable sticky mode

zbgt.machine.sterile_cleaning_hatch.name=Automatic Sterilization Maintenance Hatch
zbgt.machine.sterile_cleaning_hatch.tooltip=For automatically maintaining Multiblocks with Cleaning, but sterile!


# Covers
metaitem.cover.dual_cover.lv.name=LV Dual Cover
Expand Down

0 comments on commit ae5d72e

Please sign in to comment.