-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge v1.5.4 changes into 1.19 (#225)
- Loading branch information
Showing
35 changed files
with
773 additions
and
637 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
common/src/main/java/com/rpmtw/rpmtw_platform_mod/mixins/FixPackCompatibility.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package com.rpmtw.rpmtw_platform_mod.mixins; | ||
|
||
import com.rpmtw.rpmtw_platform_mod.translation.resourcepack.TranslateResourcePack; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.server.packs.repository.Pack; | ||
import net.minecraft.server.packs.repository.PackCompatibility; | ||
import org.spongepowered.asm.mixin.Final; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; | ||
|
||
@Environment(EnvType.CLIENT) | ||
@Mixin(Pack.class) | ||
public class FixPackCompatibility { | ||
@Shadow | ||
@Final | ||
private String id; | ||
|
||
/** | ||
* Fix the compatibility of the translation resource pack. | ||
* <p> | ||
* Because the translation pack is for 1.19.x, but the pack format in 1.19 ~ 1.19.2 is 9, and the pack format in 1.19.3+ is 12. | ||
* So we need to change the compatibility of the translation pack to {@link PackCompatibility#COMPATIBLE}. | ||
*/ | ||
@Inject(method = "getCompatibility", at = @At(value = "HEAD"), cancellable = true) | ||
public void fixPackCompatibility(CallbackInfoReturnable<PackCompatibility> cir) { | ||
String packId = TranslateResourcePack.INSTANCE.getPackId(); | ||
if (cir.isCancelled() || !id.equals(packId)) return; | ||
|
||
cir.setReturnValue(PackCompatibility.COMPATIBLE); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
common/src/main/java/com/rpmtw/rpmtw_platform_mod/mixins/LoadGameOptions.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.rpmtw.rpmtw_platform_mod.mixins; | ||
|
||
import com.rpmtw.rpmtw_platform_mod.RPMTWPlatformMod; | ||
import com.rpmtw.rpmtw_platform_mod.translation.resourcepack.TranslateResourcePack; | ||
import net.minecraft.client.Options; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(Options.class) | ||
public class LoadGameOptions { | ||
private boolean called = false; | ||
|
||
@Inject(method = "load", at = @At("HEAD")) | ||
public void loading(CallbackInfo ci) { | ||
if (called) return; | ||
|
||
RPMTWPlatformMod.LOGGER.info("Loading the game options..."); | ||
TranslateResourcePack.INSTANCE.init(); | ||
called = true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.