Skip to content

Commit

Permalink
add back the rest of the disabled compat classes
Browse files Browse the repository at this point in the history
  • Loading branch information
GizmoTheMoonPig committed Feb 8, 2024
1 parent 8926b35 commit 2784971
Show file tree
Hide file tree
Showing 21 changed files with 28 additions and 22 deletions.
10 changes: 5 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,17 @@ dependencies {
compileOnly "dev.emi:emi-neoforge:${project.emi_version}+${project.minecraft_version}"

// theillusivec4
//implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.minecraft_version}"
implementation "top.theillusivec4.curios:curios-neoforge:${project.curios_version}+${project.minecraft_version}"

//curse maven
compileOnly "curse.maven:jade-324717:4980188"
//runtimeOnly fg.deobf("curse.maven:jeed-532286:4599236")
//runtimeOnly fg.deobf("curse.maven:museum-curator-859070:4629894")
//runtimeOnly "curse.maven:jeed-532286:4599236"
//runtimeOnly "curse.maven:museum-curator-859070:4629894"

//compileOnly fg.deobf("curse.maven:the-one-probe-245211:4629624")
compileOnly"curse.maven:the-one-probe-245211:5084077"

//mods we dont have compat with but are nice to have
//runtimeOnly fg.deobf("team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0")
//runtimeOnly "team-twilight:crossdimcommands:${project.base_minecraft_version}-1.0"

//minecraft
implementation "net.neoforged:neoforge:${project.neo_version}"
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ neo_version=20.4.150-beta
jei_version=17.3.0.43
rei_version=14.0.688
emi_version=1.1.0
curios_version=7.0.0-beta.2
curios_version=7.3.0
7 changes: 4 additions & 3 deletions src/main/java/twilightforest/TwilightForestMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import org.apache.logging.log4j.Logger;
import twilightforest.client.TFClientSetup;
import twilightforest.command.TFCommand;
import twilightforest.compat.curios.CuriosCompat;
import twilightforest.data.custom.stalactites.entry.Stalactite;
import twilightforest.dispenser.TFDispenserBehaviors;
import twilightforest.entity.MagicPaintingVariant;
Expand Down Expand Up @@ -141,11 +142,11 @@ public TwilightForestMod(IEventBus bus, Dist dist) {
bus.addListener(this::createNewRegistries);
bus.addListener(this::setRegistriesForDatapack);

if (ModList.get().isLoaded("curios")) { //FIXME: When curios gets updated, uncomment this
/*NeoForge.EVENT_BUS.addListener(CuriosCompat::keepCurios);
if (ModList.get().isLoaded("curios")) {
NeoForge.EVENT_BUS.addListener(CuriosCompat::keepCurios);
bus.addListener(CuriosCompat::registerCuriosCapabilities);
bus.addListener(CuriosCompat::registerCurioRenderers);
bus.addListener(CuriosCompat::registerCurioLayers);*/
bus.addListener(CuriosCompat::registerCurioLayers);
}

BiomeGrassColors.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.world.entity.LivingEntity;
import net.neoforged.fml.ModList;
import twilightforest.TFConfig;
import twilightforest.compat.curios.CuriosCompat;
import twilightforest.init.TFBlocks;
import twilightforest.init.TFSounds;

Expand Down Expand Up @@ -36,8 +37,8 @@ public void tick() {
}

private boolean isWearingCicadaCurio() {
if (ModList.get().isLoaded("curios")) { //FIXME: When curios gets updated, uncomment this
//return CuriosCompat.isCurioEquipped(this.wearer, stack -> stack.is(TFBlocks.CICADA.asItem()));
if (ModList.get().isLoaded("curios")) {
return CuriosCompat.isCurioEquipped(this.wearer, stack -> stack.is(TFBlocks.CICADA.asItem()));
}
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/twilightforest/client/TFClientEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import twilightforest.client.renderer.TFSkyRenderer;
import twilightforest.client.renderer.TFWeatherRenderer;
import twilightforest.client.renderer.entity.ShieldLayer;
import twilightforest.compat.curios.CuriosCompat;
import twilightforest.data.tags.ItemTagGenerator;
import twilightforest.events.HostileMountEvents;
import twilightforest.init.TFItems;
Expand Down Expand Up @@ -327,8 +328,8 @@ public static void unrenderHeadWithTrophies(RenderLivingEvent.Pre<?, ?> event) {
}

private static boolean areCuriosEquipped(LivingEntity entity) {
if (ModList.get().isLoaded("curios")) { //FIXME: When curios gets updated, uncomment this
//return CuriosCompat.isCurioEquippedAndVisible(entity, stack -> stack.getItem() instanceof TrophyItem) || CuriosCompat.isCurioEquippedAndVisible(entity, stack -> stack.getItem() instanceof SkullCandleItem);
if (ModList.get().isLoaded("curios")) {
return CuriosCompat.isCurioEquippedAndVisible(entity, stack -> stack.getItem() instanceof TrophyItem) || CuriosCompat.isCurioEquippedAndVisible(entity, stack -> stack.getItem() instanceof SkullCandleItem);
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public SoundInfo getEquipSound(SlotContext slotContext) {

@Override
public void onEquip(SlotContext context, ItemStack prevStack) {
//check that we dont have a cicada already on our head before trying to start the sound
//check that we don't have a cicada already on our head before trying to start the sound
if (!context.entity().getItemBySlot(EquipmentSlot.HEAD).is(TFBlocks.CICADA.get().asItem())) {
if (stack.is(TFBlocks.CICADA.get().asItem()) && !context.entity().level().isClientSide()) {
TFPacketHandler.CHANNEL.send(PacketDistributor.TRACKING_ENTITY_AND_SELF.with(context::entity), new CreateMovingCicadaSoundPacket(context.entity().getId()));
PacketDistributor.TRACKING_ENTITY_AND_SELF.with(context.entity()).send(new CreateMovingCicadaSoundPacket(context.entity().getId()));
}
}
}
Expand All @@ -74,7 +74,7 @@ public boolean canEquipFromUse(SlotContext slotContext) {
public static void keepCurios(DropRulesEvent event) {
if (event.getEntity() instanceof Player player) {
CompoundTag playerData = CharmEvents.getPlayerData(player);
if (!player.level().isClientSide() && CharmEvents.charmUsed != null && playerData.contains(CharmEvents.CHARM_INV_TAG) && !playerData.getList(CharmEvents.CHARM_INV_TAG, 10).isEmpty()) {
if (!player.level().isClientSide() && playerData.contains(CharmEvents.CONSUMED_CHARM_TAG) && playerData.contains(CharmEvents.CHARM_INV_TAG) && !playerData.getList(CharmEvents.CHARM_INV_TAG, 10).isEmpty()) {
//Keep all Curios items
CuriosApi.getCuriosInventory(player).ifPresent(modifiable -> {
for (int i = 0; i < modifiable.getSlots(); ++i) {
Expand Down Expand Up @@ -133,6 +133,7 @@ public static boolean isCurioEquippedAndVisible(LivingEntity entity, Predicate<I
public static boolean findAndConsumeCurio(Item item, Player player) {
Optional<SlotResult> slot = CuriosApi.getCuriosInventory(player).flatMap(handler -> handler.findFirstCurio(item));
if (slot.isPresent()) {
CharmEvents.getPlayerData(player).put(CharmEvents.CONSUMED_CHARM_TAG, slot.get().stack().save(new CompoundTag()));
slot.get().stack().shrink(1);
return true;
}
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions src/main/java/twilightforest/events/CharmEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import twilightforest.TwilightForestMod;
import twilightforest.block.KeepsakeCasketBlock;
import twilightforest.block.entity.KeepsakeCasketBlockEntity;
import twilightforest.compat.curios.CuriosCompat;
import twilightforest.data.tags.ItemTagGenerator;
import twilightforest.entity.CharmEffect;
import twilightforest.enums.BlockLoggingEnum;
Expand Down Expand Up @@ -305,8 +306,8 @@ private static void keepWholeList(NonNullList<ItemStack> transferTo, NonNullList
}

private static boolean hasCharmCurio(Item item, Player player) {
if (ModList.get().isLoaded("curios")) { //FIXME: When curios gets updated, uncomment this
//return CuriosCompat.findAndConsumeCurio(item, player);
if (ModList.get().isLoaded("curios")) {
return CuriosCompat.findAndConsumeCurio(item, player);
}

return false;
Expand Down
9 changes: 5 additions & 4 deletions src/main/java/twilightforest/events/MiscEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.neoforged.neoforge.network.PacketDistributor;
import twilightforest.TwilightForestMod;
import twilightforest.block.TomeSpawnerBlock;
import twilightforest.compat.curios.CuriosCompat;
import twilightforest.entity.monster.DeathTome;
import twilightforest.entity.passive.Bighorn;
import twilightforest.entity.passive.DwarfRabbit;
Expand Down Expand Up @@ -63,12 +64,12 @@ public static void addPrey(EntityJoinLevelEvent event) {
public static void armorChanged(LivingEquipmentChangeEvent event) {
LivingEntity living = event.getEntity();

// from what I can see, vanilla doesnt have a hook for this in the item class. So this will have to do.
// from what I can see, vanilla doesn't have a hook for this in the item class. So this will have to do.
// we only have to check equipping, when its unequipped the sound instance handles the rest

//if we have a cicada in our curios slot, dont try to run this
if (ModList.get().isLoaded("curios")) { //FIXME: When curios gets updated, uncomment this
//if (CuriosCompat.isCurioEquipped(living, stack -> stack.is(TFBlocks.CICADA.asItem()))) return;
//if we have a cicada in our curios slot, don't try to run this
if (ModList.get().isLoaded("curios")) {
if (CuriosCompat.isCurioEquipped(living, stack -> stack.is(TFBlocks.CICADA.asItem()))) return;
}

if (living != null && !living.level().isClientSide() && event.getSlot() == EquipmentSlot.HEAD && event.getTo().is(TFBlocks.CICADA.asItem())) {
Expand Down

0 comments on commit 2784971

Please sign in to comment.