Skip to content

Commit

Permalink
Fix gradle deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
pupnewfster committed Feb 26, 2025
1 parent 38b9572 commit 84fbe7a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions buildSrc/src/main/groovy/mekanism/OptimizePng.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import org.gradle.api.file.FileType
import org.gradle.api.model.ObjectFactory
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.TaskAction
import org.gradle.process.ExecOperations
import org.gradle.work.ChangeType
import org.gradle.work.Incremental
import org.gradle.work.InputChanges

import javax.inject.Inject

class OptimizePng extends DefaultTask {
abstract class OptimizePng extends DefaultTask {

@InputFiles
@Incremental
Expand All @@ -23,6 +24,9 @@ class OptimizePng extends DefaultTask {
this.inputFiles = objects.fileCollection()
}

@Inject
protected abstract ExecOperations getExecOperations()

@TaskAction
void execute(InputChanges inputChanges) {
for (def fileChange : inputChanges.getFileChanges(inputFiles)) {
Expand All @@ -34,10 +38,7 @@ class OptimizePng extends DefaultTask {
//Minimize/optimize all png files, requires optipng on the PATH
// Credits: BrainStone
long size = file.length()
project.exec {
executable('optipng')
args('-q', '-o7', '-zm1-9', '-strip', 'all', file)
}
execOperations.exec { spec -> spec.commandLine('optipng', '-q', '-o7', '-zm1-9', '-strip', 'all', file) }
long newSize = file.length()
if (newSize < size) {
System.out.format(Locale.ROOT, 'Reduced File size of %s from %d bytes to %d bytes (reduced by %.2f%%)\n',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ private void addMisc() {
for (EnumColor color : EnumUtils.COLORS) {
add(color.getLangEntry(), color.getEnglishName());
}
addModInfo("Mekanism is a Minecraft add-on featuring high-tech machinery that can be used to create powerful tools, armor, and weapons.");
addModInfo(modName + " is a Minecraft add-on featuring high-tech machinery that can be used to create powerful tools, armor, and weapons.");
addPackData(MekanismLang.MEKANISM, MekanismLang.PACK_DESCRIPTION);
add(MekanismLang.DEBUG_TITLE, modName + " Debug");
add(MekanismLang.LOG_FORMAT, "[%1$s] %2$s");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import mekanism.tools.common.registries.ToolsItems;
import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.Model;
import net.minecraft.client.renderer.item.ItemPropertyFunction;
import net.minecraft.client.renderer.item.ClampedItemPropertyFunction;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
Expand Down Expand Up @@ -37,7 +37,7 @@ public static void init(FMLClientSetupEvent event) {
ToolsItems.REFINED_OBSIDIAN_SHIELD, ToolsItems.STEEL_SHIELD));
}

private static void addShieldPropertyOverrides(ResourceLocation override, ItemPropertyFunction propertyGetter, IItemProvider... shields) {
private static void addShieldPropertyOverrides(ResourceLocation override, ClampedItemPropertyFunction propertyGetter, IItemProvider... shields) {
for (IItemProvider shield : shields) {
ClientRegistrationUtil.setPropertyOverride(shield, override, propertyGetter);
}
Expand Down

0 comments on commit 84fbe7a

Please sign in to comment.