Skip to content

Commit

Permalink
Merge pull request #28 from KatatsumuriPan/1.12.2/forge-dev
Browse files Browse the repository at this point in the history
Update to v1.2.0(1.12.2Forge)
  • Loading branch information
KatatsumuriPan authored Feb 17, 2024
2 parents b1d46d8 + 0d5eb38 commit ada7379
Show file tree
Hide file tree
Showing 13 changed files with 457 additions and 109 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Change Log

### [1.12.2-forge-1.2.0](https://github.com/KatatsumuriPan/BetterLineBreak/releases/tag/1.12.2-forge-1.2.0) - 2024-02-17

- Add Better Questing compatibility.
- Fix vanilla bold width bug.

### [1.12.2-forge-1.1.0](https://github.com/KatatsumuriPan/BetterLineBreak/releases/tag/1.12.2-forge-1.1.0) - 2024-02-10

- Cache budouX model.
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ modGroup = kpan.b_line_break

# Version of your mod.
# This field can be left empty if you want your mod's version to be determined by the latest git tag instead.
modVersion = 1.1.0
modVersion = 1.2.0

# Whether to use the old jar naming structure (modid-mcversion-version) instead of the new version (modid-version)
includeMCVersionJar = false
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/kpan/b_line_break/asm/core/ASMTransformer.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import kpan.b_line_break.asm.core.adapters.MixinAccessorAdapter;
import kpan.b_line_break.asm.tf.TF_FontRenderer;
import kpan.b_line_break.asm.tf.TF_GuiUtilRenderComponents;
import kpan.b_line_break.asm.tf.integration.betterquesting.TF_RenderUtils;
import kpan.b_line_break.asm.tf.integration.smoothfont.TF_FontRendererHook;
import net.minecraft.launchwrapper.IClassTransformer;
import org.objectweb.asm.ClassReader;
Expand Down Expand Up @@ -32,8 +33,11 @@ public byte[] transform(String name, String transformedName, byte[] bytes) {
ClassVisitor cv = cw;
cv = MixinAccessorAdapter.transformAccessor(cv, transformedName);
cv = TF_FontRenderer.appendVisitor(cv, transformedName);
cv = TF_FontRendererHook.appendVisitor(cv, transformedName);
cv = TF_GuiUtilRenderComponents.appendVisitor(cv, transformedName);
//betterquesting
cv = TF_RenderUtils.appendVisitor(cv, transformedName);
//smoothfont
cv = TF_FontRendererHook.appendVisitor(cv, transformedName);

if (cv == cw)
return bytes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,23 @@
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;

import java.util.ArrayList;
import java.util.function.Function;

@SuppressWarnings("unused")
public class InjectInstructionsAdapter extends ReplaceInstructionsAdapter {

private final int injectIndex;

public InjectInstructionsAdapter(MethodVisitor mv, String name, Instructions targets, Instructions instructions, int injectIndex) {
super(mv, name, targets, instructions);
public InjectInstructionsAdapter(MethodVisitor mv, String nameForDebug, Instructions targets, Instructions instructions, int injectIndex) {
super(mv, nameForDebug, targets, instructions);
if (injectIndex < 0)
injectIndex = targets.size() + injectIndex + 1;
this.injectIndex = injectIndex;
}

public InjectInstructionsAdapter(MethodVisitor mv, String nameForDebug, Instructions targets, Function<ArrayList<Instr>, Instructions> instructionFactory, int injectIndex) {
super(mv, nameForDebug, targets, instructionFactory);
if (injectIndex < 0)
injectIndex = targets.size() + injectIndex + 1;
this.injectIndex = injectIndex;
Expand All @@ -27,16 +37,22 @@ protected void visitAllInstructions() {
super.visitAllInstructions();
}

public static InjectInstructionsAdapter before(MethodVisitor mv, String name, Instructions targets, Instructions instructions) {
return new InjectInstructionsAdapter(mv, name, targets, instructions, 0);
public static InjectInstructionsAdapter before(MethodVisitor mv, String nameForDebug, Instructions targets, Instructions instructions) {
return new InjectInstructionsAdapter(mv, nameForDebug, targets, instructions, 0);
}
public static InjectInstructionsAdapter before(MethodVisitor mv, String nameForDebug, Instructions targets, Function<ArrayList<Instr>, Instructions> instructionFactory) {
return new InjectInstructionsAdapter(mv, nameForDebug, targets, instructionFactory, 0);
}

public static InjectInstructionsAdapter after(MethodVisitor mv, String name, Instructions targets, Instructions instructions) {
return new InjectInstructionsAdapter(mv, name, targets, instructions, -1);
public static InjectInstructionsAdapter after(MethodVisitor mv, String nameForDebug, Instructions targets, Instructions instructions) {
return new InjectInstructionsAdapter(mv, nameForDebug, targets, instructions, -1);
}
public static InjectInstructionsAdapter after(MethodVisitor mv, String nameForDebug, Instructions targets, Function<ArrayList<Instr>, Instructions> instructionFactory) {
return new InjectInstructionsAdapter(mv, nameForDebug, targets, instructionFactory, -1);
}

public static ReplaceInstructionsAdapter beforeAfter(MethodVisitor mv, String name, Instructions targets, Instructions before, Instructions after) {
return new InjectInstructionsAdapter(mv, name, targets, before, 0) {
public static ReplaceInstructionsAdapter beforeAfter(MethodVisitor mv, String nameForDebug, Instructions targets, Instructions before, Instructions after) {
return new InjectInstructionsAdapter(mv, nameForDebug, targets, before, 0) {
@Override
protected void visitAllInstructions() {
super.visitAllInstructions();
Expand Down
Loading

0 comments on commit ada7379

Please sign in to comment.