This commit is contained in:
GlodBlock committed 2023-02-01 21:15:44 +08:00
1 parent 8081eb2c2c
commit dadf2784a8
16 files changed
+151 -37

No files matched your search

+101 -21
View File
@@ -1,4 +1,4 @@
//version: 1674943145
//version: 1675173326
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@@ -55,9 +55,9 @@ plugins {
id 'eclipse'
id 'scala'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version ,unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
@@ -66,7 +66,7 @@ plugins {
id 'com.diffplug.spotless' version '6.7.2' apply false
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.0.16'
id 'com.gtnewhorizons.retrofuturagradle' version '1.1.3'
}
boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated
@@ -113,6 +113,7 @@ propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
// Deprecated properties (kept for backwards compat)
propertyDefaultIfUnset("gradleTokenModId", "")
propertyDefaultIfUnset("gradleTokenModName", "")
@@ -149,6 +150,33 @@ java {
}
}
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project
kotlin {
jvmToolchain(8)
}
// Kotlin hacks our source sets, so we hack Kotlin's tasks
def disabledKotlinTaskList = [
"kaptGenerateStubsMcLauncherKotlin",
"kaptGenerateStubsPatchedMcKotlin",
"kaptGenerateStubsInjectedTagsKotlin",
"compileMcLauncherKotlin",
"compilePatchedMcKotlin",
"compileInjectedTagsKotlin",
"kaptMcLauncherKotlin",
"kaptPatchedMcKotlin",
"kaptInjectedTagsKotlin",
"kspMcLauncherKotlin",
"kspPatchedMcKotlin",
"kspInjectedTagsKotlin",
]
tasks.configureEach { task ->
if (task.name in disabledKotlinTaskList) {
task.enabled = false
}
}
}
configurations {
create("runtimeOnlyNonPublishable") {
description = "Runtime only dependencies that are not published alongside the jar"
@@ -212,6 +240,25 @@ if (accessTransformersFile) {
}
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
} else {
boolean atsFound = false
for (File at : sourceSets.getByName("main").resources.files) {
if (at.name.toLowerCase().endsWith("_at.cfg")) {
atsFound = true
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
}
}
for (File at : sourceSets.getByName("api").resources.files) {
if (at.name.toLowerCase().endsWith("_at.cfg")) {
atsFound = true
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(at)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(at)
}
}
if (atsFound) {
logger.warn("Found and added access transformers in the resources folder, please configure gradle.properties to explicitly mention them by name")
}
}
if (usesMixins.toBoolean()) {
@@ -290,7 +337,7 @@ if (identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
}
group = modGroup
group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
} else {
@@ -356,6 +403,16 @@ configurations.configureEach {
}
}
// Ensure tests have access to minecraft classes
sourceSets {
test {
java {
compileClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output
runtimeClasspath += sourceSets.patchedMc.output + sourceSets.mcLauncher.output
}
}
}
if (file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
@@ -363,7 +420,7 @@ if (file('addon.gradle').exists()) {
// Allow unsafe repos but warn
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
if (repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'")
repo.allowInsecureProtocol = true
}
@@ -473,6 +530,14 @@ dependencies {
}
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) {
dependencies {
kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
}
}
}
apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
@@ -513,9 +578,11 @@ if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
}
if (usesMixins.toBoolean()) {
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
@@ -529,6 +596,25 @@ if (usesMixins.toBoolean()) {
"-XDignore.symbol.file"
]
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
}
tasks.named("processResources", ProcessResources).configure {
@@ -584,6 +670,7 @@ if (usesShadowedDependencies.toBoolean()) {
tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
enabled = minimizeShadowedDependencies.toBoolean()
}
tasks.named("shadowJar", ShadowJar).configure {
manifest {
@@ -599,7 +686,9 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile
]
archiveClassifier.set('dev')
dependsOn(relocateShadowJar)
if (minimizeShadowedDependencies.toBoolean()) {
dependsOn(relocateShadowJar)
}
}
configurations.runtimeElements.outgoing.artifacts.clear()
configurations.apiElements.outgoing.artifacts.clear()
@@ -625,16 +714,6 @@ if (usesShadowedDependencies.toBoolean()) {
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar
tasks.named('extractForgeUserdev', Copy).configure { efu ->
doLast {
// Fix CoFH-repackaged CCL not finding mappings
project.copy {
from(mcpTasks.userdevDir("conf"))
into(new File(project.buildDir, "unpacked/conf"))
}
}
}
tasks.register('apiJar', Jar) {
from(sourceSets.main.allSource) {
include modGroupPath + "/" + apiPackagePath + '/**'
@@ -664,6 +743,7 @@ idea {
module {
downloadJavadoc = true
downloadSources = true
inheritOutputDirs = true
}
project {
settings {
@@ -739,7 +819,7 @@ publishing {
artifact apiJar
}
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons"
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
@@ -28,7 +28,7 @@ import cpw.mods.fml.common.network.NetworkRegistry;
modid = FluidCraft.MODID,
version = FluidCraft.VERSION,
name = FluidCraft.MODNAME,
dependencies = "required-after:appliedenergistics2;required-after:BuildCraft|Factory;required-after:CoFHCore;after:waila")
dependencies = "required-after:appliedenergistics2;required-after:CoFHCore;after:waila")
public class FluidCraft {
public static final String MODID = "GRADLETOKEN_MODID";
@@ -1,8 +1,14 @@
package com.glodblock.github.common.block;
import static net.minecraft.client.gui.GuiScreen.isShiftKeyDown;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -16,8 +22,12 @@ import com.glodblock.github.inventory.InventoryHandler;
import com.glodblock.github.inventory.gui.GuiType;
import com.glodblock.github.util.BlockPos;
import com.glodblock.github.util.NameConst;
import com.glodblock.github.util.RenderUtil;
import com.glodblock.github.util.Util;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class BlockFluidAutoFiller extends FCBaseBlock {
@@ -61,4 +71,17 @@ public class BlockFluidAutoFiller extends FCBaseBlock {
}
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(final ItemStack itemStack, final EntityPlayer player, final List<String> toolTip,
final boolean advancedToolTips) {
if (isShiftKeyDown()) {
toolTip.addAll(
RenderUtil.listFormattedStringToWidth(
StatCollector.translateToLocal(NameConst.TT_FLUID_AUTO_FILLER)));
} else {
toolTip.add(NameConst.i18n(NameConst.TT_SHIFT_FOR_MORE));
}
}
}
@@ -1,6 +1,6 @@
package com.glodblock.github.common.item;
import static com.glodblock.github.loader.recipe.WirelessTerminal.getInfinityBoosterCard;
import static com.glodblock.github.loader.recipe.WirelessTerminalRecipe.getInfinityBoosterCard;
import static com.glodblock.github.util.Util.hasInfinityBoosterCard;
import java.util.List;
@@ -1,11 +1,14 @@
package com.glodblock.github.common.item;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.networking.IGridNode;
import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages;
import appeng.util.Platform;
@@ -24,6 +27,7 @@ public class ItemWirelessFluidTerminal extends ItemBaseWirelessTerminal
public ItemWirelessFluidTerminal() {
super(GuiType.WIRELESS_FLUID_TERMINAL);
AEApi.instance().registries().wireless().registerWirelessHandler(this);
this.setFeature(EnumSet.of(AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools));
setUnlocalizedName(NameConst.ITEM_WIRELESS_FLUID_TERMINAL);
setTextureName(FluidCraft.resource(NameConst.ITEM_WIRELESS_FLUID_TERMINAL).toString());
}
@@ -1,11 +1,14 @@
package com.glodblock.github.common.item;
import java.util.EnumSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.networking.IGridNode;
import appeng.core.features.AEFeature;
import appeng.core.localization.PlayerMessages;
import appeng.util.Platform;
@@ -24,6 +27,7 @@ public class ItemWirelessPatternTerminal extends ItemBaseWirelessTerminal
public ItemWirelessPatternTerminal() {
super(GuiType.WIRELESS_FLUID_PATTERN_TERMINAL);
AEApi.instance().registries().wireless().registerWirelessHandler(this);
this.setFeature(EnumSet.of(AEFeature.WirelessAccessTerminal, AEFeature.PoweredTools));
setUnlocalizedName(NameConst.ITEM_WIRELESS_FLUID_PATTERN_TERMINAL);
setTextureName(FluidCraft.resource(NameConst.ITEM_WIRELESS_FLUID_PATTERN_TERMINAL).toString());
}
@@ -98,7 +98,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
public void updatePattern() {
ItemStack is = inventory.getStackInSlot(0);
if (is == null || this.getContainerItem().isItemEqual(is)) return;
if (is == null) return;
this.setContainerItem(is);
postEvent();
}
@@ -106,6 +106,10 @@ public class TileFluidAutoFiller extends AENetworkInvTile
@TileEvent(TileEventType.WORLD_NBT_READ)
public void readFromNBTEvent(NBTTagCompound data) {
inventory.readFromNBT(data, "Inv");
if (inventory.getStackInSlot(0) == null) {
inventory.setInventorySlotContents(0, BUCKET);
}
updatePattern();
}
@TileEvent(TileEventType.WORLD_NBT_WRITE)
@@ -210,8 +214,7 @@ public class TileFluidAutoFiller extends AENetworkInvTile
BaseActionSource source) {
if (this.getProxy().isActive() && this.getStorageGrid() != null) {
boolean hasChanged = false;
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory()
.getAvailableItems(AEApi.instance().storage().createFluidList());
IItemList<IAEFluidStack> stored = this.getStorageGrid().getFluidInventory().getStorageList();
for (IAEFluidStack tmp : change) {
if (stored.findPrecise(tmp) == null || this.fluids.findPrecise(tmp) == null) {
hasChanged = true;
@@ -170,7 +170,7 @@ public enum GuiType {
}
}),
CRAFTING_STATUS(new PartItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
CRAFTING_STATUS(new PartOrItemGuiFactory<ITerminalHost>(ITerminalHost.class) {
@Override
protected Object createServerGui(EntityPlayer player, ITerminalHost inv) {
@@ -15,9 +15,9 @@ import appeng.container.ContainerOpenContext;
import com.glodblock.github.inventory.item.IItemInventory;
import com.glodblock.github.util.Util;
public abstract class PartItemGuiFactory<T> extends PartGuiFactory<T> {
public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
PartItemGuiFactory(Class<T> invClass) {
PartOrItemGuiFactory(Class<T> invClass) {
super(invClass);
}
@@ -32,7 +32,6 @@ public class WirelessFluidTerminal extends MEMonitorHandler<IAEFluidStack> imple
private final ItemStack target;
private final IAEItemPowerStorage ips;
private final EntityPlayer p;
private final int inventorySlot;
private final AppEngInternalInventory viewCell;
private final StorageChannel channel;
@@ -46,7 +45,6 @@ public class WirelessFluidTerminal extends MEMonitorHandler<IAEFluidStack> imple
this.ips = (ToolWirelessTerminal) is.getItem();
this.grid = gridNode;
this.target = is;
this.p = player;
this.inventorySlot = slot;
this.viewCell = new WirelessTerminalViewCells(is);
this.channel = StorageChannel.FLUIDS;
@@ -127,7 +127,6 @@ public class WirelessPatternTerminal extends MEMonitorHandler<IAEItemStack> impl
final ConfigManager out = new ConfigManager((manager, settingName, newValue) -> {
final NBTTagCompound data = Platform.openNbtData(this.target);
manager.writeToNBT(data);
});
out.registerSetting(Settings.SORT_BY, SortOrder.NAME);
out.registerSetting(Settings.VIEW_MODE, ViewItems.ALL);
@@ -14,7 +14,7 @@ import net.minecraftforge.oredict.ShapelessOreRecipe;
import com.glodblock.github.common.Config;
import com.glodblock.github.common.item.ItemBasicFluidStorageCell;
import com.glodblock.github.common.storage.CellType;
import com.glodblock.github.loader.recipe.WirelessTerminal;
import com.glodblock.github.loader.recipe.WirelessTerminalRecipe;
import com.glodblock.github.util.ModAndClassUtil;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -134,8 +134,8 @@ public class RecipeLoader implements Runnable {
GameRegistry.addShapelessRecipe(WIRELESS_FLUID_TERM.stack(), AE2_WIRELESS_TERMINAL, BUCKET);
GameRegistry.addShapelessRecipe(WIRELESS_PATTERN_TERM.stack(), WIRELESS_FLUID_TERM, FLUID_TERMINAL);
if (ModAndClassUtil.WCT) {
GameRegistry.addRecipe(new WirelessTerminal(WIRELESS_PATTERN_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminal(WIRELESS_FLUID_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_PATTERN_TERM.stack()));
GameRegistry.addRecipe(new WirelessTerminalRecipe(WIRELESS_FLUID_TERM.stack()));
}
GameRegistry
.addRecipe(new ShapedOreRecipe(CERTUS_QUARTZ_TANK.stack(), "GGG", "G G", "GGG", 'G', AE2_QUARTZ_GLASS));
@@ -16,12 +16,12 @@ import appeng.util.Platform;
import com.glodblock.github.common.item.ItemBaseWirelessTerminal;
public class WirelessTerminal extends ShapelessRecipes {
public class WirelessTerminalRecipe extends ShapelessRecipes {
private static final ItemStack infinityBoosterCard = ItemEnum.BOOSTER_CARD.getStack();
private final ItemStack installedTerm;
public WirelessTerminal(ItemStack term) {
public WirelessTerminalRecipe(ItemStack term) {
super(term, Arrays.asList(term, infinityBoosterCard));
this.installedTerm = installInfinityBoosterCard(term);
}
@@ -76,6 +76,7 @@ public class NameConst {
public static final String TT_CELL_PORTABLE = TT_KEY + "cell_portable";
public static final String TT_WIRELESS = TT_KEY + "wireless.";
public static final String TT_WIRELESS_INSTALLED = TT_WIRELESS + "installed";
public static final String TT_FLUID_AUTO_FILLER = TT_KEY + "fluid_auto_filler";
public static final String WAILA_KEY = FluidCraft.MODID + ".waila.";
public static final String WAILA_ENABLE = WAILA_KEY + "enable";
@@ -54,6 +54,7 @@ ae2fc.tooltip.fluid_packet_decoder.desc=The Fluid Decoder can decode Fluid packe
ae2fc.tooltip.discretizer.desc=When the ME Fluid Discretizer is attached to your ME System, it will represent the Fluids that are stored in your ME Fluid Storage Cells (Or Storage bus) as drops. They will be the item equivalent of fluids. Its just another way to show fluids, it won't actually convert your fluids to items.
ae2fc.tooltip.fluid_buffer.desc=This is a high speed fluid IO
ae2fc.tooltip.walrus.desc=GTNH is like a job
ae2fc.tooltip.fluid_auto_filler=Creates fluid canning pattern with given container automatically.
ae2fc.tooltip.level_maintainer.Who_Am_I=Who Am I?
ae2fc.tooltip.level_maintainer.title=§6Request Status§r
ae2fc.tooltip.level_maintainer.desc=Automatically keeps items and fluids in stock by requesting new crafts when needed. Has to be connected to an ME network.
@@ -54,6 +54,7 @@ ae2fc.tooltip.fluid_packet_decoder.desc=流体解码器可以解码液体数据
ae2fc.tooltip.discretizer.desc=当ME流体离散器连接到您的ME系统时,它将把存储在的ME流体存储单元(或存储总线)中的流体表现为物品液滴。它们将是流体的等价物。它只是显示流体的另一种方式,它不会真正把你的流体转换成物品。
ae2fc.tooltip.fluid_buffer.desc=这就是一个高速的流体IO接口
ae2fc.tooltip.walrus.desc=GTNH is like a job
ae2fc.tooltip.fluid_auto_filler=自动生成指定容器流体灌装样板。
ae2fc.tooltip.level_maintainer.Who_Am_I=Who Am I?
ae2fc.tooltip.level_maintainer.title=§6请求状态§r
ae2fc.tooltip.level_maintainer.desc=通过在需要时请求合成,自动保持物品和流体的库存。必须连接到ME网络。