Skip to content

Commit

Permalink
Merge branch '1.18'
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildSrc/src/main/kotlin/Dependencies.kt
#	buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt
  • Loading branch information
deirn committed Feb 22, 2023
2 parents 7e6b561 + c4ebfa0 commit afa64fe
Show file tree
Hide file tree
Showing 22 changed files with 341 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/head.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
./setup.sh
- run: |
chmod +x ./gradlew
./gradlew build
./gradlew build --max-workers=1
env:
MOD_VERSION: ${{ steps.vars.outputs.git_hash }}
- uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
./setup.sh
- run: |
chmod +x ./gradlew
./gradlew build publish curseforge modrinth
./gradlew build publish curseforge modrinth --max-workers=1
env:
MOD_VERSION: ${{ steps.vars.outputs.version }}
GITHUB_TOKEN: ${{ github.token }}
Expand Down
2 changes: 2 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ afterEvaluate {
optional.project(mrIds.extraGen)
optional.project(mrIds.kibe)
optional.project(mrIds.modernDynamics)
optional.project(mrIds.powah)
}
}

Expand Down Expand Up @@ -196,6 +197,7 @@ afterEvaluate {
// addOptional(cfSlugs.lba)
addOptional(cfSlugs.luggage)
addOptional(cfSlugs.modernDynamics)
addOptional(cfSlugs.powah)
addOptional(cfSlugs.rebornCore)
addOptional(cfSlugs.techReborn)
addOptional(cfSlugs.wirelessNet)
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repositories {
}

dependencies {
implementation("fabric-loom:fabric-loom.gradle.plugin:1.0.+")
implementation("fabric-loom:fabric-loom.gradle.plugin:1.1.+")
implementation("com.modrinth.minotaur:Minotaur:2.2.1")
implementation("com.github.deirn:CurseForgeGradle:c693018f92")
implementation("com.google.code.gson:gson:2.9.1")
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ object deps {
val noIndium = "me.luligabi:NoIndium:1.1.0+1.19"
val owo = "io.wispforest:owo-lib:0.7.3+1.19"
val patchouli = "vazkii.patchouli:Patchouli:1.19.2-76-FABRIC"
val powah = "maven.modrinth:KZO4S4DO:3.0.7-fabric"

val dmlSim = "curse.maven:cursemod-508931:3785658"
val indrev = "curse.maven:cursemod-391708:3940035"
Expand All @@ -47,6 +48,8 @@ object deps {
val stepAttr = "com.github.emilyploszaj:step-height-entity-attribute:v1.0.1"
val fakePlayer = "dev.cafeteria:fake-player-api:0.5.0"
val mixinExtras = "com.github.LlamaLad7:MixinExtras:0.1.1-rc.4"
val portingLib = "io.github.fabricators_of_create:Porting-Lib:1.2.783-beta+1.18.2"
val registrate = "com.tterrag.registrate_fabric:Registrate:MC1.18.2-1.1.10"
}

fun DependencyHandlerScope.modImpl(dep: String, dependencyConfiguration: ExternalModuleDependency.() -> Unit = {}) {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/FetchLatestVersionsTask.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ abstract class FetchLatestVersionsTask : DefaultTask() {

fetch(deps::ae2, mrIds.ae2, "1.19.1") { "appeng:appliedenergistics2-fabric:${it.version_number.removePrefix("fabric-")}" }
fetch(deps::alloyForge, mrIds.alloyForge, "1.19") { it.maven }
fetch(deps::architectury, mrIds.architectury) { "dev.architectury:architectury-fabric:${it.version_number.removeSuffix("+fabric")}" }
fetch(deps::create, mrIds.create, "1.18.2") {
"com.simibubi.create:create-fabric-${
it.version_number.removePrefix("create-fabric-").replaceFirst('-', ':')
Expand All @@ -60,6 +61,7 @@ abstract class FetchLatestVersionsTask : DefaultTask() {
fetch(deps::noIndium, mrIds.noIndium, "1.19") { "me.luligabi:NoIndium:${it.version_number}" }
fetch(deps::owo, mrIds.owo, "1.19") { "io.wispforest:owo-lib:${it.version_number}" }
fetch(deps::patchouli, mrIds.patchouli) { "vazkii.patchouli:Patchouli:${it.version_number.toUpperCase(Locale.ROOT)}" }
fetch(deps::powah, mrIds.powah) { it.maven }
}

out()
Expand Down
3 changes: 3 additions & 0 deletions buildSrc/src/main/kotlin/Uploads.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ object cfSlugs {
val lba = "libblockattributes"
val luggage = "luggage"
val modernDynamics = "modern-dynamics"
val powah = "powah-rearchitected"
val rebornCore = "reborncore"
val techReborn = "techreborn"
val wirelessNet = "wireless-networks"
Expand All @@ -34,6 +35,7 @@ object mrIds {

val ae2 = "XxWD5pD3"
val alloyForge = "jhl28YkY"
val architectury = "lhGA9TYQ"
val create = "Xbc0uyRg"
val clothConfig = "9s6osm5g"
val extraGen = "VXtwLg17"
Expand All @@ -45,4 +47,5 @@ object mrIds {
val noIndium = "Hv40r83o"
val owo = "ccKDOlHs"
val patchouli = "nU0bVIaL"
val powah = "KZO4S4DO"
}
4 changes: 4 additions & 0 deletions conflict.mapping
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
CLASS net/minecraft/class_1735
METHOD method_7682 yarn_isEnabled ()Z

CLASS net/minecraft/class_465
METHOD method_2389 yarn_drawBackground (Lnet/minecraft/class_4587;FII)V
METHOD method_2388 yarn_drawForeground (Lnet/minecraft/class_4587;II)V
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
org.gradle.jvmargs = -Xmx2G
org.gradle.jvmargs = -Xmx3G
4 changes: 4 additions & 0 deletions module-compat/create/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ dependencies {
modImpl(deps.create) {
exclude("dev.emi:emi")
exclude("com.github.LlamaLad7:MixinExtras")
exclude("me.luligabi:NoIndium")
}
modImpl(deps.fabricApi)
modImpl(deps.mixinExtras)
modImpl(deps.noIndium)
modImpl(deps.portingLib)
modImpl(deps.registrate)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerTileEntity;
import com.simibubi.create.content.contraptions.processing.ProcessingRecipe;
import io.github.fabricators_of_create.porting_lib.transfer.item.RecipeWrapper;
import lol.bai.megane.module.create.provider.CrushingWheelControllerProgressProvider;
import net.minecraft.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -22,7 +21,7 @@ public abstract class MixinCrushingWheelControllerTileEntity implements Crushing

@SuppressWarnings({"OptionalUsedAsFieldOrParameterType", "OptionalIsPresent"})
@Inject(method = "itemInserted", at = @At("TAIL"), locals = LocalCapture.CAPTURE_FAILHARD)
private void megane_storeRecipeDuration(ItemStack stack, CallbackInfo ci, Optional<ProcessingRecipe<RecipeWrapper>> recipe) {
private void megane_storeRecipeDuration(ItemStack stack, CallbackInfo ci, Optional<ProcessingRecipe<?>> recipe) {
recipeDuration = recipe.isPresent() ? recipe.get().getProcessingDuration() : 0;
}

Expand Down
11 changes: 11 additions & 0 deletions module-compat/powah/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repositories {
shedaniel()
}

dependencies {
modImpl(deps.powah)
modImpl(deps.trEnergy)
modImpl(deps.fabricApi)
modImpl(deps.architectury)
modImpl(deps.clothConfig)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package lol.bai.megane.module.powah;

import lol.bai.megane.api.MeganeModule;
import lol.bai.megane.api.registry.ClientRegistrar;
import lol.bai.megane.api.registry.CommonRegistrar;
import lol.bai.megane.module.powah.provider.EnergyEnergyProvider;
import lol.bai.megane.module.powah.provider.FurnatorProgressProvider;
import lol.bai.megane.module.powah.provider.InventoryItemProvider;
import lol.bai.megane.module.powah.provider.ReactorProgressProvider;
import lol.bai.megane.module.powah.provider.TankFluidProvider;
import owmii.powah.block.furnator.FurnatorTile;
import owmii.powah.block.reactor.ReactorPartTile;
import owmii.powah.lib.block.AbstractEnergyStorage;
import owmii.powah.lib.block.IInventoryHolder;
import owmii.powah.lib.block.ITankHolder;

public class MeganePowah implements MeganeModule {

@Override
public void registerCommon(CommonRegistrar registrar) {
registrar.addEnergy(AbstractEnergyStorage.class, new EnergyEnergyProvider<>(AbstractEnergyStorage::getEnergy));
registrar.addEnergy(ReactorPartTile.class, new EnergyEnergyProvider<>(it -> it.core().map(AbstractEnergyStorage::getEnergy).orElse(null)));

registrar.addItem(IInventoryHolder.class, new InventoryItemProvider<>(IInventoryHolder::getInventory));
registrar.addItem(ReactorPartTile.class, new InventoryItemProvider<>(it -> it.core().map(IInventoryHolder::getInventory).orElse(null)));

registrar.addFluid(ITankHolder.class, new TankFluidProvider<>(ITankHolder::getTank));
registrar.addFluid(ReactorPartTile.class, new TankFluidProvider<>(it -> it.core().map(ITankHolder::getTank).orElse(null)));

registrar.addProgress(FurnatorTile.class, new FurnatorProgressProvider());
registrar.addProgress(ReactorPartTile.class, new ReactorProgressProvider());
}

@Override
public void registerClient(ClientRegistrar registrar) {
registrar.addEnergyInfo("powah", 0x710C00, "FE");
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package lol.bai.megane.module.powah.provider;

import java.util.function.Function;

import lol.bai.megane.api.provider.EnergyProvider;
import owmii.powah.lib.logistics.energy.Energy;

public class EnergyEnergyProvider<T> extends EnergyProvider<T> {

final Function<T, Energy> getter;

Energy energy;

public EnergyEnergyProvider(Function<T, Energy> getter) {
this.getter = getter;
}

@Override
protected void init() {
this.energy = getter.apply(getObject());
}

@Override
public boolean hasEnergy() {
return energy != null;
}

@Override
public long getStored() {
return energy.getStored();
}

@Override
public long getMax() {
return energy.getMaxEnergyStored();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package lol.bai.megane.module.powah.provider;

import owmii.powah.block.furnator.FurnatorTile;
import owmii.powah.lib.logistics.inventory.Inventory;
import owmii.powah.lib.util.Ticker;

public class FurnatorProgressProvider extends TickerProgressProvider<FurnatorTile> {

static final int[] INPUT = {1};
static final int[] OUTPUT = {};

@Override
protected int[] getInputSlots() {
return INPUT;
}

@Override
protected int[] getOutputSlots() {
return OUTPUT;
}

@Override
Ticker getTicker() {
return getObject().getCarbon();
}

@Override
Inventory getInventory() {
return getObject().getInventory();
}

@Override
public int getPercentage() {
int percent = (int) ticker.perCent();
return percent == 100 ? 0 : 100 - percent;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package lol.bai.megane.module.powah.provider;

import java.util.function.Function;

import lol.bai.megane.api.provider.ItemProvider;
import net.minecraft.item.ItemStack;
import org.jetbrains.annotations.NotNull;
import owmii.powah.lib.logistics.inventory.Inventory;

public class InventoryItemProvider<T> extends ItemProvider<T> {

final Function<T, Inventory> getter;

Inventory inventory;

public InventoryItemProvider(Function<T, Inventory> getter) {
this.getter = getter;
}

@Override
protected void init() {
this.inventory = getter.apply(getObject());
}

@Override
public boolean hasItems() {
return inventory != null;
}

@Override
public int getSlotCount() {
return inventory.getSlots();
}

@Override
public @NotNull ItemStack getStack(int slot) {
return inventory.getStackInSlot(slot);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package lol.bai.megane.module.powah.provider;

import owmii.powah.block.reactor.ReactorPartTile;
import owmii.powah.block.reactor.ReactorTile;
import owmii.powah.lib.logistics.inventory.Inventory;
import owmii.powah.lib.util.Ticker;

public class ReactorProgressProvider extends TickerProgressProvider<ReactorPartTile> {

ReactorTile core;

@Override
protected void init() {
this.core = getObject().core().orElse(null);
super.init();
}

@Override
protected int[] getInputSlots() {
return new int[0];
}

@Override
protected int[] getOutputSlots() {
return new int[0];
}

@Override
Ticker getTicker() {
return core.fuel;
}

@Override
Inventory getInventory() {
return core.getInventory();
}

@Override
public int getPercentage() {
return (int) ticker.perCent();
}

}
Loading

0 comments on commit afa64fe

Please sign in to comment.