Skip to content
This repository has been archived by the owner on Jun 26, 2024. It is now read-only.

Commit

Permalink
LambDynamicLights 2.0.1: Cleanup and updated SpruceUI.
Browse files Browse the repository at this point in the history
  • Loading branch information
LambdAurora committed Jun 12, 2021
1 parent ec2e10e commit 7118520
Show file tree
Hide file tree
Showing 14 changed files with 87 additions and 31 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/gradlepublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Gradle Package

on:
push:
tags:
- '*'

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 16
uses: actions/setup-java@v1
with:
java-version: 16
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Build with Gradle
run: ./gradlew build

- uses: actions/upload-artifact@v2
with:
name: Artifacts
path: ./build/libs/

# The USERNAME and PASSWORD need to correspond to the credentials environment variables used in
# the publishing section of your build.gradle
- name: Publish to GitHub Packages and other Mavens
run: ./gradlew publish
env:
BRANCH_NAME: ${{ github.ref }}
RUN_COUNT: ${{ github.run_number }}
REPO_NAME: ${{ github.repository }}
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
SPRUCEUI_MAVEN: ${{ secrets.MAVEN_URL }}
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@
- Added dynamic lighting to the Glow Squid.
- And more.

### 2.0.1

- Fixed mixin warnings ([#65](https://github.com/LambdAurora/LambDynamicLights/issues/65)).
- Removed any usage of a library.
- Updated [SpruceUI].

[SpruceUI]: https://github.com/LambdAurora/SpruceUI "SpruceUI page"
[Sodium]: https://modrinth.com/mod/sodium "Sodium Modrinth page"
[Canvas Renderer]: https://www.curseforge.com/minecraft/mc-mods/canvas-renderer "Canvas Renderer CurseForge page"
31 changes: 26 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,15 @@ task publishModrinth(type: TaskModrinthUpload) {

changelog = matcher.group(1)

def changelogLines = changelogText.split('\n')
def linkRefRegex = ~'^\\[([A-z0-9 _\\-/+.]+)]: '
for (int i = changelogLines.length - 1; i > 0; i--) {
def line = changelogLines[i]
if ((line =~ linkRefRegex).find())
changelog += '\n' + line
else break
}

// Readme
doFirst {
final def client = HttpClientBuilder.create().setDefaultRequestConfig(RequestConfig.custom().setCookieSpec(CookieSpecs.IGNORE_COOKIES).build()).build()
Expand Down Expand Up @@ -238,15 +247,27 @@ publishing {
repositories {
mavenLocal()
maven {
name = "BuildDirLocal"
name = 'BuildDirLocal'
url = "$buildDir/repo"
}
maven {
name = "GithubPackages"
url = uri("https://maven.pkg.github.com/LambdAurora/LambDynamicLights")
name = 'GithubPackages'
url = uri('https://maven.pkg.github.com/LambdAurora/SpruceUI')
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
username = project.findProperty('gpr.user') ?: System.getenv('USERNAME')
password = project.findProperty('gpr.key') ?: System.getenv('TOKEN')
}
}

def spruceuiMaven = System.getenv('SPRUCEUI_MAVEN')
if (spruceuiMaven) {
maven {
name = 'SpruceUIMaven'
url = uri(spruceuiMaven)
credentials {
username = project.findProperty('gpr.user') ?: System.getenv('MAVEN_USERNAME')
password = project.findProperty('gpr.key') ?: System.getenv('MAVEN_PASSWORD')
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ loader_version=0.11.3
fabric_api_version=0.34.9+1.17

# Mod Properties
mod_version = 2.0.0
mod_version = 2.0.1
maven_group = dev.lambdaurora
archives_base_name = lambdynamiclights
modrinth_id=yBW8D80W

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
spruceui_version=3.1.0+1.17
spruceui_version=3.2.0+1.17
modmenu_version=2.0.0-beta.7
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
package dev.lambdaurora.lambdynlights;

import dev.lambdaurora.spruceui.SpruceTexts;
import dev.lambdaurora.spruceui.util.Nameable;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.aperlambda.lambdacommon.utils.Nameable;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
Expand All @@ -22,7 +22,7 @@
* Represents the dynamic lights mode.
*
* @author LambdAurora
* @version 1.2.1
* @version 2.0.1
* @since 1.0.0
*/
public enum DynamicLightsMode implements Nameable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
package dev.lambdaurora.lambdynlights;

import dev.lambdaurora.spruceui.SpruceTexts;
import dev.lambdaurora.spruceui.util.Nameable;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import org.aperlambda.lambdacommon.utils.Nameable;
import org.jetbrains.annotations.NotNull;

import java.util.Arrays;
Expand All @@ -22,7 +22,7 @@
* Represents the explosives dynamic lighting mode.
*
* @author LambdAurora
* @version 1.2.1
* @version 2.0.1
* @since 1.2.1
*/
public enum ExplosiveLightingMode implements Nameable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@
* LambDynamicLights mixin plugin for conditional mixins.
*
* @author LambdAurora
* @version 1.3.3
* @version 2.0.1
* @since 1.0.0
*/
public class LambDynLightsMixinPlugin implements IMixinConfigPlugin {
private final HashMap<String, Boolean> conditionalMixins = new HashMap<>();

public LambDynLightsMixinPlugin() {
boolean ltrInstalled = LambDynLightsCompat.isLilTaterReloadedInstalled();
this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlocksMixin", ltrInstalled);
this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlockEntityMixin", ltrInstalled);

this.conditionalMixins.put("me.lambdaurora.lambdynlights.mixin.EntityLighterMixin", LambDynLightsCompat.isSodium010Installed());
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlocksMixin", ltrInstalled);
this.conditionalMixins.put("dev.lambdaurora.lambdynlights.mixin.ltr.LilTaterBlockEntityMixin", ltrInstalled);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import dev.lambdaurora.lambdynlights.LambDynLights;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.CreeperEntity;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand Down Expand Up @@ -97,11 +96,11 @@ public boolean isWaterSensitive(T lightSource) {
public int getLuminance(T entity) {
int luminance = 0;

if (entity.getClientFuseTime(0.0F) > 0.001D) {
if (entity.getClientFuseTime(0.f) > 0.001) {
luminance = switch (LambDynLights.get().config.getCreeperLightingMode()) {
case OFF -> 0;
case SIMPLE -> 10;
case FANCY -> (int) (entity.getClientFuseTime(0.0F) * 10.0);
case FANCY -> (int) (entity.getClientFuseTime(0.f) * 10.0);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
package dev.lambdaurora.lambdynlights.api.item;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import dev.lambdaurora.lambdynlights.LambDynLights;
import net.minecraft.block.Block;
import net.minecraft.block.Blocks;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
Expand All @@ -22,7 +20,6 @@
import net.minecraft.util.registry.Registry;
import org.jetbrains.annotations.NotNull;

import java.util.Objects;
import java.util.Optional;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@

package dev.lambdaurora.lambdynlights.api.item;

import com.google.gson.JsonParser;
import dev.lambdaurora.lambdynlights.LambDynLights;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.resource.ResourceManager;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
import org.aperlambda.lambdacommon.LambdaConstants;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;
Expand All @@ -27,10 +27,11 @@
* Represents an item light sources manager.
*
* @author LambdAurora
* @version 1.3.2
* @version 2.0.1
* @since 1.3.0
*/
public final class ItemLightSources {
private static final JsonParser JSON_PARSER = new JsonParser();
private static final List<ItemLightSource> ITEM_LIGHT_SOURCES = new ArrayList<>();
private static final List<ItemLightSource> STATIC_ITEM_LIGHT_SOURCES = new ArrayList<>();

Expand All @@ -55,7 +56,7 @@ private static void load(@NotNull ResourceManager resourceManager, @NotNull Iden
var id = new Identifier(resourceId.getNamespace(), resourceId.getPath().replace(".json", ""));
try {
var stream = resourceManager.getResource(resourceId).getInputStream();
var json = LambdaConstants.JSON_PARSER.parse(new InputStreamReader(stream)).getAsJsonObject();
var json = JSON_PARSER.parse(new InputStreamReader(stream)).getAsJsonObject();

ItemLightSource.fromJson(id, json).ifPresent(data -> {
if (!STATIC_ITEM_LIGHT_SOURCES.contains(data))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,11 @@
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.option.GameOptionsScreen;
import net.minecraft.client.gui.screen.option.VideoOptionsScreen;
import net.minecraft.client.gui.widget.ButtonListWidget;
import net.minecraft.client.option.GameOptions;
import net.minecraft.client.option.Option;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import net.minecraft.world.World;
import net.minecraft.world.chunk.BlockEntityTickInvoker;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
Expand All @@ -26,7 +25,6 @@
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;

import java.util.Iterator;
import java.util.List;

@Mixin(World.class)
public abstract class WorldMixin {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
Expand Down

0 comments on commit 7118520

Please sign in to comment.