Skip to content
This repository was archived by the owner on Jul 3, 2024. It is now read-only.

Commit 9b42fa7

Browse files
authored
Merge pull request #7 from GTNewHorizons/buildscript
Update buildscript & apply spotless
2 parents 2332745 + fa6fea6 commit 9b42fa7

File tree

114 files changed

+4077
-4536
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+4077
-4536
lines changed

.gitattributes

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
* text eol=lf
2+
3+
*.[jJ][aA][rR] binary
4+
5+
*.[pP][nN][gG] binary
6+
*.[jJ][pP][gG] binary
7+
*.[jJ][pP][eE][gG] binary
8+
*.[gG][iI][fF] binary
9+
*.[tT][iI][fF] binary
10+
*.[tT][iI][fF][fF] binary
11+
*.[iI][cC][oO] binary
12+
*.[sS][vV][gG] text
13+
*.[eE][pP][sS] binary
14+
*.[xX][cC][fF] binary
15+
16+
*.[kK][aA][rR] binary
17+
*.[mM]4[aA] binary
18+
*.[mM][iI][dD] binary
19+
*.[mM][iI][dD][iI] binary
20+
*.[mM][pP]3 binary
21+
*.[oO][gG][gG] binary
22+
*.[rR][aA] binary
23+
24+
*.7[zZ] binary
25+
*.[gG][zZ] binary
26+
*.[tT][aA][rR] binary
27+
*.[tT][gG][zZ] binary
28+
*.[zZ][iI][pP] binary
29+
30+
*.[tT][cC][nN] binary
31+
*.[sS][oO] binary
32+
*.[dD][lL][lL] binary
33+
*.[dD][yY][lL][iI][bB] binary
34+
*.[pP][sS][dD] binary
35+
*.[tT][tT][fF] binary
36+
*.[oO][tT][fF] binary
37+
38+
*.[pP][aA][tT][cC][hH] -text
39+
40+
*.[bB][aA][tT] text eol=crlf
41+
*.[cC][mM][dD] text eol=crlf
42+
*.[pP][sS]1 text eol=crlf
43+
44+
*[aA][uU][tT][oO][gG][eE][nN][eE][rR][aA][tT][eE][dD]* binary

build.gradle

Lines changed: 608 additions & 187 deletions
Large diffs are not rendered by default.

settings.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
plugins {
2+
id 'com.diffplug.blowdryerSetup' version '1.6.0'
3+
}
4+
5+
apply plugin: 'com.diffplug.blowdryerSetup'
6+
7+
blowdryerSetup {
8+
github('GTNewHorizons/ExampleMod1.7.10', 'tag', '0.1.5')
9+
//devLocal '.' // Use this when testing config updates locally
10+
}

src/main/java/codechicken/lib/asm/ASMBlock.java

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package codechicken.lib.asm;
22

3+
import static org.objectweb.asm.tree.AbstractInsnNode.*;
4+
35
import com.google.common.collect.BiMap;
46
import com.google.common.collect.HashBiMap;
57
import com.google.common.collect.ImmutableMap;
8+
import java.util.*;
9+
import java.util.Map.Entry;
610
import org.objectweb.asm.tree.AbstractInsnNode;
711
import org.objectweb.asm.tree.InsnList;
812
import org.objectweb.asm.tree.JumpInsnNode;
913
import org.objectweb.asm.tree.LabelNode;
1014

