Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master-1.20-lts' into master-1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Dec 6, 2024
2 parents 82e1f0c + 9c1b5d2 commit d7dc7e4
Show file tree
Hide file tree
Showing 53 changed files with 1,385 additions and 1,746 deletions.
31 changes: 21 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,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"
}
}
maven {
url = 'https://maven.minecraftforge.net/'
}
Expand Down Expand Up @@ -119,22 +129,29 @@ dependencies {
exclude group: 'org.cyclops.cyclopscore', module: 'cyclopscore'
}

implementation("mezz.jei:jei-${project.jei_version}") { // https://maven.blamejared.com/mezz/jei/
compileOnly("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("curse.maven:refinedstorage-243076:${refinedstorage_version}")

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

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

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

subsystems {
Expand Down Expand Up @@ -284,13 +301,10 @@ 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/**'
exclude '**/modcompat/refinedstorage/**'
}
}
}
Expand All @@ -305,13 +319,10 @@ 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/**'
exclude '**/modcompat/refinedstorage/**'
}

endWithNewline()
Expand Down
9 changes: 4 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ release_type=release

commoncapabilities_version=2.9.3-147
mcmultipart_version=1.2.1_78
waila_version=1.10.8:B72_1.15.2
jei_version=1.21-neoforge:19.5.0.31
rfapi_version=1.8.9R1.2.0B1.1
teslaapi_version=1.12.2:1.0.63
rei_version=16.0.783
cloth_config_version=15.0.140
architectury_version=13.0.6
mantle_version=1.12-1.3.1.22
tconstruct_version=1.12-2.7.4.37
forestry_version=1.12:5.4.3.129
Expand All @@ -22,10 +22,9 @@ IC2_version=2.8.7-ex112
theoneprobe_version=1.21_neo-12.0.3-5
refinedstorage_version=1.10.2
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.21-4.0.0.1
jade_version=5884231

# 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 @@ -53,9 +53,7 @@ protected void loadModCompats(ModCompatLoader modCompatLoader) {
// 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,61 @@
package org.cyclops.integrateddynamicscompat.modcompat.common;

import net.minecraft.core.Holder;
import net.minecraft.core.registries.BuiltInRegistries;
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 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 BuiltInRegistries.ITEM.getTagNames()
.map(tag -> BuiltInRegistries.ITEM.getTag(tag)
.flatMap(t -> {
if (t.stream().map(Holder::value).collect(Collectors.toList()).equals(items)) {
return Optional.of(tag.location());
}
return Optional.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 = ResourceLocation.fromNamespaceAndPath(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(), accessor.getLevel().registryAccess()));
}
}

@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, accessor.getLevel().registryAccess());
}

@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 = ResourceLocation.fromNamespaceAndPath(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(), accessor.getLevel().registryAccess()));
}
}

@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, accessor.getLevel().registryAccess());
}

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

}
Loading

0 comments on commit d7dc7e4

Please sign in to comment.