Skip to content

Commit

Permalink
修复与最新版minihud不兼容 (#82)
Browse files Browse the repository at this point in the history
* fix crash with minihud

* minihud-fabric-1.21-0.32.51

* ops

* use jitpack

* fix

* remove extra spaces

* replace < with >= in preprocess comment

* add minihud conflict in fabric.mod.json

---------

Co-authored-by: Fallen_Breath <[email protected]>
  • Loading branch information
Crystal0404 and Fallen-Breath authored Nov 12, 2024
1 parent 56416ba commit 72b6b91
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
3 changes: 2 additions & 1 deletion common.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static String curseForgeOrOther(version, curseForge, other) {

// list of (dependencyNotation -> should use modImplementation)
def mod_dependencies = [
["fi.dy.masa.malilib:${project.malilib_version}", true],
[mcVersion == 12101 ? "com.github.sakura-ryoko:malilib:${project.malilib_version}" : "fi.dy.masa.malilib:${project.malilib_version}", true],
[curseForgeOrOther(project.tweakeroo_file_id , 'curse.maven:tweakeroo-297344' , 'com.github.sakura-ryoko:tweakeroo' ), true],
[curseForgeOrOther(project.itemscroller_file_id, 'curse.maven:item-scroller-242064', 'com.github.sakura-ryoko:itemscroller'), true],
[curseForgeOrOther(project.minihud_file_id , 'curse.maven:minihud-244260' , 'com.github.sakura-ryoko:minihud' ), true],
Expand Down Expand Up @@ -200,6 +200,7 @@ processResources {
"version": fullModVersion,
"minecraft_dependency": project.minecraft_dependency,
"malilib_dependency": project.malilib_dependency,
"minihud_conflict": project.getProperties().getOrDefault("minihud_conflict", "<0.0.0"),
]
expand valueMap
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
import org.spongepowered.asm.mixin.injection.Slice;
//#endif

//#if MC >= 12101
//$$ import com.llamalad7.mixinextras.lib.apache.commons.tuple.Pair;
//$$ import net.minecraft.nbt.NbtCompound;
//#endif

@Restriction(require = @Condition(ModIds.minihud))
@Mixin(RenderHandler.class)
public abstract class RenderHandlerMixin
Expand All @@ -54,22 +59,37 @@ public abstract class RenderHandlerMixin
),
at = @At(
value = "INVOKE",
//#if MC >= 12101
//$$ target = "Lfi/dy/masa/minihud/event/RenderHandler;getTargetedBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/client/MinecraftClient;)Lcom/llamalad7/mixinextras/lib/apache/commons/tuple/Pair;",
//#else
target = "Lfi/dy/masa/minihud/event/RenderHandler;getTargetedBlockEntity(Lnet/minecraft/world/World;Lnet/minecraft/client/MinecraftClient;)Lnet/minecraft/block/entity/BlockEntity;",
//#endif
ordinal = 0,
remap = true
),
remap = false
)
//#if MC >= 12101
//$$ private Pair<BlockEntity, NbtCompound> serverDataSyncer4BeehiveBeeCount(Pair<BlockEntity, NbtCompound> original)
//#else
private BlockEntity serverDataSyncer4BeehiveBeeCount(BlockEntity blockEntity)
//#endif
{
if (TweakerMoreConfigs.SERVER_DATA_SYNCER.getBooleanValue())
{
//#if MC >= 12101
//$$ BlockEntity blockEntity = original.getLeft();
//#endif
if (blockEntity instanceof BeehiveBlockEntity && !MinecraftClient.getInstance().isIntegratedServerRunning())
{
ServerDataSyncer.getInstance().syncBlockEntity(blockEntity);
}
}
//#if MC >= 12101
//$$ return original;
//#else
return blockEntity;
//#endif
}
//#endif
}
3 changes: 3 additions & 0 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
"tweakermore.mixins.json"
],

"breaks": {
"minihud": "${minihud_conflict}"
},
"depends": {
"fabricloader": ">=0.11.4",
"minecraft": "${minecraft_dependency}",
Expand Down
7 changes: 4 additions & 3 deletions versions/1.21.1/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# Fabric Mod Metadata
minecraft_dependency = 1.21.x
malilib_dependency = >=0.18.0
minihud_conflict = <0.32.51

# Build Information
# The target mc versions for the mod during mod publishing, separated with \n
Expand All @@ -16,7 +17,7 @@

# https://masa.dy.fi/maven/fi/dy/masa/malilib/
# https://jitpack.io/#sakura-ryoko/malilib
malilib_version = malilib-fabric-1.21.1:0.21.0
malilib_version = 1.21-0.21.1

# https://legacy.curseforge.com/minecraft/mc-mods/tweakeroo/files
# tweakeroo-fabric-1.21.1-0.21.50.jar
Expand All @@ -31,8 +32,8 @@
litematica_file_id = 5647809

# https://legacy.curseforge.com/minecraft/mc-mods/minihud/files
# minihud-fabric-1.21.1-0.32.50.jar
minihud_file_id = 5647790
# minihud-fabric-1.21-0.32.51.jar
minihud_file_id = 1.21-0.32.51

# https://maven.terraformersmc.com/releases/com/terraformersmc/modmenu/
mod_menu_version = 11.0.1

0 comments on commit 72b6b91

Please sign in to comment.