11-
import java.util.*;
12-
import java.util.Map.Entry;
13-
14-
import static org.objectweb.asm.tree.AbstractInsnNode.*;
15-
16-
public class ASMBlock
17-
{
15+
public class ASMBlock {
1816
public InsnListSection list;
1917
private BiMap<String, LabelNode> labels;
2018

@@ -37,8 +35,7 @@ public ASMBlock() {
3735

3836
public LabelNode getOrAdd(String s) {
3937
LabelNode l = get(s);
40-
if (l == null)
41-
labels.put(s, l = new LabelNode());
38+
if (l == null) labels.put(s, l = new LabelNode());
4239
return l;
4340
}
4441

@@ -51,8 +48,8 @@ public void replaceLabels(Map<LabelNode, LabelNode> labelMap, Set<LabelNode> use
5148
switch (insn.getType()) {
5249
case LABEL:
5350
AbstractInsnNode insn2 = insn.clone(labelMap);
54-
if (insn2 == insn)//identity mapping
55-
continue;
51+
if (insn2 == insn) // identity mapping
52+
continue;
5653
if (usedLabels.contains(insn2))
5754
throw new IllegalStateException("LabelNode cannot be a part of two InsnLists");
5855
list.replace(insn, insn2);
@@ -64,10 +61,9 @@ public void replaceLabels(Map<LabelNode, LabelNode> labelMap, Set<LabelNode> use
6461
list.replace(insn, insn.clone(labelMap));
6562
}
6663

67-
for(Entry<LabelNode, LabelNode> entry : labelMap.entrySet()) {
64+
for (Entry<LabelNode, LabelNode> entry : labelMap.entrySet()) {
6865
String key = labels.inverse().get(entry.getKey());
69-
if(key != null)
70-
labels.put(key, entry.getValue());
66+
if (key != null) labels.put(key, entry.getValue());
7167
}
7268
}
7369

@@ -77,29 +73,25 @@ public void replaceLabels(Map<LabelNode, LabelNode> labelMap) {
7773

7874
public void replaceLabel(String s, LabelNode l) {
7975
LabelNode old = get(s);
80-
if (old != null)
81-
replaceLabels(ImmutableMap.of(old, l));
76+
if (old != null) replaceLabels(ImmutableMap.of(old, l));
8277
}
8378

8479
/**
8580
* Pulls all common labels from other into this
8681
* @return this
8782
*/
8883
public ASMBlock mergeLabels(ASMBlock other) {
89-
if(labels.isEmpty() || other.labels.isEmpty())
90-
return this;
84+
if (labels.isEmpty() || other.labels.isEmpty()) return this;
9185

92-
//common labels, give them our nodes
86+
// common labels, give them our nodes
9387
HashMap<LabelNode, LabelNode> labelMap = list.identityLabelMap();
94-
for(Entry<String, LabelNode> entry : other.labels.entrySet()) {
88+
for (Entry<String, LabelNode> entry : other.labels.entrySet()) {
9589
LabelNode old = labels.get(entry.getKey());
96-
if(old != null)
97-
labelMap.put(old, entry.getValue());
90+
if (old != null) labelMap.put(old, entry.getValue());
9891
}
9992
HashSet<LabelNode> usedLabels = new HashSet<LabelNode>();
10093
for (AbstractInsnNode insn = other.list.list.getFirst(); insn != null; insn = insn.getNext())
101-
if(insn.getType() == LABEL)
102-
usedLabels.add((LabelNode) insn);
94+
if (insn.getType() == LABEL) usedLabels.add((LabelNode) insn);
10395

10496
replaceLabels(labelMap, usedLabels);
10597
return this;
@@ -118,50 +110,50 @@ public ASMBlock copy() {
118110
BiMap<String, LabelNode> labels = HashBiMap.create();
119111
Map<LabelNode, LabelNode> labelMap = list.cloneLabels();
120112

121-
for(Entry<String, LabelNode> entry : this.labels.entrySet())
113+
for (Entry<String, LabelNode> entry : this.labels.entrySet())
122114
labels.put(entry.getKey(), labelMap.get(entry.getValue()));
123115

124116
return new ASMBlock(list.copy(labelMap), labels);
125117
}
126118

127119
public ASMBlock applyLabels(InsnListSection list2) {
128-
if(labels.isEmpty())
129-
return new ASMBlock(list2);
120+
if (labels.isEmpty()) return new ASMBlock(list2);
130121

131122
Set<LabelNode> cFlowLabels1 = labels.values();
132123
Set<LabelNode> cFlowLabels2 = InsnComparator.getControlFlowLabels(list2);
133124
ASMBlock block = new ASMBlock(list2);
134125

135126
HashMap<LabelNode, LabelNode> labelMap = new HashMap<LabelNode, LabelNode>();
136127

137-
for(int i = 0, k = 0; i < list.size() && k < list2.size(); ) {
128+
for (int i = 0, k = 0; i < list.size() && k < list2.size(); ) {
138129
AbstractInsnNode insn1 = list.get(i);
139-
if(!InsnComparator.insnImportant(insn1, cFlowLabels1)) {
130+
if (!InsnComparator.insnImportant(insn1, cFlowLabels1)) {
140131
i++;
141132
continue;
142133
}
143134

144135
AbstractInsnNode insn2 = list2.get(k);
145-
if(!InsnComparator.insnImportant(insn2, cFlowLabels2)) {
136+
if (!InsnComparator.insnImportant(insn2, cFlowLabels2)) {
146137
k++;
147138
continue;
148139
}
149140

150-
if(insn1.getOpcode() != insn2.getOpcode())
151-
throw new IllegalArgumentException("Lists do not match:\n"+list+"\n\n"+list2);
141+
if (insn1.getOpcode() != insn2.getOpcode())
142+
throw new IllegalArgumentException("Lists do not match:\n" + list + "\n\n" + list2);
152143

153-
switch(insn1.getType()) {
144+
switch (insn1.getType()) {
154145
case LABEL:
155146
labelMap.put((LabelNode) insn1, (LabelNode) insn2);
156147
break;
157148
case JUMP_INSN:
158149
labelMap.put(((JumpInsnNode) insn1).label, ((JumpInsnNode) insn2).label);
159150
break;
160151
}
161-
i++; k++;
152+
i++;
153+
k++;
162154
}
163155

164-
for(Entry<String, LabelNode> entry : labels.entrySet())
156+
for (Entry<String, LabelNode> entry : labels.entrySet())
165157
block.labels.put(entry.getKey(), labelMap.get(entry.getValue()));
166158

167159
return block;
@@ -170,4 +162,4 @@ public ASMBlock applyLabels(InsnListSection list2) {
170162
public InsnList rawListCopy() {
171163
return list.copy().list;
172164
}
173-
}
165+
}

0 commit comments

Comments
 (0)