-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
use another way to change recording view distance
- Loading branch information
Showing
6 changed files
with
113 additions
and
64 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
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
37 changes: 37 additions & 0 deletions
37
src/main/java/com/hadroncfy/sreplay/asm/MultipleOrdinalFieldInjectionPoint.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,37 @@ | ||
package com.hadroncfy.sreplay.asm; | ||
|
||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
import org.spongepowered.asm.mixin.injection.InjectionPoint.AtCode; | ||
import org.spongepowered.asm.mixin.injection.points.BeforeFieldAccess; | ||
import org.spongepowered.asm.mixin.injection.struct.InjectionPointData; | ||
|
||
@AtCode("sreplay_MultipleOrdinalField") | ||
public class MultipleOrdinalFieldInjectionPoint extends BeforeFieldAccess { | ||
private final Set<Integer> ordinals = new HashSet<>(); | ||
|
||
public MultipleOrdinalFieldInjectionPoint(InjectionPointData data) { | ||
super(data); | ||
for (String part: data.get("ordinals", "").split(",")){ | ||
part = part.trim(); | ||
try { | ||
if (part.indexOf("..") != -1){ | ||
String[] s = part.split("\\.\\."); | ||
for (int i = Integer.parseInt(s[0]); i <= Integer.parseInt(s[1]); i++){ | ||
ordinals.add(i); | ||
} | ||
} | ||
else { | ||
ordinals.add(Integer.parseInt(part)); | ||
} | ||
} catch(NumberFormatException e){ | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
protected boolean matchesOrdinal(int ordinal) { | ||
return ordinals.contains(ordinal); | ||
} | ||
} |
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