Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-1.19-lts' into master-1.2…
Browse files Browse the repository at this point in the history
…0-lts
  • Loading branch information
rubensworks committed Dec 6, 2024
2 parents 33f9513 + 6e2df56 commit 9c1b5d2
Show file tree
Hide file tree
Showing 52 changed files with 1,343 additions and 1,714 deletions.
29 changes: 19 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,16 @@ repositories {
name 'jared'
url 'https://maven.blamejared.com/'
}
maven {
name "REI"
url "https://maven.shedaniel.me/"
}
maven {
url "https://www.cursemaven.com"
content {
includeGroup "curse.maven"
}
}
}

dependencies {
Expand Down Expand Up @@ -120,22 +130,29 @@ dependencies {
exclude group: 'org.cyclops.cyclopscore', module: 'cyclopscore'
}

implementation(fg.deobf("mezz.jei:jei-${project.jei_version}")) { // https://maven.blamejared.com/mezz/jei/
compileOnly(fg.deobf("mezz.jei:jei-${project.jei_version}")) { // https://maven.blamejared.com/mezz/jei/
transitive = false
}
compileOnly "mcjty.theoneprobe:theoneprobe:${project.theoneprobe_version}" // https://maven.k-4u.nl/mcjty/theoneprobe/theoneprobe/
// TODO: for some reason using the following in runtime breaks ForgeGradle
/*runtimeOnly(fg.deobf("mcjty.theoneprobe:theoneprobe:${project.theoneprobe_version}")) { // https://maven.k-4u.nl
transitive = false
}*/
//implementation fg.deobf("hwyla:Hwyla-forge-${project.waila_version}") // https://www.curseforge.com/minecraft/mc-mods/hwyla/files/ https://github.com/TehNut/HWYLA and https://github.com/TehNut/temporary-maven-thing/tree/master/maven/mcp/mobius/waila/Hwyla

//compileOnly "com.refinedmods:refinedstorage:${project.refinedstorage_version}" // https://github.com/refinedmods/refinedstorage/packages/1145536
// TODO: for some reason using the following in runtime breaks ForgeGradle
/*runtimeOnly(fg.deobf("com.refinedmods:refinedstorage:${project.refinedstorage_version}")) { // https://repo.refinedmods.com/com/refinedmods/refinedstorage/
transitive = false
}*/
implementation fg.deobf("curse.maven:refinedstorage-243076:${refinedstorage_version}")

implementation fg.deobf("com.github.glitchfiend:TerraBlender-forge:${project.terrablender_version}")

implementation fg.deobf("me.shedaniel:RoughlyEnoughItems-forge:${rei_version}") // https://maven.shedaniel.me/me/shedaniel/RoughlyEnoughItems-forge/
implementation fg.deobf("me.shedaniel.cloth:cloth-config-forge:$cloth_config_version");
implementation fg.deobf("dev.architectury:architectury-forge:$architectury_version");

implementation fg.deobf("curse.maven:jade-324717:${jade_version}")
}

minecraft {
Expand Down Expand Up @@ -300,13 +317,9 @@ sourceSets {
exclude '**/modcompat/ic2/**'
exclude '**/modcompat/immersiveengineering/**'
exclude '**/modcompat/mcmultipart/**'
exclude '**/modcompat/minetweaker/**'
exclude '**/modcompat/signals/**'
exclude '**/modcompat/tconstruct/**'
exclude '**/modcompat/tesla/**'
exclude '**/modcompat/thaumcraft/**'
exclude '**/modcompat/waila/**'
exclude '**/modcompat/refinedstorage/**'
}
}
}
Expand All @@ -321,13 +334,9 @@ spotless {
exclude '**/modcompat/ic2/**'
exclude '**/modcompat/immersiveengineering/**'
exclude '**/modcompat/mcmultipart/**'
exclude '**/modcompat/minetweaker/**'
exclude '**/modcompat/signals/**'
exclude '**/modcompat/tconstruct/**'
exclude '**/modcompat/tesla/**'
exclude '**/modcompat/thaumcraft/**'
exclude '**/modcompat/waila/**'
exclude '**/modcompat/refinedstorage/**'
}

