Skip to content

Commit

Permalink
Merge branch 'dev-1.16' into 1.16
Browse files Browse the repository at this point in the history
  • Loading branch information
rlnt committed Oct 4, 2021
2 parents f0db546 + 8ba6e2c commit 3067a07
Show file tree
Hide file tree
Showing 28 changed files with 326 additions and 132 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ env:
NODE_VERSION: 16.8.0
PNPM_VERSION: 6.15.1
JAVA_VERSION: 11
JAR_NAME: 'energymeter'
FILE_NAME: 'EnergyMeter'

jobs:
check:
Expand Down Expand Up @@ -136,20 +138,19 @@ jobs:
run: ./gradlew jar --no-daemon

- name: Find the jar
run: echo "JAR_FILE=$(find build/libs/energymeter-*-*.jar)" >> $GITHUB_ENV
run: echo "JAR_FILE=$(find build/libs/${{ env.JAR_NAME }}-*-*.jar)" >> $GITHUB_ENV

- name: Extract Minecraft and Mod Version
run: echo ${JAR_FILE%.*} | awk -F- '{ print "MINECRAFT_VERSION=" $2; print "MOD_VERSION=" $3; }' >> $GITHUB_ENV

- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: EnergyMeter-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar
name: ${{ env.FILE_NAME }}-${{ env.MINECRAFT_VERSION }}-${{ env.MOD_VERSION }}.jar
path: ${{ env.JAR_FILE }}

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand All @@ -159,3 +160,4 @@ jobs:
run: ./gradlew curseforge
env:
CF_API_KEY: ${{ secrets.CF_API_KEY }}
FILE_NAME: ${{ env.FILE_NAME }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ gradle-app.setting
.classpath

# project specific
.idea/modules
.idea/discord.xml
src/generated
src/test
2 changes: 1 addition & 1 deletion .idea/runConfigurations/runClient.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/runData.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/runConfigurations/runServer.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/watcherTasks.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ node_modules
**/*.md

# compiled files
out
build

# run files
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,24 @@ and this project adheres to [Semantic Versioning].
- /


## [1.0.4] - 2021-10-04

### Changed
- increased performance a lot
- increased the render distance of the Meter screen to 30 blocks (20 previous)
- drastically decreased the network traffic from the mod
- switched to client packet syncing
- ensured packets are only sent to the right logical side
- ensured that the facing side of the block is properly stored in the side configuration
- code cleanup

### Fixed
- fixed none-gamebreaking array out of bounds exception on world load

### Removed
- removed unnecessary exception throws


## [1.0.3] - 2021-09-30

### Changed
Expand Down Expand Up @@ -42,7 +60,8 @@ and this project adheres to [Semantic Versioning].
[semantic versioning]: https://semver.org/spec/v2.0.0.html

<!-- Versions -->
[unreleased]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.3...HEAD
[unreleased]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.4...HEAD
[1.0.4]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.3..v1.16-1.0.4
[1.0.3]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.2..v1.16-1.0.3
[1.0.2]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.1..v1.16-1.0.2
[1.0.1]: https://github.com/RLNT/minecraft_energymeter/compare/v1.16-1.0.0..v1.16-1.0.1
Expand Down
50 changes: 29 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ buildscript {
}

plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id "org.sonarqube" version "3.2.0"
id "com.matthewprenger.cursegradle" version "1.4.0"
id "org.sonarqube" version "3.2.0"
}

apply plugin: 'net.minecraftforge.gradle'
Expand All @@ -21,11 +21,11 @@ apply plugin: 'eclipse'
apply plugin: 'maven-publish'

sonarqube {
properties {
property "sonar.projectKey", "RLNT_minecraft_energymeter"
property "sonar.organization", "rlnt"
property "sonar.host.url", "https://sonarcloud.io"
}
properties {
property "sonar.projectKey", "RLNT_minecraft_energymeter"
property "sonar.organization", "rlnt"
property "sonar.host.url", "https://sonarcloud.io"
}
}

version = "${minecraft_version}-${mod_version}"
Expand Down Expand Up @@ -109,10 +109,18 @@ dependencies {
// It copies them into the targets and expands all the defined properties.
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def intoTargets = ["$rootDir/out/production/resources/", "$rootDir/out/production/${project.name}.main/", "$rootDir/bin/main/"]
def replaceProperties = [mod_id: mod_id, mod_name: mod_name, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description,
minecraft_version_range: minecraft_version_range, forge_version_range: forge_version_range,
loader_version_range: loader_version_range, github_user: github_user, github_repo: github_repo]
def replaceProperties = [
mod_id : mod_id,
mod_name : mod_name,
mod_version : mod_version,
mod_authors : mod_authors,
mod_description : mod_description,
minecraft_version_range: minecraft_version_range,
forge_version_range : forge_version_range,
loader_version_range : loader_version_range,
github_user : github_user,
github_repo : github_repo
]
processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project
Expand All @@ -137,13 +145,13 @@ processResources {
jar {
manifest {
attributes([
"Specification-Title": mod_id,
"Specification-Vendor": mod_authors,
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": mod_version,
"Implementation-Vendor": mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : mod_version,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}
Expand All @@ -157,14 +165,14 @@ curseforge {
apiKey = "none"
}
project {
id = '532169'
id = project_id
changelogType = 'markdown'
changelog = 'The whole changelog can be found [here](https://github.com/RLNT/minecraft_energymeter/blob/1.16/CHANGELOG.md).'
changelog = "The whole changelog can be found [here](https://github.com/${github_user}/${github_repo}/blob/1.16/CHANGELOG.md)."
releaseType = 'release'
addGameVersion minecraft_version

mainArtifact(jar) {
displayName = "EnergyMeter-${minecraft_version}-${mod_version}"
displayName = "${System.getenv('FILE_NAME')}-${minecraft_version}-${mod_version}"
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ mappings_version=2021.08.29-1.16.5
# mod info
mod_id=energymeter
mod_name=Energy Meter
mod_version=1.0.3
mod_version=1.0.4
mod_base_package=dev.rlnt
mod_authors=RLNT, Relentless
mod_description=Easily measure your energy rates.
# extra info
github_user=RLNT
github_repo=minecraft_energymeter
project_id=532169
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class MeterRenderer extends TileEntityRenderer<MeterTile> {
private static final float[] ANGLE = { 0, 0, 0, 180, 90, -90 };
private static final float PIXEL_SIZE = .3f / 16;
private static final float OFFSET = 0.001f;
private static final int MAX_DISTANCE = 20;
private static final int MAX_DISTANCE = 30;
private final Minecraft mc;
private final FontRenderer font;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,21 @@ public void renderButton(final MatrixStack matrix, final int mX, final int mY, f
/**
* Gets the texture file name for the button as {@link String}.
* The default location points to "textures/gui/buttons".
*
* @return the texture file name
*/
protected abstract String getTexture();

/**
* Gets the texture atlas width for the rendering calls.
*
* @return the texture atlas width
*/
protected abstract int getTextureWidth();

/**
* Gets the texture atlas height for the rendering calls.
*
* @return the texture atlas height
*/
protected abstract int getTextureHeight();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/dev/rlnt/energymeter/client/gui/IOButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ private IOButton(final ContainerScreen<?> screen, final BLOCK_SIDE side) {

/**
* Creates an {@link IOButton} for each passed in {@link BLOCK_SIDE}.
*
* @param sides the sides for which the buttons should be created
* @return a list of all buttons created
*/
Expand All @@ -66,6 +67,7 @@ static List<IOButton> create(final ContainerScreen<?> screen, final BLOCK_SIDE..

/**
* Returns the x and y positions for the texture depending on the {@link BLOCK_SIDE}.
*
* @param side the BLOCK_SIDE to get the positions for
* @return the x and y position for the BLOCK_SIDE
*/
Expand Down Expand Up @@ -182,6 +184,7 @@ private void syncSideConfig() {

/**
* Renders the I/O overlay for the {@link IOButton} depending on its {@link IO_SETTING}.
*
* @param matrix the matrix stack for the render call
*/
private void renderIOOverlay(final MatrixStack matrix) {
Expand All @@ -201,6 +204,7 @@ private void renderIOOverlay(final MatrixStack matrix) {

/**
* Changes the mode of a {@link BLOCK_SIDE} depending on its current {@link IO_SETTING}.
*
* @param reset whether the field should be reset to OFF
*/
private void changeMode(final boolean reset) {
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/dev/rlnt/energymeter/client/gui/MeterScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public MeterScreen(final MeterContainer container, final PlayerInventory invento

/**
* Gets the {@link ITextComponent} for the "click to change mode" text in the tooltips.
*
* @return the click to change mode tooltip
*/
static ITextComponent getClickTooltip() {
Expand Down Expand Up @@ -156,6 +157,7 @@ protected void renderBg(final MatrixStack matrix, final float partial, final int

/**
* Gets a {@link String} representation of the current connection status.
*
* @return the current connection status
*/
private String getConnectionString() {
Expand All @@ -165,6 +167,7 @@ private String getConnectionString() {

/**
* Gets a color representing the current connection status.
*
* @return the color of the current connection status
*/
private TextFormatting getConnectionColor() {
Expand All @@ -185,6 +188,7 @@ private TextFormatting getConnectionColor() {

/**
* Gets a color representing the current consumer mode.
*
* @return the color of the current consumer mode
*/
private TextFormatting getConsumerColor() {
Expand All @@ -193,8 +197,9 @@ private TextFormatting getConsumerColor() {

/**
* Convenience method to add multiple buttons at once.
*
* @param buttons the list of buttons to add
* @param <T> the button class
* @param <T> the button class
*/
private <T extends Widget> void addButtons(final List<T> buttons) {
for (final T button : buttons) {
Expand All @@ -204,11 +209,12 @@ private <T extends Widget> void addButtons(final List<T> buttons) {

/**
* Checks if the mouse cursor is within a specified region.
* @param mX mouse position on the x-axis
* @param mY mouse position on the y-axis
* @param pX left position on the x-axis
* @param widht width to calculate the boundary on the x-axis
* @param pY top position on the y-axis
*
* @param mX mouse position on the x-axis
* @param mY mouse position on the y-axis
* @param pX left position on the x-axis
* @param widht width to calculate the boundary on the x-axis
* @param pY top position on the y-axis
* @param height height to calculate the boundary on the y-axis
* @return true if the curser is within the region, false otherwise
*/
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/dev/rlnt/energymeter/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ public class Constants {
public static final String IO_MODE_ID = "io_mode";
public static final String IO_SCREEN_ID = "screen";

private Constants() {
throw new IllegalStateException("Utility class");
}
private Constants() {}
}
Loading

0 comments on commit 3067a07

Please sign in to comment.