Re-add Crafting Tweaks integration
This commit is contained in:
@@ -13,13 +13,16 @@ repositories {
|
|||||||
maven {
|
maven {
|
||||||
url = "https://dvs1.progwml6.com/files/maven/"
|
url = "https://dvs1.progwml6.com/files/maven/"
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
url "https://minecraft.curseforge.com/api/maven/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'net.minecraftforge.gradle'
|
apply plugin: 'net.minecraftforge.gradle'
|
||||||
apply plugin: 'eclipse'
|
apply plugin: 'eclipse'
|
||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
version = '1.7+10'
|
version = '1.7'
|
||||||
group = 'com.raoulvdberge'
|
group = 'com.raoulvdberge'
|
||||||
archivesBaseName = 'refinedstorage'
|
archivesBaseName = 'refinedstorage'
|
||||||
|
|
||||||
@@ -83,6 +86,7 @@ processResources {
|
|||||||
dependencies {
|
dependencies {
|
||||||
minecraft 'net.minecraftforge:forge:1.14.4-28.1.70'
|
minecraft 'net.minecraftforge:forge:1.14.4-28.1.70'
|
||||||
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11:api")
|
compileOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11:api")
|
||||||
|
runtimeOnly fg.deobf('crafting-tweaks:CraftingTweaks_1.14.4:10.1.3')
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11")
|
runtimeOnly fg.deobf("mezz.jei:jei-1.14.4:6.0.0.11")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -0,0 +1,54 @@
|
|||||||
|
package com.raoulvdberge.refinedstorage.integration.craftingtweaks;
|
||||||
|
|
||||||
|
import com.raoulvdberge.refinedstorage.api.network.grid.GridType;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.GridContainer;
|
||||||
|
import com.raoulvdberge.refinedstorage.container.slot.grid.CraftingGridSlot;
|
||||||
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
|
import net.minecraftforge.fml.InterModComms;
|
||||||
|
import net.minecraftforge.fml.ModList;
|
||||||
|
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
public final class CraftingTweaksIntegration {
|
||||||
|
private static final String ID = "craftingtweaks";
|
||||||
|
|
||||||
|
public static boolean isLoaded() {
|
||||||
|
return ModList.get().isLoaded(ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCraftingTweaksClass(Class clazz) {
|
||||||
|
return clazz.getName().startsWith("net.blay09.mods.craftingtweaks");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
CompoundNBT tag = new CompoundNBT();
|
||||||
|
|
||||||
|
tag.putString("ContainerClass", GridContainer.class.getName());
|
||||||
|
tag.putString("ValidContainerPredicate", ValidContainerPredicate.class.getName());
|
||||||
|
tag.putString("GetGridStartFunction", GetGridStartFunction.class.getName());
|
||||||
|
tag.putString("AlignToGrid", "left");
|
||||||
|
|
||||||
|
InterModComms.sendTo(ID, "RegisterProvider", () -> tag);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ValidContainerPredicate implements Predicate<GridContainer> {
|
||||||
|
@Override
|
||||||
|
public boolean test(GridContainer containerGrid) {
|
||||||
|
return containerGrid.getGrid().getGridType() == GridType.CRAFTING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class GetGridStartFunction implements Function<GridContainer, Integer> {
|
||||||
|
@Override
|
||||||
|
public Integer apply(GridContainer containerGrid) {
|
||||||
|
for (int i = 0; i < containerGrid.inventorySlots.size(); i++) {
|
||||||
|
if (containerGrid.inventorySlots.get(i) instanceof CraftingGridSlot) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,41 +0,0 @@
|
|||||||
package com.raoulvdberge.refinedstorage.integration.craftingtweaks;
|
|
||||||
|
|
||||||
/*
|
|
||||||
public final class IntegrationCraftingTweaks {
|
|
||||||
private static final String ID = "craftingtweaks";
|
|
||||||
|
|
||||||
public static boolean isLoaded() {
|
|
||||||
return Loader.isModLoaded(ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void register() {
|
|
||||||
CompoundNBT tag = new CompoundNBT();
|
|
||||||
|
|
||||||
tag.setString("ContainerClass", ContainerGrid.class.getName());
|
|
||||||
tag.setString("ValidContainerPredicate", ValidContainerPredicate.class.getName());
|
|
||||||
tag.setString("GetGridStartFunction", GetGridStartFunction.class.getName());
|
|
||||||
tag.setString("AlignToGrid", "left");
|
|
||||||
|
|
||||||
FMLInterModComms.sendMessage(ID, "RegisterProviderV3", tag);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ValidContainerPredicate implements Predicate<ContainerGrid> {
|
|
||||||
@Override
|
|
||||||
public boolean apply(ContainerGrid containerGrid) {
|
|
||||||
return containerGrid.getGrid().getGridType() == GridType.CRAFTING;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class GetGridStartFunction implements Function<ContainerGrid, Integer> {
|
|
||||||
@Override
|
|
||||||
public Integer apply(ContainerGrid containerGrid) {
|
|
||||||
for (int i = 0; i < containerGrid.inventorySlots.size(); i++) {
|
|
||||||
if (containerGrid.inventorySlots.get(i) instanceof SlotGridCrafting) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
@@ -5,6 +5,7 @@ import com.raoulvdberge.refinedstorage.RS;
|
|||||||
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
import com.raoulvdberge.refinedstorage.apiimpl.API;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FilterSlot;
|
||||||
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
import com.raoulvdberge.refinedstorage.container.slot.filter.FluidFilterSlot;
|
||||||
|
import com.raoulvdberge.refinedstorage.integration.craftingtweaks.CraftingTweaksIntegration;
|
||||||
import com.raoulvdberge.refinedstorage.render.FluidRenderer;
|
import com.raoulvdberge.refinedstorage.render.FluidRenderer;
|
||||||
import com.raoulvdberge.refinedstorage.screen.widget.CheckBoxWidget;
|
import com.raoulvdberge.refinedstorage.screen.widget.CheckBoxWidget;
|
||||||
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.SideButton;
|
import com.raoulvdberge.refinedstorage.screen.widget.sidebutton.SideButton;
|
||||||
@@ -73,8 +74,13 @@ public abstract class BaseScreen<T extends Container> extends ContainerScreen<T>
|
|||||||
|
|
||||||
super.init();
|
super.init();
|
||||||
|
|
||||||
|
if (CraftingTweaksIntegration.isLoaded()) {
|
||||||
|
buttons.removeIf(b -> !CraftingTweaksIntegration.isCraftingTweaksClass(b.getClass()));
|
||||||
|
children.removeIf(c -> !CraftingTweaksIntegration.isCraftingTweaksClass(c.getClass()));
|
||||||
|
} else {
|
||||||
buttons.clear();
|
buttons.clear();
|
||||||
children.clear();
|
children.clear();
|
||||||
|
}
|
||||||
|
|
||||||
sideButtonY = 6;
|
sideButtonY = 6;
|
||||||
|
|
||||||
|
@@ -32,6 +32,7 @@ import com.raoulvdberge.refinedstorage.block.*;
|
|||||||
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
import com.raoulvdberge.refinedstorage.capability.NetworkNodeProxyCapability;
|
||||||
import com.raoulvdberge.refinedstorage.container.*;
|
import com.raoulvdberge.refinedstorage.container.*;
|
||||||
import com.raoulvdberge.refinedstorage.container.factory.*;
|
import com.raoulvdberge.refinedstorage.container.factory.*;
|
||||||
|
import com.raoulvdberge.refinedstorage.integration.craftingtweaks.CraftingTweaksIntegration;
|
||||||
import com.raoulvdberge.refinedstorage.item.*;
|
import com.raoulvdberge.refinedstorage.item.*;
|
||||||
import com.raoulvdberge.refinedstorage.item.blockitem.*;
|
import com.raoulvdberge.refinedstorage.item.blockitem.*;
|
||||||
import com.raoulvdberge.refinedstorage.loottable.ControllerLootFunctionSerializer;
|
import com.raoulvdberge.refinedstorage.loottable.ControllerLootFunctionSerializer;
|
||||||
@@ -134,6 +135,10 @@ public class CommonSetup {
|
|||||||
LootFunctionManager.registerFunction(new PortableGridBlockLootFunctionSerializer());
|
LootFunctionManager.registerFunction(new PortableGridBlockLootFunctionSerializer());
|
||||||
LootFunctionManager.registerFunction(new CrafterLootFunctionSerializer());
|
LootFunctionManager.registerFunction(new CrafterLootFunctionSerializer());
|
||||||
LootFunctionManager.registerFunction(new ControllerLootFunctionSerializer());
|
LootFunctionManager.registerFunction(new ControllerLootFunctionSerializer());
|
||||||
|
|
||||||
|
if (CraftingTweaksIntegration.isLoaded()) {
|
||||||
|
CraftingTweaksIntegration.register();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private INetworkNode readAndReturn(CompoundNBT tag, NetworkNode node) {
|
private INetworkNode readAndReturn(CompoundNBT tag, NetworkNode node) {
|
||||||
|
Reference in New Issue
Block a user