Skip to content

Commit

Permalink
Add NC hatches for PCB Factory and QFT (#3737)
Browse files Browse the repository at this point in the history
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 12, 2025
1 parent b1e6718 commit fb18c4e
Show file tree
Hide file tree
Showing 20 changed files with 944 additions and 48 deletions.
2 changes: 2 additions & 0 deletions src/main/java/gregtech/GTMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.internal.IGTMod;
import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.implementations.MTEHatchNonConsumableBase;
import gregtech.api.objects.ItemData;
import gregtech.api.objects.XSTR;
import gregtech.api.registries.LHECoolantRegistry;
Expand Down Expand Up @@ -513,6 +514,7 @@ public void onPostLoad(FMLPostInitializationEvent aEvent) {
GTForestryCompat.transferSqueezerRecipes();
}
MTEDigitalChestBase.registerAEIntegration();
MTEHatchNonConsumableBase.registerAEIntegration();
ItemStack facade = AEApi.instance()
.definitions()
.items()
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/gregtech/api/enums/ItemList.java
Original file line number Diff line number Diff line change
Expand Up @@ -2600,9 +2600,12 @@ public enum ItemList implements IItemContainer {
Casing_AirFilter_Vent_T3,
Casing_Pyrolyse,
NameRemover,
Hatch_Nanite,
Hatch_Catalyst_Bulk,
Machine_Multi_AirFilterT1,
Machine_Multi_AirFilterT2,
Machine_Multi_AirFilterT3,

// semicolon after the comment to reduce merge conflicts
;

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gregtech/api/enums/MetaTileEntityIDs.java
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,8 @@ public enum MetaTileEntityIDs {
PURIFICATION_UNIT_DEGASIFIER(9412),
HATCH_DEGASIFIER_CONTROL(9413),
PURIFICATION_UNIT_PARTICLE_EXTRACTOR(9414),
HATCH_NANITE(9415),
HATCH_CATALYST_BULK(9416),
PLASMA_GENERATOR_ZPM(10752),
PLASMA_GENERATOR_UV(10753),
ALLOY_SMELTER_LuV(10760),
Expand Down
7 changes: 6 additions & 1 deletion src/main/java/gregtech/api/enums/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,12 @@ public enum BlockIcons implements IIconContainer, Runnable {
NEUTRONIUM_STABLE_CASING,
EXTREME_DENSITY_CASING,
RADIATION_ABSORBENT_CASING,
HAWKING_GLASS;
HAWKING_GLASS,
OVERLAY_NANITE_HATCH,
OVERLAY_NANITE_HATCH_GLOW

// semicolon after the comment to reduce merge conflicts
;

/**
* Icon for Fresh CFoam
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package gregtech.api.metatileentity.implementations;

import net.minecraft.item.ItemStack;

import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.render.TextureFactory;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;

public class MTEHatchBulkCatalystHousing extends MTEHatchNonConsumableBase {

private int catalystCapacity = 0;

public MTEHatchBulkCatalystHousing(int ID, String name, String nameRegional, int tier, int itemCapacity) {
super(ID, name, nameRegional, tier, "Dedicated Catalyst Storage");
catalystCapacity = itemCapacity;
}

public MTEHatchBulkCatalystHousing(String name, String[] description, ITexture[][][] textures, int tier,
int itemCapacity) {
super(name, tier, description, textures);
catalystCapacity = itemCapacity;
}

@Override
protected int getItemCapacity() {
return catalystCapacity;
}

public int getStoredCatalystMeta() {
if (getItemStack() == null) return -1;
return getItemStack().getItemDamage();
}

@Override
protected boolean isValidItem(ItemStack item) {
return ItemUtils.isCatalyst(item);
}

@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.builder()
.addIcon(TexturesGtBlock.Overlay_Bus_Catalyst)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(TexturesGtBlock.Overlay_Bus_Catalyst)
.extFacing()
.glow()
.build() };
}

@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.builder()
.addIcon(TexturesGtBlock.Overlay_Bus_Catalyst)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(TexturesGtBlock.Overlay_Bus_Catalyst)
.extFacing()
.glow()
.build() };
}

@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEHatchBulkCatalystHousing(mName, mDescriptionArray, mTextures, mTier, catalystCapacity);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
package gregtech.api.metatileentity.implementations;

import net.minecraft.item.ItemStack;

import gregtech.api.enums.Materials;
import gregtech.api.enums.OrePrefixes;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.objects.ItemData;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTOreDictUnificator;

public class MTEHatchNanite extends MTEHatchNonConsumableBase {

private int naniteCapacity = 0;

public MTEHatchNanite(int ID, String name, String nameRegional, int tier, int itemCapacity) {
super(ID, name, nameRegional, tier, "Holds nanites for use in multiblocks");
naniteCapacity = itemCapacity;
}

public MTEHatchNanite(String name, String[] description, ITexture[][][] textures, int tier, int itemCapacity) {
super(name, tier, description, textures);
naniteCapacity = itemCapacity;
}

@Override
protected int getItemCapacity() {
return naniteCapacity;
}

public Materials getStoredNaniteMaterial() {
if (getItemStack() == null) return null;
ItemData data = GTOreDictUnificator.getAssociation(getItemStack());
if (data == null) return null;
return data.mMaterial.mMaterial;
}

@Override
protected boolean isValidItem(ItemStack item) {
ItemData data = GTOreDictUnificator.getAssociation(item);
if (data == null) {
return false;
}
OrePrefixes prefix = data.mPrefix;
return prefix == OrePrefixes.nanite;
}

@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.builder()
.addIcon(Textures.BlockIcons.OVERLAY_NANITE_HATCH)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(Textures.BlockIcons.OVERLAY_NANITE_HATCH_GLOW)
.extFacing()
.glow()
.build() };
}

@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
return new ITexture[] { aBaseTexture, TextureFactory.builder()
.addIcon(Textures.BlockIcons.OVERLAY_NANITE_HATCH)
.extFacing()
.build(),
TextureFactory.builder()
.addIcon(Textures.BlockIcons.OVERLAY_NANITE_HATCH_GLOW)
.extFacing()
.glow()
.build() };
}

@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
return new MTEHatchNanite(mName, mDescriptionArray, mTextures, mTier, naniteCapacity);
}
}
Loading

0 comments on commit fb18c4e

Please sign in to comment.