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

Commit 1be31f2

Browse files
committed
reviews
1 parent 39186fc commit 1be31f2

5 files changed

Lines changed: 24 additions & 21 deletions

File tree

patchwork-events-lifecycle/src/main/java/net/minecraftforge/fml/event/lifecycle/FMLFingerprintViolationEvent.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,18 @@
3131
* <p>TODO: Patchwork will never fire this event. All jars that pass through patchwork are modified sweepingly.</p>
3232
*/
3333
public class FMLFingerprintViolationEvent extends ModLifecycleEvent {
34-
private boolean isDirectory;
35-
private Set<String> fingerprints;
36-
private File source;
37-
private String expectedFingerprint;
34+
private final boolean isDirectory;
35+
private final Set<String> fingerprints;
36+
private final File source;
37+
private final String expectedFingerprint;
3838

3939
// For EventBus
4040
public FMLFingerprintViolationEvent() {
4141
super();
42+
this.isDirectory = false;
43+
this.fingerprints = null;
44+
this.source = null;
45+
this.expectedFingerprint = null;
4246
}
4347

4448
public FMLFingerprintViolationEvent(boolean isDirectory, File source, ImmutableSet<String> fingerprints, String expectedFingerprint) {

patchwork-events-lifecycle/src/main/java/net/minecraftforge/fml/event/lifecycle/InterModEnqueueEvent.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@
2424
/**
2525
* This is the third of four commonly called events during mod lifecycle startup.
2626
*
27-
* <p>Called before {@link InterModProcessEvent}
27+
* <p>Called before {@link InterModProcessEvent}</p>
2828
*
29-
* <p></p>Called after {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent}
29+
* <p>Called after {@link FMLClientSetupEvent} or {@link FMLDedicatedServerSetupEvent}</p>
3030
*
31-
* <p>Enqueue {@link net.minecraftforge.fml.InterModComms} messages to other mods with this event.
31+
* <p>Enqueue {@link net.minecraftforge.fml.InterModComms} messages to other mods with this event.</p>
3232
*
33-
* <p>This is a parallel dispatch event.
33+
* <p>This is a parallel dispatch event.</p>
3434
*/
3535
public class InterModEnqueueEvent extends ModLifecycleEvent {
3636
// For EventBus

patchwork-events-lifecycle/src/main/java/net/minecraftforge/fml/event/lifecycle/InterModProcessEvent.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626
/**
2727
* This is the fourth of four commonly called events during mod lifecycle startup.
2828
*
29-
* <p>Called after {@link InterModEnqueueEvent}
29+
* <p>Called after {@link InterModEnqueueEvent}</p>
3030
*
3131
* <p>Retrieve {@link net.minecraftforge.fml.InterModComms} {@link net.minecraftforge.fml.InterModComms.IMCMessage} suppliers
32-
* and process them as you wish with this event.
32+
* and process them as you wish with this event.</p>
3333
*
34-
* <p>This is a parallel dispatch event.
34+
* <p>This is a parallel dispatch event.</p>
3535
*
3636
* @see #getIMCStream()
3737
* @see #getIMCStream(Predicate)

patchwork-fml/src/main/java/net/minecraftforge/fml/InterModComms.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,26 +163,24 @@ public long estimateSize() {
163163

164164
@Override
165165
public boolean tryAdvance(final Consumer<? super IMCMessage> action) {
166-
IMCMessage next;
166+
if (!iterator.hasNext()) {
167+
return false;
168+
}
167169

168-
do {
169-
if (!iterator.hasNext()) {
170-
return false;
171-
}
170+
IMCMessage next = iterator.next();
172171

173-
next = this.iterator.next();
172+
while (iterator.hasNext() && !methodFilter.test(next.method)) {
173+
next = iterator.next();
174174
}
175175

176-
while (!methodFilter.test(next.method));
177-
178176
action.accept(next);
179177
this.iterator.remove();
180178
return true;
181179
}
182180

183181
@Override
184182
public Spliterator<IMCMessage> trySplit() {
185-
return null;
183+
throw new UnsupportedOperationException("forge behavior is return null, report this to Patchwork!");
186184
}
187185
}
188186
}

patchwork-fml/src/main/java/net/minecraftforge/fml/ModList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@
2222
import net.fabricmc.loader.FabricLoader;
2323

2424
public class ModList {
25-
//Patchwork: initalize directly because there's no args
25+
// Patchwork: initalize directly because there's no args
2626
private static ModList INSTANCE = new ModList();
2727

2828
public static ModList get() {
2929
return INSTANCE;
3030
}
3131

3232
public boolean isLoaded(String modId) {
33+
// Patchwork: use Fabric Loader lookup instead of an internal one
3334
return FabricLoader.INSTANCE.isModLoaded(modId);
3435
}
3536
}

0 commit comments

Comments
 (0)