endWithNewline()
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@ commoncapabilities_version=1.20.1-2.9.0-98
mcmultipart_version=1.2.1_78
waila_version=1.10.8:B72_1.15.2
jei_version=1.20.1-forge:15.1.0.19
rfapi_version=1.8.9R1.2.0B1.1
teslaapi_version=1.12.2:1.0.63
rei_version=12.1.780
cloth_config_version=11.1.136
architectury_version=9.2.14
mantle_version=1.12-1.3.1.22
tconstruct_version=1.12-2.7.4.37
forestry_version=1.12:5.4.3.129
charset_version=0.4.0-pre10
IC2_version=2.8.7-ex112
theoneprobe_version=1.20.0-9.0.0-1
refinedstorage_version=1.10.2
refinedstorage_version=4844585
ie_version=0.12-90-521
crafttweakerapi_version=4.1.6.457
crafttweakermain_version=1.12-4.1.6.457
signals_version=1.12.2:1.1.0-2
terrablender_version=1.20.1-3.0.1.7
jade_version=5876199

# Workaround for Spotless bug
# https://github.com/diffplug/spotless/issues/834
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public class GeneralConfig extends DummyConfig {
@ConfigurableProperty(category = "core", comment = "If JEI recipe filling should heuristically try to determine item tags from recipes.", requiresMcRestart = true)
public static boolean jeiHeuristicTags = true;

@ConfigurableProperty(category = "core", comment = "If REI recipe filling should heuristically try to determine item tags from recipes.", requiresMcRestart = true)
public static boolean reiHeuristicTags = true;

@ConfigurableProperty(
category = "biome",
comment = "The weight of spawning in the overworld, 0 disables spawning.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@
import org.cyclops.cyclopscore.modcompat.ModCompatLoader;
import org.cyclops.cyclopscore.proxy.IClientProxy;
import org.cyclops.cyclopscore.proxy.ICommonProxy;
import org.cyclops.integrateddynamics.blockentity.BlockEntityCoalGenerator;
import org.cyclops.integrateddynamics.blockentity.BlockEntityDryingBasin;
import org.cyclops.integrateddynamics.blockentity.BlockEntityMechanicalDryingBasin;
import org.cyclops.integrateddynamics.blockentity.BlockEntityMechanicalSqueezer;
import org.cyclops.integrateddynamics.blockentity.BlockEntitySqueezer;
import org.cyclops.integrateddynamics.blockentity.*;
import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerCoalGeneratorBlockEntityCompat;
import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerDryingBasinBlockEntityCompat;
import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerMechanicalMachineBlockEntityCompat;
import org.cyclops.integrateddynamicscompat.modcompat.capabilities.WorkerSqueezerBlockEntityCompat;
import org.cyclops.integrateddynamicscompat.modcompat.refinedstorage.RefinedStorageModCompat;
import org.cyclops.integrateddynamicscompat.modcompat.terrablender.TerrablenderCompat;
import org.cyclops.integrateddynamicscompat.modcompat.top.TopModCompat;
import org.cyclops.integrateddynamicscompat.proxy.ClientProxy;
Expand All @@ -41,18 +38,16 @@ protected void loadModCompats(ModCompatLoader modCompatLoader) {
super.loadModCompats(modCompatLoader);
modCompatLoader.addModCompat(new TopModCompat());
modCompatLoader.addModCompat(new TerrablenderCompat());
modCompatLoader.addModCompat(new RefinedStorageModCompat());
// TODO: temporarily disable some mod compats
// Mod compats
// modCompatLoader.addModCompat(new RefinedStorageModCompat());
// modCompatLoader.addModCompat(new CharsetPipesModCompat());
// modCompatLoader.addModCompat(new McMultiPartModCompat());
// modCompatLoader.addModCompat(new ThaumcraftModCompat());
// modCompatLoader.addModCompat(new TConstructModCompat());
// modCompatLoader.addModCompat(new ForestryModCompat());
// modCompatLoader.addModCompat(new Ic2ModCompat());
// modCompatLoader.addModCompat(new TeslaApiCompat());
// modCompatLoader.addModCompat(new ImmersiveEngineeringModCompat());
// modCompatLoader.addModCompat(new CraftTweakerModCompat());
// modCompatLoader.addModCompat(new SignalsModCompat());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
package org.cyclops.integrateddynamicscompat.modcompat.common;

import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.MutableComponent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraftforge.registries.ForgeRegistries;
import org.cyclops.cyclopscore.helper.MinecraftHelpers;
import org.cyclops.integrateddynamics.client.gui.container.ContainerScreenLogicProgrammerBase;
import org.cyclops.integrateddynamics.core.helper.L10NValues;
import org.cyclops.integrateddynamics.inventory.container.ContainerLogicProgrammerBase;
import org.cyclops.integrateddynamicscompat.IntegratedDynamicsCompat;
import org.cyclops.integrateddynamicscompat.network.packet.CPacketSetSlot;

import java.text.DecimalFormat;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;

/**
* @author rubensworks
*/
public class JeiReiHelpers {

public static ResourceLocation itemsToTag(List<Item> items) {
return ForgeRegistries.ITEMS.tags().stream()
.map(tag -> {
if (tag.stream().collect(Collectors.toList()).equals(items)) {
return Optional.of(tag.getKey().location());
}
return Optional.<ResourceLocation>empty();
})
.filter(Optional::isPresent)
.map(Optional::get)
.findFirst()
.orElse(null);
}

public static void setStackInSlot(ContainerScreenLogicProgrammerBase<?> screen, int slot, ItemStack itemStack) {
ContainerLogicProgrammerBase container = screen.getMenu();
int slotPositionsCount = container.slots.size() - 36 - 4; /* subtract player inv, and 4 fixed slots in LP */
int slotId = container.slots.size() - 36 - slotPositionsCount + slot;
container.setItem(slotId, 0, itemStack.copy());
IntegratedDynamicsCompat._instance.getPacketHandler().sendToServer(
new CPacketSetSlot(container.containerId, slotId, itemStack));
}

public static MutableComponent getDurationSecondsTextComponent(int durationTicks) {
String seconds = new DecimalFormat("#.##").format((double) durationTicks / MinecraftHelpers.SECOND_IN_TICKS);
return Component.translatable("gui.integrateddynamics.jei.category.time.seconds", seconds);
}

public static MutableComponent getEnergyTextComponent(int durationTicks, int energyPerTick) {
return Component.literal(String.format("%,d", durationTicks * energyPerTick))
.append(Component.translatable(L10NValues.GENERAL_ENERGY_UNIT));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package org.cyclops.integrateddynamicscompat.modcompat.jade;

import com.google.common.collect.Lists;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import org.cyclops.cyclopscore.persist.nbt.NBTClassType;
import org.cyclops.integrateddynamics.Reference;
import org.cyclops.integrateddynamics.blockentity.BlockEntityDryingBasin;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.IBlockComponentProvider;
import snownee.jade.api.IServerDataProvider;
import snownee.jade.api.ITooltip;
import snownee.jade.api.config.IPluginConfig;

import java.util.List;

/**
* Waila data provider for the drying basin.
* @author rubensworks
*
*/
public class DryingBasinDataProvider implements IBlockComponentProvider, IServerDataProvider<BlockAccessor> {

public static final ResourceLocation ID = new ResourceLocation(org.cyclops.integrateddynamicscompat.Reference.MOD_ID, "drying_basin");

@Override
public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig config) {
if(config.get(DryingBasinDataProvider.ID)) {
tooltip.addAll(NBTClassType.getClassType(List.class).readPersistedField("tooltip", accessor.getServerData()));
}
}

@Override
public void appendServerData(CompoundTag tag, BlockAccessor accessor) {
BlockEntityDryingBasin tile = (BlockEntityDryingBasin) accessor.getBlockEntity();
List<Component> tooltip = Lists.newArrayList();
if (!tile.getInventory().getItem(0).isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.item",
tile.getInventory().getItem(0).getDisplayName()));
}
if (!tile.getTank().isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.fluid",
tile.getTank().getFluid().getDisplayName(), tile.getTank().getFluidAmount()));
}
NBTClassType.getClassType(List.class).writePersistedField("tooltip", tooltip, tag);
}

@Override
public ResourceLocation getUid() {
return ID;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package org.cyclops.integrateddynamicscompat.modcompat.jade;

import org.cyclops.integrateddynamics.block.*;
import org.cyclops.integrateddynamics.blockentity.*;
import org.cyclops.integrateddynamics.core.blockentity.BlockEntityMultipartTicking;
import snownee.jade.api.IWailaClientRegistration;
import snownee.jade.api.IWailaCommonRegistration;
import snownee.jade.api.IWailaPlugin;
import snownee.jade.api.WailaPlugin;

/**
* Waila support class.
* @author rubensworks
*
*/
@WailaPlugin
public class JadeIntegratedDynamicsConfig implements IWailaPlugin {

@Override
public void register(IWailaCommonRegistration registrar) {
registrar.registerBlockDataProvider(new PartDataProvider(), BlockEntityMultipartTicking.class);
registrar.registerBlockDataProvider(new SqueezerDataProvider(), BlockEntitySqueezer.class);
registrar.registerBlockDataProvider(new DryingBasinDataProvider(), BlockEntityDryingBasin.class);
registrar.registerBlockDataProvider(new MechanicalSqueezerDataProvider(), BlockEntityMechanicalSqueezer.class);
registrar.registerBlockDataProvider(new MechanicalDryingBasinDataProvider(), BlockEntityMechanicalDryingBasin.class);
registrar.registerBlockDataProvider(new ProxyDataProvider(), BlockEntityProxy.class);
}

@Override
public void registerClient(IWailaClientRegistration registrar) {
registrar.addConfig(PartDataProvider.ID, true);
registrar.addConfig(SqueezerDataProvider.ID, true);
registrar.addConfig(DryingBasinDataProvider.ID, true);
registrar.addConfig(MechanicalSqueezerDataProvider.ID, true);
registrar.addConfig(MechanicalDryingBasinDataProvider.ID, true);
registrar.addConfig(ProxyDataProvider.ID, true);

registrar.registerBlockComponent(new PartDataProvider(), BlockCable.class);
registrar.registerBlockComponent(new SqueezerDataProvider(), BlockSqueezer.class);
registrar.registerBlockComponent(new DryingBasinDataProvider(), BlockDryingBasin.class);
registrar.registerBlockComponent(new MechanicalSqueezerDataProvider(), BlockMechanicalSqueezer.class);
registrar.registerBlockComponent(new MechanicalDryingBasinDataProvider(), BlockMechanicalDryingBasin.class);
registrar.registerBlockComponent(new ProxyDataProvider(), BlockProxy.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package org.cyclops.integrateddynamicscompat.modcompat.jade;

import com.google.common.collect.Lists;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import org.cyclops.cyclopscore.persist.nbt.NBTClassType;
import org.cyclops.integrateddynamics.Reference;
import org.cyclops.integrateddynamics.blockentity.BlockEntityMechanicalDryingBasin;
import snownee.jade.api.BlockAccessor;
import snownee.jade.api.ITooltip;
import snownee.jade.api.config.IPluginConfig;

import java.util.List;

/**
* Waila data provider for the mechanical drying basin.
* @author rubensworks
*
*/
public class MechanicalDryingBasinDataProvider extends SqueezerDataProvider {

public static final ResourceLocation ID = new ResourceLocation(org.cyclops.integrateddynamicscompat.Reference.MOD_ID, "mechanical_drying_basin");

@Override
public void appendTooltip(ITooltip tooltip, BlockAccessor accessor, IPluginConfig config) {
if(config.get(MechanicalDryingBasinDataProvider.ID)) {
tooltip.addAll(NBTClassType.getClassType(List.class).readPersistedField("tooltip", accessor.getServerData()));
}
}

@Override
public void appendServerData(CompoundTag tag, BlockAccessor accessor) {
BlockEntityMechanicalDryingBasin tile = (BlockEntityMechanicalDryingBasin) accessor.getBlockEntity();
List<Component> tooltip = Lists.newArrayList();
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.energy",
tile.getEnergyStored(), tile.getMaxEnergyStored()));
if (!tile.getInventory().getItem(0).isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.item.in",
tile.getInventory().getItem(0).getDisplayName()));
}
for (int i = 1; i < tile.getInventory().getContainerSize(); i++) {
if (!tile.getInventory().getItem(i).isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.item.out",
tile.getInventory().getItem(i).getDisplayName()));
}
}
if (!tile.getTankInput().isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.fluid.in",
tile.getTankInput().getFluid().getDisplayName(), tile.getTankInput().getFluidAmount()));
}
if (!tile.getTankOutput().isEmpty()) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.fluid.out",
tile.getTankOutput().getFluid().getDisplayName(), tile.getTankOutput().getFluidAmount()));
}
if (tile.getProgress() > 0) {
tooltip.add(Component.translatable("gui." + Reference.MOD_ID + ".waila.progress",
tile.getProgress() * 100 / tile.getMaxProgress()));
}
NBTClassType.getClassType(List.class).writePersistedField("tooltip", tooltip, tag);
}

@Override
public ResourceLocation getUid() {
return ID;
}

}
Loading

0 comments on commit 9c1b5d2

Please sign in to comment.