diff options
author | GDCloud <93287602+GDCloudstrike@users.noreply.github.com> | 2024-08-22 09:02:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-22 09:02:16 +0200 |
commit | b22db6288809a012bcc7d39c768662d4198ec370 (patch) | |
tree | aea3d89be453b36abf58acb2a3295c91ea3e5d93 /src/main/java | |
parent | 4baa0d970bac9bcfb645e02f0acd274f13a8c18f (diff) | |
download | GT5-Unofficial-b22db6288809a012bcc7d39c768662d4198ec370.tar.gz GT5-Unofficial-b22db6288809a012bcc7d39c768662d4198ec370.tar.bz2 GT5-Unofficial-b22db6288809a012bcc7d39c768662d4198ec370.zip |
Add visual distinction for dimensional convergence (#2934)
* change screen texture when convergence is active
* forgor
* remove magic number
Co-authored-by: Alexander Anishin <14104815+OneEyeMaker@users.noreply.github.com>
---------
Co-authored-by: Martin Robertz <dream-master@gmx.net>
Co-authored-by: Alexander Anishin <14104815+OneEyeMaker@users.noreply.github.com>
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/gregtech/api/enums/Textures.java | 1 | ||||
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java | 38 |
2 files changed, 38 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index 618fc83c55..7aa982411f 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -583,6 +583,7 @@ public class Textures { OVERLAY_FUSION3_GLOW, OVERLAY_SCREEN, OVERLAY_SCREEN_GLOW, + OVERLAY_RAINBOWSCREEN_GLOW, OVERLAY_QTANK, OVERLAY_QTANK_GLOW, OVERLAY_QCHEST, diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java index b3ee08f179..aac668eaa4 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java +++ b/src/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_PlasmaForge.java @@ -13,6 +13,7 @@ import static gregtech.api.enums.GT_Values.VN; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DTPF_OFF; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_DTPF_ON; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FUSION1_GLOW; +import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_RAINBOWSCREEN_GLOW; import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages; import static gregtech.api.metatileentity.BaseTileEntity.TOOLTIP_DELAY; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; @@ -66,10 +67,12 @@ import gregtech.api.enums.ItemList; import gregtech.api.enums.MaterialsUEVplus; import gregtech.api.enums.SoundResource; import gregtech.api.gui.modularui.GT_UITextures; +import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.logic.ProcessingLogic; +import gregtech.api.metatileentity.GregTechTileClientEvents; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_ExtendedPowerMultiBlockBase; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy; @@ -93,6 +96,8 @@ public class GT_MetaTileEntity_PlasmaForge extends // Multiplier for the efficiency decay rate private static final double efficiency_decay_rate = 100; private static final double maximum_discount = 0.5d; + private static final int CONVERGENCE_BITMAP = 0b1; + private static final int DISCOUNT_BITMAP = 0b10; // Valid fuels which the discount will get applied to. private static final FluidStack[] valid_fuels = { MaterialsUEVplus.ExcitedDTCC.getFluid(1L), @@ -696,13 +701,17 @@ public class GT_MetaTileEntity_PlasmaForge extends @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, int colorIndex, boolean aActive, boolean redstoneLevel) { + IIconContainer glow = OVERLAY_FUSION1_GLOW; + if (convergence && discount == maximum_discount) { + glow = OVERLAY_RAINBOWSCREEN_GLOW; + } if (side == aFacing) { if (aActive) return new ITexture[] { casingTexturePages[0][DIM_BRIDGE_CASING], TextureFactory.builder() .addIcon(OVERLAY_DTPF_ON) .extFacing() .build(), TextureFactory.builder() - .addIcon(OVERLAY_FUSION1_GLOW) + .addIcon(glow) .extFacing() .glow() .build() }; @@ -795,6 +804,8 @@ public class GT_MetaTileEntity_PlasmaForge extends && overclockCalculator != null && overclockCalculator.getCalculationStatus()) { calculateCatalystIncrease(tRecipe, i, false); + getBaseMetaTileEntity() + .sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); } tRecipe.mFluidInputs[i].amount = (int) Math.round(tRecipe.mFluidInputs[i].amount * discount); adjusted = true; @@ -809,6 +820,7 @@ public class GT_MetaTileEntity_PlasmaForge extends && overclockCalculator.getCalculationStatus()) { recalculateDiscount(); calculateCatalystIncrease(tRecipe, 0, true); + getBaseMetaTileEntity().sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); } return tRecipe; } @@ -1083,6 +1095,8 @@ public class GT_MetaTileEntity_PlasmaForge extends if (convergence && (controllerStack == null || !controllerStack.isItemEqual(ItemList.Transdimensional_Alignment_Matrix.get(1)))) { convergence = false; + getBaseMetaTileEntity() + .sendBlockEvent(GregTechTileClientEvents.CHANGE_CUSTOM_DATA, getUpdateData()); } } } @@ -1106,6 +1120,28 @@ public class GT_MetaTileEntity_PlasmaForge extends return SoundResource.GT_MACHINES_PLASMAFORGE_LOOP.resourceLocation; } + @Override + public byte getUpdateData() { + byte data = 0; + if (discount == maximum_discount) { + data += DISCOUNT_BITMAP; + } + if (convergence) { + data += CONVERGENCE_BITMAP; + } + return data; + } + + @Override + public void receiveClientEvent(byte aEventID, byte aValue) { + if (aEventID == GregTechTileClientEvents.CHANGE_CUSTOM_DATA) { + convergence = (aValue & CONVERGENCE_BITMAP) == CONVERGENCE_BITMAP; + if ((aValue & DISCOUNT_BITMAP) == DISCOUNT_BITMAP) { + discount = maximum_discount; + } + } + } + private static final int CATALYST_WINDOW_ID = 10; @Override |