Added support for wearing goggles on curios head slot

This commit is contained in:
patryk3211 2022-05-10 14:51:38 +02:00
parent d8dd101fdf
commit 5a747ce93c
6 changed files with 53 additions and 1 deletions

View File

@ -135,6 +135,10 @@ repositories {
//location of the maven for dynamic trees
url 'https://harleyoconnor.com/maven'
}
maven {
//location of the maven for curios api
url = "https://maven.theillusivec4.top/"
}
}
configurations {
@ -157,6 +161,9 @@ dependencies {
compileOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}:api")
runtimeOnly fg.deobf("mezz.jei:jei-${jei_minecraft_version}:${jei_version}")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_minecraft_version}-${curios_version}")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
// implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")
// runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")

View File

@ -22,6 +22,8 @@ registrate_version = MC1.18.2-1.0.25
flywheel_version = 1.18-0.7.0.67
jei_minecraft_version = 1.18.2
jei_version = 9.5.3.143
curios_minecraft_version = 1.18.2
curios_version = 5.0.7.0
# curseforge information
projectId = 328085

View File

@ -2,6 +2,9 @@ package com.simibubi.create;
import java.util.Random;
import com.simibubi.create.compat.Mods;
import com.simibubi.create.compat.curios.Curios;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -119,6 +122,8 @@ public class Create {
DistExecutor.unsafeRunWhenOn(Dist.CLIENT,
() -> () -> CreateClient.onCtorClient(modEventBus, forgeEventBus));
Mods.CURIOS.executeIfInstalled(() -> Curios::init);
}
public static void init(final FMLCommonSetupEvent event) {

View File

@ -12,7 +12,8 @@ import net.minecraftforge.fml.ModList;
*/
public enum Mods {
DYNAMICTREES,
TCONSTRUCT;
TCONSTRUCT,
CURIOS;
/**
* @return a boolean of whether the mod is loaded or not based on mod id

View File

@ -0,0 +1,31 @@
package com.simibubi.create.compat.curios;
import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.goggles.GogglesItem;
import net.minecraftforge.fml.InterModComms;
import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import top.theillusivec4.curios.api.CuriosCapability;
import top.theillusivec4.curios.api.SlotTypeMessage;
import top.theillusivec4.curios.api.SlotTypePreset;
import java.util.concurrent.atomic.AtomicBoolean;
public class Curios {
public static void init() {
FMLJavaModLoadingContext.get().getModEventBus().addListener(Curios::onInterModEnqueue);
GogglesItem.addIsWearingPredicate(player -> {
AtomicBoolean hasGoggles = new AtomicBoolean(false);
player.getCapability(CuriosCapability.INVENTORY).ifPresent(handler -> {
hasGoggles.set(handler.getCurios().get("head").getStacks().getStackInSlot(0).getItem() == AllItems.GOGGLES.get());
});
return hasGoggles.get();
});
}
private static void onInterModEnqueue(final InterModEnqueueEvent event) {
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.HEAD.getMessageBuilder().build());
}
}

View File

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"create:goggles"
]
}