aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
authorMary <33456283+FourIsTheNumber@users.noreply.github.com>2024-07-18 09:58:41 -0400
committerGitHub <noreply@github.com>2024-07-18 20:58:41 +0700
commite3a650785887866e4b8533b61044479ecb80aee7 (patch)
treea5dcc2993f3f234f93e5891286d18fdc426070b4 /src/main/java/gregtech/api/metatileentity
parentdcc8dac94e6d5a5561cf8bf38fc7f87e222b40e3 (diff)
downloadGT5-Unofficial-e3a650785887866e4b8533b61044479ecb80aee7.tar.gz
GT5-Unofficial-e3a650785887866e4b8533b61044479ecb80aee7.tar.bz2
GT5-Unofficial-e3a650785887866e4b8533b61044479ecb80aee7.zip
Add a Multiblock Electromagnetic Separator (#2726)
* Built multi template with required methods in gt++. * Filled out template based on gt++ electrolyzer code * Refactored into gregtech. Not supposed to add multis to gt++, whoops! * IntelliJ "smartly" deleted all of the imports in GT_Loader_MetaTileEntities and replaced it with a wildcard import... which caused it to fail checkstyle. Thanks so much, IntelliJ. * Figured out how to make IntelliJ Stop Doing That * Added author tag and vac freezer texture for testing. * Registered casing, working on getting texture functional * Added casing texture * Fixed structure check and added processing logic. Multi now forms and can run EMS recipes * Added overlay textures * Made new Casings10 class and added EMS Casings to it. Texture mesh now functions * Made controller match casing mesh * Shifted Casings10 to an actual page number instead of magic number. Now sits on page 16, following where waterline casings will be implemented in future * Added Electromagnet Housing. Has no texture, but you can place an open its inventory * Added electromagnets and their texture files * Multi now requires EM housing and breaks if there are 2 * Electromagnet Housing has proper texture and can be wrenched. Also has a placeholder overlay * Tooltip updates. Added pollution * Electromagnet tiers modify processing logic. Some issues remaining * Prettier switch & spotlessApply * Multi now validates electromagnet before recipe check. Also added a machine casing texture * Pollution fix * Support for exotic energy hatches added. Recipe check fails if electromagnet is too weak * Stack size of 1 for electromagnets * New electromagnet textures * Final pass on EM textures. Also, EM Housing uses IV hull as base texture instead of ULV * Put in placeholder-ish recipes for controller/casings/EM housing * Placeholder recipes for electromagnets. Also fixed structure check, whoops * Renamed multi to Magnetic Flux Exhibitor * MFE can run as a polarizer * Fixed exotic warning getting stuck * Attempted to add assline recipes, not working * Fixed assembling line recipe templates. Thank you chochem <3 * Fancied up tooltips * Fixed parallel issue * Updated recipes. Will have to move them to coremod * Nerfed speed on all electromagnets * sa * Restricted MFE to multiamp non-laser. * Spotless * Animated Mag hatch * Added glow * Removed pollution. I am a gentle soul * Addition to structure check * Disabled wireless laser compatibility * sa (cherry picked from commit 155cf4dd7284ca84bd9be79f11b6f577b38a4e0d) * spotless * Removed all recipes. These have been replaced in the coremod * -Removed unnecessary structure check -MIN_CASING final -Baps author tag -Refactored mMagHatch to not be a list -Added tooltip builder in MagnetTiers * Forgot to run spotless * Last minute tooltip fix for structure accuracy --------- Co-authored-by: Dream Master <dream-master@gmx.net>
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MagHatch.java108
1 files changed, 108 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MagHatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MagHatch.java
new file mode 100644
index 0000000000..9000d63ba5
--- /dev/null
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MagHatch.java
@@ -0,0 +1,108 @@
+package gregtech.api.metatileentity.implementations;
+
+import static gregtech.api.enums.GT_Values.AuthorFourIsTheNumber;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_EMS_HOUSING;
+import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_EMS_HOUSING_GLOW;
+
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import org.apache.commons.lang3.ArrayUtils;
+
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+import com.gtnewhorizons.modularui.common.widget.SlotWidget;
+
+import gregtech.api.gui.modularui.GT_UIInfos;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.render.TextureFactory;
+import gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_IndustrialElectromagneticSeparator;
+
+public class GT_MetaTileEntity_MagHatch extends GT_MetaTileEntity_Hatch {
+
+ public GT_MetaTileEntity_MagHatch(int aID, String aName, String aNameRegional) {
+ super(aID, aName, aNameRegional, 5, 1, "Holds electromagnet for the Magnetic Flux Exhibitor");
+ }
+
+ public GT_MetaTileEntity_MagHatch(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 1, aDescription[0], aTextures);
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(ForgeDirection facing) {
+ return true;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return ArrayUtils.addAll(this.mDescriptionArray, AuthorFourIsTheNumber);
+ }
+
+ @Override
+ public boolean useModularUI() {
+ return true;
+ }
+
+ @Override
+ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ builder.widget(
+ new SlotWidget(inventoryHandler, 0)
+ .setFilter(GT_MetaTileEntity_IndustrialElectromagneticSeparator::isValidElectromagnet)
+ .setAccess(true, true)
+ .setPos(79, 34));
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ GT_UIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
+ return true;
+ }
+
+ @Override
+ public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ return new ITexture[] { aBaseTexture, TextureFactory.builder()
+ .addIcon(OVERLAY_EMS_HOUSING)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_EMS_HOUSING_GLOW)
+ .extFacing()
+ .glow()
+ .build() };
+ }
+
+ @Override
+ public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ return new ITexture[] { aBaseTexture, TextureFactory.builder()
+ .addIcon(OVERLAY_EMS_HOUSING)
+ .extFacing()
+ .build(),
+ TextureFactory.builder()
+ .addIcon(OVERLAY_EMS_HOUSING_GLOW)
+ .extFacing()
+ .glow()
+ .build() };
+ }
+
+ @Override
+ public int getInventoryStackLimit() {
+ return 1;
+ }
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaTileEntity_MagHatch(mName, mTier, mDescriptionArray, mTextures);
+ }
+}