-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to new MixinCompiler version.
Notable changes: - MixinCompiler now lets us reference trait classes from the game class loader. - MixinCompiler no longer force defines our modified classes onto the game class loader. It defines them on its own class loader, along with our extension classes. - All traits + markers and Passthrough Interfaces are now registered with `RegisterMultipartTraitsEvent`. - Java traits can now properly override the parent constructor, and aren't forced to no-arg ctors. - Substantial architectural improvements to MixinCompiler.
- Loading branch information
1 parent
dcbc5f4
commit 36923ce
Showing
26 changed files
with
276 additions
and
167 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
85 changes: 85 additions & 0 deletions
85
src/main/java/codechicken/multipart/api/RegisterMultipartTraitsEvent.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,85 @@ | ||
package codechicken.multipart.api; | ||
|
||
import codechicken.multipart.api.part.MultiPart; | ||
import codechicken.multipart.block.TileMultipart; | ||
import codechicken.multipart.util.MultipartGenerator; | ||
import net.minecraftforge.eventbus.api.Event; | ||
import net.minecraftforge.fml.event.IModBusEvent; | ||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; | ||
|
||
/** | ||
* Fired on the mod bus for mods to register their traits and passthrough interfaces | ||
* for {@link TileMultipart} classes. | ||
* <p> | ||
* This is fired at the end of mod loading, from {@link FMLLoadCompleteEvent}. | ||
* <p> | ||
* Created by covers1624 on 20/1/24. | ||
*/ | ||
public final class RegisterMultipartTraitsEvent extends Event implements IModBusEvent { | ||
|
||
private final MultipartGenerator generator; | ||
|
||
public RegisterMultipartTraitsEvent(MultipartGenerator generator) { | ||
this.generator = generator; | ||
} | ||
|
||
/** | ||
* Register {@code trait} to be mixed into the {@link TileMultipart} when | ||
* {@code marker} is found implemented on a {@link MultiPart} instance. | ||
* | ||
* @param marker The part marker class. | ||
* @param trait The trait to implement. | ||
*/ | ||
public void registerTrait(Class<?> marker, Class<? extends TileMultipart> trait) { | ||
generator.registerTrait(marker, trait); | ||
} | ||
|
||
/** | ||
* The same as {@link #registerTrait(Class, Class)} however, only effective client side. | ||
* | ||
* @param marker The part marker class. | ||
* @param trait The trait to implement. | ||
*/ | ||
public void registerClientTrait(Class<?> marker, Class<? extends TileMultipart> trait) { | ||
generator.registerTrait(marker, trait, null); | ||
} | ||
|
||
/** | ||
* The same as {@link #registerTrait(Class, Class)} however, only effective server side (including integrated server). | ||
* | ||
* @param marker The part marker class. | ||
* @param trait The trait to implement. | ||
*/ | ||
public void registerServerTrait(Class<?> marker, Class<? extends TileMultipart> trait) { | ||
generator.registerTrait(marker, null, trait); | ||
} | ||
|
||
/** | ||
* Register the specified class, when found on a {@link MultiPart} instance:<br/> | ||
* - Implemented the interface on the {@link TileMultipart} instance with all methods proxied through to your part.<br/> | ||
* - Only allow one instance of a part with this interface in the block space. | ||
* | ||
* @param iFace The interface to register. | ||
*/ | ||
public void registerPassthroughInterface(Class<?> iFace) { | ||
generator.registerPassThroughInterface(iFace); | ||
} | ||
|
||
/** | ||
* The same as {@link #registerPassthroughInterface(Class)} however, only effective client side. | ||
* | ||
* @param iFace The interface to register. | ||
*/ | ||
public void registerClientPassthroughInterface(Class<?> iFace) { | ||
generator.registerPassThroughInterface(iFace, true, false); | ||
} | ||
|
||
/** | ||
* The same as {@link #registerPassthroughInterface(Class)} however, only effective server side (including integrated server). | ||
* | ||
* @param iFace The interface to register. | ||
*/ | ||
public void registerServerPassthroughInterface(Class<?> iFace) { | ||
generator.registerPassThroughInterface(iFace, false, true); | ||
} | ||
} |
11 changes: 0 additions & 11 deletions
11
src/main/java/codechicken/multipart/api/annotation/MultiPartMarker.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
src/main/java/codechicken/multipart/api/annotation/MultiPartTrait.java
This file was deleted.
Oops, something went wrong.
9 changes: 0 additions & 9 deletions
9
src/main/java/codechicken/multipart/api/annotation/package-info.java
This file was deleted.
Oops, something went wrong.
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
4 changes: 0 additions & 4 deletions
4
src/main/java/codechicken/multipart/api/part/CapabilityProviderPart.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
3 changes: 0 additions & 3 deletions
3
src/main/java/codechicken/multipart/api/part/NeighborTileChangePart.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
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
4 changes: 0 additions & 4 deletions
4
src/main/java/codechicken/multipart/api/part/SlottedPart.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
4 changes: 0 additions & 4 deletions
4
src/main/java/codechicken/multipart/api/part/TickablePart.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
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
9 changes: 6 additions & 3 deletions
9
src/main/java/codechicken/multipart/trait/TAnimateTickTile.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
Oops, something went wrong.