forked from GregTechCEu/GregTech
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chemical Structure Material Texture (#14)
- Loading branch information
Showing
4 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/gregtech/api/unification/material/properties/ChemicalStructureProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package gregtech.api.unification.material.properties; | ||
|
||
import gregtech.api.gui.resources.TextureArea; | ||
import gregtech.api.gui.widgets.ImageWidget; | ||
import gregtech.api.unification.material.Material; | ||
|
||
import com.github.bsideup.jabel.Desugar; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
@Desugar | ||
public record ChemicalStructureProperty(int textureHeight, int textureWidth) implements IMaterialProperty { | ||
|
||
@Override | ||
public void verifyProperty(MaterialProperties properties) { | ||
properties.ensureSet(PropertyKey.CHEMICAL_STRUCTURE, true); | ||
} | ||
|
||
@NotNull | ||
public static TextureArea getMoleculeTexture(Material material) { | ||
return TextureArea.fullImage( | ||
String.format("textures/chemicalstructure/%s.png", material.getResourceLocation().getPath())); | ||
} | ||
|
||
@NotNull | ||
public static ImageWidget getChemicalStructureWidget(Material material, int x, int y, int height, int width) { | ||
TextureArea tx = getMoleculeTexture(material); | ||
return new ImageWidget(x, y, width, height, tx); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.