Commit d7a488cd863f5b077fc10a34b3e9db3c037d9e99

Authored by Mumfrey
1 parent 1901d26a

Relocate common

Showing 53 changed files with 2290 additions and 2295 deletions

Too many changes to show.

To preserve performance only 53 of 213 files are displayed.

resources/liteloader.properties deleted 100644 → 0
1   -search.mods=true
2   -search.jar=false
3   -search.classpath=true
4   -log=stderr
5   -brand=
6 0 \ No newline at end of file
java/common/com/mumfrey/liteloader/Configurable.java renamed to src/main/java/com/mumfrey/liteloader/Configurable.java
1   -package com.mumfrey.liteloader;
2   -
3   -import com.mumfrey.liteloader.modconfig.ConfigPanel;
4   -
5   -/**
6   - * Interface for mods which want to provide a configuration panel inside the "mod info" screen
7   - *
8   - * @author Adam Mummery-Smith
9   - */
10   -public interface Configurable
11   -{
12   - /**
13   - * Get the class of the configuration panel to use, the returned class must have a
14   - * default (no-arg) constructor
15   - *
16   - * @return configuration panel class
17   - */
18   - public abstract Class<? extends ConfigPanel> getConfigPanelClass();
19   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import com.mumfrey.liteloader.modconfig.ConfigPanel;
  4 +
  5 +/**
  6 + * Interface for mods which want to provide a configuration panel inside the "mod info" screen
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface Configurable
  11 +{
  12 + /**
  13 + * Get the class of the configuration panel to use, the returned class must have a
  14 + * default (no-arg) constructor
  15 + *
  16 + * @return configuration panel class
  17 + */
  18 + public abstract Class<? extends ConfigPanel> getConfigPanelClass();
  19 +}
... ...
java/common/com/mumfrey/liteloader/LiteMod.java renamed to src/main/java/com/mumfrey/liteloader/LiteMod.java
1   -package com.mumfrey.liteloader;
2   -
3   -import java.io.File;
4   -
5   -import com.mumfrey.liteloader.api.Listener;
6   -import com.mumfrey.liteloader.modconfig.Exposable;
7   -
8   -/**
9   - * Base interface for mods
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface LiteMod extends Exposable, Listener
14   -{
15   - /**
16   - * Get the mod version string
17   - *
18   - * @return the mod version as a string
19   - */
20   - public abstract String getVersion();
21   -
22   - /**
23   - * Do startup stuff here, minecraft is not fully initialised when this function is called so mods *must not*
24   - * interact with minecraft in any way here
25   - *
26   - * @param configPath Configuration path to use
27   - */
28   - public abstract void init(File configPath);
29   -
30   - /**
31   - * Called when the loader detects that a version change has happened since this mod was last loaded
32   - *
33   - * @param version new version
34   - * @param configPath Path for the new version-specific config
35   - * @param oldConfigPath Path for the old version-specific config
36   - */
37   - public abstract void upgradeSettings(String version, File configPath, File oldConfigPath);
38   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import java.io.File;
  4 +
  5 +import com.mumfrey.liteloader.api.Listener;
  6 +import com.mumfrey.liteloader.modconfig.Exposable;
  7 +
  8 +/**
  9 + * Base interface for mods
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface LiteMod extends Exposable, Listener
  14 +{
  15 + /**
  16 + * Get the mod version string
  17 + *
  18 + * @return the mod version as a string
  19 + */
  20 + public abstract String getVersion();
  21 +
  22 + /**
  23 + * Do startup stuff here, minecraft is not fully initialised when this function is called so mods *must not*
  24 + * interact with minecraft in any way here
  25 + *
  26 + * @param configPath Configuration path to use
  27 + */
  28 + public abstract void init(File configPath);
  29 +
  30 + /**
  31 + * Called when the loader detects that a version change has happened since this mod was last loaded
  32 + *
  33 + * @param version new version
  34 + * @param configPath Path for the new version-specific config
  35 + * @param oldConfigPath Path for the old version-specific config
  36 + */
  37 + public abstract void upgradeSettings(String version, File configPath, File oldConfigPath);
  38 +}
... ...
java/common/com/mumfrey/liteloader/PacketHandler.java renamed to src/main/java/com/mumfrey/liteloader/PacketHandler.java
1   -package com.mumfrey.liteloader;
2   -
3   -import java.util.List;
4   -
5   -import net.minecraft.network.INetHandler;
6   -import net.minecraft.network.Packet;
7   -
8   -/**
9   - * Interface for mods which want to handle raw packets
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface PacketHandler extends LiteMod
14   -{
15   - /**
16   - * Get list of packets to handle
17   - */
18   - public List<Class<? extends Packet>> getHandledPackets();
19   -
20   - /**
21   - * @param netHandler The vanilla nethandler which will handle this packet if not cancelled
22   - * @param packet Incoming packet
23   - * @return True to allow further processing of this packet, including other PacketHandlers and eventually the vanilla netHandler, to inhibit further
24   - * processing return false. You may choose to return false and then invoke the vanilla handler method on the supplied INetHandler if you wish to
25   - * inhibit later PacketHandlers but preserve vanilla behaviour.
26   - */
27   - public abstract boolean handlePacket(INetHandler netHandler, Packet packet);
28   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import java.util.List;
  4 +
  5 +import net.minecraft.network.INetHandler;
  6 +import net.minecraft.network.Packet;
  7 +
  8 +/**
  9 + * Interface for mods which want to handle raw packets
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface PacketHandler extends LiteMod
  14 +{
  15 + /**
  16 + * Get list of packets to handle
  17 + */
  18 + public List<Class<? extends Packet>> getHandledPackets();
  19 +
  20 + /**
  21 + * @param netHandler The vanilla nethandler which will handle this packet if not cancelled
  22 + * @param packet Incoming packet
  23 + * @return True to allow further processing of this packet, including other PacketHandlers and eventually the vanilla netHandler, to inhibit further
  24 + * processing return false. You may choose to return false and then invoke the vanilla handler method on the supplied INetHandler if you wish to
  25 + * inhibit later PacketHandlers but preserve vanilla behaviour.
  26 + */
  27 + public abstract boolean handlePacket(INetHandler netHandler, Packet packet);
  28 +}
... ...
java/common/com/mumfrey/liteloader/Permissible.java renamed to src/main/java/com/mumfrey/liteloader/Permissible.java
1   -package com.mumfrey.liteloader;
2   -
3   -import com.mumfrey.liteloader.permissions.PermissionsManager;
4   -import com.mumfrey.liteloader.permissions.PermissionsManagerClient;
5   -
6   -/**
7   - * Interface for mods which use the ClientPermissions system
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface Permissible extends LiteMod
12   -{
13   - /**
14   - * Returns the node name of the mod, replicated permissions will be of the form mod.<name>.permission.node so this
15   - * method must return a valid name for use in permission nodes. This method must also return the same value every
16   - * time it is called since permissible names are not necessarily cached.
17   - *
18   - * @return Permissible name
19   - */
20   - public abstract String getPermissibleModName();
21   -
22   - /**
23   - * The mod version to replicate to the server
24   - *
25   - * @return Mod version as a float
26   - */
27   - public abstract float getPermissibleModVersion();
28   -
29   - /**
30   - * Called by the permissions manager at initialisation to instruct the mod to populate the list of permissions it
31   - * supports. This method should call back against the supplied permissions manager to register the permissions to
32   - * be sent to the server when connecting.
33   - *
34   - * @param permissionsManager Client permissions manager
35   - */
36   - public abstract void registerPermissions(PermissionsManagerClient permissionsManager);
37   -
38   - /**
39   - * Called when the permissions set is cleared
40   - *
41   - * @param manager
42   - */
43   - public abstract void onPermissionsCleared(PermissionsManager manager);
44   -
45   - /**
46   - * Called when the permissions are changed (eg. when new permissions are received from the server)
47   - *
48   - * @param manager
49   - */
50   - public abstract void onPermissionsChanged(PermissionsManager manager);
51   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import com.mumfrey.liteloader.permissions.PermissionsManager;
  4 +import com.mumfrey.liteloader.permissions.PermissionsManagerClient;
  5 +
  6 +/**
  7 + * Interface for mods which use the ClientPermissions system
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface Permissible extends LiteMod
  12 +{
  13 + /**
  14 + * Returns the node name of the mod, replicated permissions will be of the form mod.<name>.permission.node so this
  15 + * method must return a valid name for use in permission nodes. This method must also return the same value every
  16 + * time it is called since permissible names are not necessarily cached.
  17 + *
  18 + * @return Permissible name
  19 + */
  20 + public abstract String getPermissibleModName();
  21 +
  22 + /**
  23 + * The mod version to replicate to the server
  24 + *
  25 + * @return Mod version as a float
  26 + */
  27 + public abstract float getPermissibleModVersion();
  28 +
  29 + /**
  30 + * Called by the permissions manager at initialisation to instruct the mod to populate the list of permissions it
  31 + * supports. This method should call back against the supplied permissions manager to register the permissions to
  32 + * be sent to the server when connecting.
  33 + *
  34 + * @param permissionsManager Client permissions manager
  35 + */
  36 + public abstract void registerPermissions(PermissionsManagerClient permissionsManager);
  37 +
  38 + /**
  39 + * Called when the permissions set is cleared
  40 + *
  41 + * @param manager
  42 + */
  43 + public abstract void onPermissionsCleared(PermissionsManager manager);
  44 +
  45 + /**
  46 + * Called when the permissions are changed (eg. when new permissions are received from the server)
  47 + *
  48 + * @param manager
  49 + */
  50 + public abstract void onPermissionsChanged(PermissionsManager manager);
  51 +}
... ...
java/common/com/mumfrey/liteloader/PlayerInteractionListener.java renamed to src/main/java/com/mumfrey/liteloader/PlayerInteractionListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.entity.player.EntityPlayerMP;
4   -import net.minecraft.util.BlockPos;
5   -import net.minecraft.util.EnumFacing;
6   -import net.minecraft.util.MovingObjectPosition.MovingObjectType;
7   -
8   -/**
9   - * Interface for mods which want to observe the player's "interaction" status (player mouse clicks), allows block interaction
10   - * events to be cancelled.
11   - *
12   - * @author Adam Mummery-Smith
13   - */
14   -public interface PlayerInteractionListener extends LiteMod
15   -{
16   - /**
17   - * Mouse buttons
18   - */
19   - public static enum MouseButton
20   - {
21   - LEFT,
22   - RIGHT
23   - }
24   -
25   - /**
26   - * Called when the player clicks but does not "hit" a block, the trace position is raytraced to the player's current view
27   - * distance and represents the block which the player is "looking at". This method is NOT called when the player right clicks
28   - * with an empty hand.
29   - *
30   - * @param player Player
31   - * @param button Mouse button the user clicked
32   - * @param tracePos Raytraced location of the block which was hit
33   - * @param traceSideHit Raytraced side hit
34   - * @param traceHitType Type of hit, will be MISS if the trace expired without hitting anything (eg. the player clicked the sky)
35   - */
36   - public abstract void onPlayerClickedAir(EntityPlayerMP player, MouseButton button, BlockPos tracePos, EnumFacing traceSideHit, MovingObjectType traceHitType);
37   -
38   - /**
39   - * Calls when the player clicks and hits a block, usually indicates that the player is digging or placing a block, although
40   - * a block placement does not necessarily succeed. Return true from this callback to allow the action to proceed, or false to
41   - * cancel the action. Cancelling the action does not prevent further handlers from receiving the event.
42   - *
43   - * @param player Player
44   - * @param button Mouse button that was pressed (left = dig, right = interact/place)
45   - * @param hitPos Block which was *hit*. Note that block placement will normally be at hitPos.offset(sideHit)
46   - * @param sideHit Side of the block which was hit
47   - * @return true to allow the action to be processed (another listener may still inhibit the action), return false to cancel the action (other listeners will still be notified)
48   - */
49   - public abstract boolean onPlayerClickedBlock(EntityPlayerMP player, MouseButton button, BlockPos hitPos, EnumFacing sideHit);
50   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.entity.player.EntityPlayerMP;
  4 +import net.minecraft.util.BlockPos;
  5 +import net.minecraft.util.EnumFacing;
  6 +import net.minecraft.util.MovingObjectPosition.MovingObjectType;
  7 +
  8 +/**
  9 + * Interface for mods which want to observe the player's "interaction" status (player mouse clicks), allows block interaction
  10 + * events to be cancelled.
  11 + *
  12 + * @author Adam Mummery-Smith
  13 + */
  14 +public interface PlayerInteractionListener extends LiteMod
  15 +{
  16 + /**
  17 + * Mouse buttons
  18 + */
  19 + public static enum MouseButton
  20 + {
  21 + LEFT,
  22 + RIGHT
  23 + }
  24 +
  25 + /**
  26 + * Called when the player clicks but does not "hit" a block, the trace position is raytraced to the player's current view
  27 + * distance and represents the block which the player is "looking at". This method is NOT called when the player right clicks
  28 + * with an empty hand.
  29 + *
  30 + * @param player Player
  31 + * @param button Mouse button the user clicked
  32 + * @param tracePos Raytraced location of the block which was hit
  33 + * @param traceSideHit Raytraced side hit
  34 + * @param traceHitType Type of hit, will be MISS if the trace expired without hitting anything (eg. the player clicked the sky)
  35 + */
  36 + public abstract void onPlayerClickedAir(EntityPlayerMP player, MouseButton button, BlockPos tracePos, EnumFacing traceSideHit, MovingObjectType traceHitType);
  37 +
  38 + /**
  39 + * Calls when the player clicks and hits a block, usually indicates that the player is digging or placing a block, although
  40 + * a block placement does not necessarily succeed. Return true from this callback to allow the action to proceed, or false to
  41 + * cancel the action. Cancelling the action does not prevent further handlers from receiving the event.
  42 + *
  43 + * @param player Player
  44 + * @param button Mouse button that was pressed (left = dig, right = interact/place)
  45 + * @param hitPos Block which was *hit*. Note that block placement will normally be at hitPos.offset(sideHit)
  46 + * @param sideHit Side of the block which was hit
  47 + * @return true to allow the action to be processed (another listener may still inhibit the action), return false to cancel the action (other listeners will still be notified)
  48 + */
  49 + public abstract boolean onPlayerClickedBlock(EntityPlayerMP player, MouseButton button, BlockPos hitPos, EnumFacing sideHit);
  50 +}
... ...
java/common/com/mumfrey/liteloader/PlayerMoveListener.java renamed to src/main/java/com/mumfrey/liteloader/PlayerMoveListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.entity.player.EntityPlayerMP;
4   -
5   -import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
6   -import com.mumfrey.liteloader.util.Position;
7   -
8   -/**
9   - * Interface for mods which want to monitor or control player movements
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface PlayerMoveListener extends LiteMod
14   -{
15   - /**
16   - * Called when a movement/look packet is received from the client.
17   - *
18   - * @param playerMP Player moving
19   - * @param from Player's previous recorded position
20   - * @param to Position the player is attempting to move to
21   - * @param newPos Set this position to teleport the player to newPos instead of processing the original move
22   - *
23   - * @return false to cancel the event or true to allow the movement to be processed as normal or newPos to be applied
24   - */
25   - public abstract boolean onPlayerMove(EntityPlayerMP playerMP, Position from, Position to, ReturnValue<Position> newPos);
26   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.entity.player.EntityPlayerMP;
  4 +
  5 +import com.mumfrey.liteloader.core.LiteLoaderEventBroker.ReturnValue;
  6 +import com.mumfrey.liteloader.util.Position;
  7 +
  8 +/**
  9 + * Interface for mods which want to monitor or control player movements
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface PlayerMoveListener extends LiteMod
  14 +{
  15 + /**
  16 + * Called when a movement/look packet is received from the client.
  17 + *
  18 + * @param playerMP Player moving
  19 + * @param from Player's previous recorded position
  20 + * @param to Position the player is attempting to move to
  21 + * @param newPos Set this position to teleport the player to newPos instead of processing the original move
  22 + *
  23 + * @return false to cancel the event or true to allow the movement to be processed as normal or newPos to be applied
  24 + */
  25 + public abstract boolean onPlayerMove(EntityPlayerMP playerMP, Position from, Position to, ReturnValue<Position> newPos);
  26 +}
... ...
java/common/com/mumfrey/liteloader/PluginChannelListener.java renamed to src/main/java/com/mumfrey/liteloader/PluginChannelListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.network.PacketBuffer;
4   -
5   -import com.mumfrey.liteloader.core.CommonPluginChannelListener;
6   -
7   -/**
8   - * Interface for mods which want to use plugin channels
9   - *
10   - * @author Adam Mummery-Smith
11   - */
12   -public interface PluginChannelListener extends LiteMod, CommonPluginChannelListener
13   -{
14   - /**
15   - * Called when a custom payload packet arrives on a channel this mod has registered
16   - *
17   - * @param channel Channel on which the custom payload was received
18   - * @param data Custom payload data
19   - */
20   - public abstract void onCustomPayload(String channel, PacketBuffer data);
21   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.network.PacketBuffer;
  4 +
  5 +import com.mumfrey.liteloader.core.CommonPluginChannelListener;
  6 +
  7 +/**
  8 + * Interface for mods which want to use plugin channels
  9 + *
  10 + * @author Adam Mummery-Smith
  11 + */
  12 +public interface PluginChannelListener extends LiteMod, CommonPluginChannelListener
  13 +{
  14 + /**
  15 + * Called when a custom payload packet arrives on a channel this mod has registered
  16 + *
  17 + * @param channel Channel on which the custom payload was received
  18 + * @param data Custom payload data
  19 + */
  20 + public abstract void onCustomPayload(String channel, PacketBuffer data);
  21 +}
... ...
java/common/com/mumfrey/liteloader/PreJoinGameListener.java renamed to src/main/java/com/mumfrey/liteloader/PreJoinGameListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.network.INetHandler;
4   -import net.minecraft.network.play.server.S01PacketJoinGame;
5   -
6   -
7   -/**
8   - * Interface for mods which wish to be notified when the player connects to a server (or local game)
9   - *
10   - * @author Adam Mummery-Smith
11   - */
12   -public interface PreJoinGameListener extends LiteMod
13   -{
14   - /**
15   - * Called before login. NOTICE: as of 1.8 the return value of this method has a different meaning!
16   - *
17   - * @param netHandler Net handler
18   - * @param joinGamePacket Join game packet
19   - *
20   - * @return true to allow login to continue, false to cancel login
21   - */
22   - public abstract boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket);
23   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.network.INetHandler;
  4 +import net.minecraft.network.play.server.S01PacketJoinGame;
  5 +
  6 +
  7 +/**
  8 + * Interface for mods which wish to be notified when the player connects to a server (or local game)
  9 + *
  10 + * @author Adam Mummery-Smith
  11 + */
  12 +public interface PreJoinGameListener extends LiteMod
  13 +{
  14 + /**
  15 + * Called before login. NOTICE: as of 1.8 the return value of this method has a different meaning!
  16 + *
  17 + * @param netHandler Net handler
  18 + * @param joinGamePacket Join game packet
  19 + *
  20 + * @return true to allow login to continue, false to cancel login
  21 + */
  22 + public abstract boolean onPreJoinGame(INetHandler netHandler, S01PacketJoinGame joinGamePacket);
  23 +}
... ...
java/common/com/mumfrey/liteloader/Priority.java renamed to src/main/java/com/mumfrey/liteloader/Priority.java
1   -package com.mumfrey.liteloader;
2   -
3   -import java.lang.annotation.ElementType;
4   -import java.lang.annotation.Retention;
5   -import java.lang.annotation.RetentionPolicy;
6   -import java.lang.annotation.Target;
7   -
8   -/**
9   - * Priority declaration for LiteMods, used when sorting listener lists. Default value if no Priority annotation
10   - * is specified is 1000.
11   - *
12   - * @author Adam Mummery-Smith
13   - */
14   -@Target(ElementType.TYPE)
15   -@Retention(RetentionPolicy.RUNTIME)
16   -public @interface Priority
17   -{
18   - /**
19   - * Priority value, default priority is 1000
20   - */
21   - public int value();
22   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import java.lang.annotation.ElementType;
  4 +import java.lang.annotation.Retention;
  5 +import java.lang.annotation.RetentionPolicy;
  6 +import java.lang.annotation.Target;
  7 +
  8 +/**
  9 + * Priority declaration for LiteMods, used when sorting listener lists. Default value if no Priority annotation
  10 + * is specified is 1000.
  11 + *
  12 + * @author Adam Mummery-Smith
  13 + */
  14 +@Target(ElementType.TYPE)
  15 +@Retention(RetentionPolicy.RUNTIME)
  16 +public @interface Priority
  17 +{
  18 + /**
  19 + * Priority value, default priority is 1000
  20 + */
  21 + public int value();
  22 +}
... ...
java/common/com/mumfrey/liteloader/ServerChatFilter.java renamed to src/main/java/com/mumfrey/liteloader/ServerChatFilter.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.entity.player.EntityPlayerMP;
4   -import net.minecraft.network.play.client.C01PacketChatMessage;
5   -
6   -/**
7   - * Interface for mods which can filter inbound chat
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface ServerChatFilter extends LiteMod
12   -{
13   - /**
14   - * Chat filter function, return false to filter this packet, true to pass the packet
15   - *
16   - * @param chatPacket Chat packet to examine
17   - * @param message Chat message
18   - * @return True to keep the packet, false to discard
19   - */
20   - public abstract boolean onChat(EntityPlayerMP player, C01PacketChatMessage chatPacket, String message);
21   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.entity.player.EntityPlayerMP;
  4 +import net.minecraft.network.play.client.C01PacketChatMessage;
  5 +
  6 +/**
  7 + * Interface for mods which can filter inbound chat
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface ServerChatFilter extends LiteMod
  12 +{
  13 + /**
  14 + * Chat filter function, return false to filter this packet, true to pass the packet
  15 + *
  16 + * @param chatPacket Chat packet to examine
  17 + * @param message Chat message
  18 + * @return True to keep the packet, false to discard
  19 + */
  20 + public abstract boolean onChat(EntityPlayerMP player, C01PacketChatMessage chatPacket, String message);
  21 +}
... ...
java/common/com/mumfrey/liteloader/ServerCommandProvider.java renamed to src/main/java/com/mumfrey/liteloader/ServerCommandProvider.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.command.ServerCommandManager;
4   -
5   -
6   -/**
7   - * Interface for mods which provide commands to the local integrated server
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface ServerCommandProvider extends LiteMod
12   -{
13   - /**
14   - * Allows the mod to provide commands to the server command manager my invoking commandManager.registerCommand() to
15   - * provide new commands for single player and lan worlds
16   - *
17   - * @param commandManager
18   - */
19   - public abstract void provideCommands(ServerCommandManager commandManager);
20   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.command.ServerCommandManager;
  4 +
  5 +
  6 +/**
  7 + * Interface for mods which provide commands to the local integrated server
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface ServerCommandProvider extends LiteMod
  12 +{
  13 + /**
  14 + * Allows the mod to provide commands to the server command manager my invoking commandManager.registerCommand() to
  15 + * provide new commands for single player and lan worlds
  16 + *
  17 + * @param commandManager
  18 + */
  19 + public abstract void provideCommands(ServerCommandManager commandManager);
  20 +}
... ...
java/common/com/mumfrey/liteloader/ServerPlayerListener.java renamed to src/main/java/com/mumfrey/liteloader/ServerPlayerListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.entity.player.EntityPlayerMP;
4   -
5   -import com.mojang.authlib.GameProfile;
6   -
7   -/**
8   - * Interface for mods which want to handle players joining and leaving a LAN game (or single player game)
9   - *
10   - * @author Adam Mummery-Smith
11   - */
12   -public interface ServerPlayerListener extends LiteMod
13   -{
14   - /**
15   - * Called when a player connects to the server and the EntityPlayerMP instance is created, the player has not logged
16   - * in at this point and may be disconnected if login fails
17   - *
18   - * @param player Player attempting to connect
19   - * @param profile Player's GameProfile from the authentication service
20   - */
21   - public abstract void onPlayerConnect(EntityPlayerMP player, GameProfile profile);
22   -
23   - /**
24   - * Called once the player has successfully logged in and all player variables are initialised and replicated
25   - *
26   - * @param player Player connected
27   - */
28   - public abstract void onPlayerLoggedIn(EntityPlayerMP player);
29   -
30   - /**
31   - * Called when a player respawns. This event is raised when a player respawns after dying or conquers the end
32   - *
33   - * @param player New player instance
34   - * @param oldPlayer Old player instance being discarded
35   - * @param newDimension Dimension the player is respawning in
36   - * @param playerWonTheGame True if the player conquered the end (this respawn is NOT as the result of a death)
37   - */
38   - public abstract void onPlayerRespawn(EntityPlayerMP player, EntityPlayerMP oldPlayer, int newDimension, boolean playerWonTheGame);
39   -
40   - /**
41   - * Called when a player disconnects from the game
42   - *
43   - * @param player Player disconnecting
44   - */
45   - public abstract void onPlayerLogout(EntityPlayerMP player);
46   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.entity.player.EntityPlayerMP;
  4 +
  5 +import com.mojang.authlib.GameProfile;
  6 +
  7 +/**
  8 + * Interface for mods which want to handle players joining and leaving a LAN game (or single player game)
  9 + *
  10 + * @author Adam Mummery-Smith
  11 + */
  12 +public interface ServerPlayerListener extends LiteMod
  13 +{
  14 + /**
  15 + * Called when a player connects to the server and the EntityPlayerMP instance is created, the player has not logged
  16 + * in at this point and may be disconnected if login fails
  17 + *
  18 + * @param player Player attempting to connect
  19 + * @param profile Player's GameProfile from the authentication service
  20 + */
  21 + public abstract void onPlayerConnect(EntityPlayerMP player, GameProfile profile);
  22 +
  23 + /**
  24 + * Called once the player has successfully logged in and all player variables are initialised and replicated
  25 + *
  26 + * @param player Player connected
  27 + */
  28 + public abstract void onPlayerLoggedIn(EntityPlayerMP player);
  29 +
  30 + /**
  31 + * Called when a player respawns. This event is raised when a player respawns after dying or conquers the end
  32 + *
  33 + * @param player New player instance
  34 + * @param oldPlayer Old player instance being discarded
  35 + * @param newDimension Dimension the player is respawning in
  36 + * @param playerWonTheGame True if the player conquered the end (this respawn is NOT as the result of a death)
  37 + */
  38 + public abstract void onPlayerRespawn(EntityPlayerMP player, EntityPlayerMP oldPlayer, int newDimension, boolean playerWonTheGame);
  39 +
  40 + /**
  41 + * Called when a player disconnects from the game
  42 + *
  43 + * @param player Player disconnecting
  44 + */
  45 + public abstract void onPlayerLogout(EntityPlayerMP player);
  46 +}
... ...
java/common/com/mumfrey/liteloader/ServerPluginChannelListener.java renamed to src/main/java/com/mumfrey/liteloader/ServerPluginChannelListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.entity.player.EntityPlayerMP;
4   -import net.minecraft.network.PacketBuffer;
5   -
6   -import com.mumfrey.liteloader.core.CommonPluginChannelListener;
7   -
8   -/**
9   - * Interface for mods which want to use plugin channels on the (integrated) server side
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface ServerPluginChannelListener extends CommonPluginChannelListener
14   -{
15   - /**
16   - * Called when a custom payload packet arrives on a channel this mod has registered
17   - *
18   - * @param sender Player object which is the source of this message
19   - * @param channel Channel on which the custom payload was received
20   - * @param data Custom payload data
21   - */
22   - public abstract void onCustomPayload(EntityPlayerMP sender, String channel, PacketBuffer data);
23   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.entity.player.EntityPlayerMP;
  4 +import net.minecraft.network.PacketBuffer;
  5 +
  6 +import com.mumfrey.liteloader.core.CommonPluginChannelListener;
  7 +
  8 +/**
  9 + * Interface for mods which want to use plugin channels on the (integrated) server side
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface ServerPluginChannelListener extends CommonPluginChannelListener
  14 +{
  15 + /**
  16 + * Called when a custom payload packet arrives on a channel this mod has registered
  17 + *
  18 + * @param sender Player object which is the source of this message
  19 + * @param channel Channel on which the custom payload was received
  20 + * @param data Custom payload data
  21 + */
  22 + public abstract void onCustomPayload(EntityPlayerMP sender, String channel, PacketBuffer data);
  23 +}
... ...
java/common/com/mumfrey/liteloader/ServerTickable.java renamed to src/main/java/com/mumfrey/liteloader/ServerTickable.java
1   -package com.mumfrey.liteloader;
2   -
3   -import net.minecraft.server.MinecraftServer;
4   -
5   -/**
6   - * Interface for mods which want to be ticked on the server thread
7   - *
8   - * @author Adam Mummery-Smith
9   - */
10   -public interface ServerTickable extends LiteMod
11   -{
12   - /**
13   - * Called at the start of every server update tick
14   - *
15   - * @param server
16   - */
17   - public abstract void onTick(MinecraftServer server);
18   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +import net.minecraft.server.MinecraftServer;
  4 +
  5 +/**
  6 + * Interface for mods which want to be ticked on the server thread
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface ServerTickable extends LiteMod
  11 +{
  12 + /**
  13 + * Called at the start of every server update tick
  14 + *
  15 + * @param server
  16 + */
  17 + public abstract void onTick(MinecraftServer server);
  18 +}
... ...
java/common/com/mumfrey/liteloader/ShutdownListener.java renamed to src/main/java/com/mumfrey/liteloader/ShutdownListener.java
1   -package com.mumfrey.liteloader;
2   -
3   -/**
4   - * Interface for mods that want to receive an event when the game is shutting down due to a user request. They do
5   - * not receive the callback when the VM is terminating for other reasons, use a regular VM shutdownhook for that.
6   - *
7   - * @author Adam Mummery-Smith
8   - */
9   -public interface ShutdownListener extends LiteMod
10   -{
11   - public abstract void onShutDown();
12   -}
  1 +package com.mumfrey.liteloader;
  2 +
  3 +/**
  4 + * Interface for mods that want to receive an event when the game is shutting down due to a user request. They do
  5 + * not receive the callback when the VM is terminating for other reasons, use a regular VM shutdownhook for that.
  6 + *
  7 + * @author Adam Mummery-Smith
  8 + */
  9 +public interface ShutdownListener extends LiteMod
  10 +{
  11 + public abstract void onShutDown();
  12 +}
... ...
java/common/com/mumfrey/liteloader/api/BrandingProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/BrandingProvider.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.net.URI;
4   -
5   -import net.minecraft.util.ResourceLocation;
6   -
7   -import com.mumfrey.liteloader.util.render.Icon;
8   -
9   -/**
10   - * LiteLoader Extensible API - Branding Provider
11   - *
12   - * The Branding Provider manages loader branding alterations for a particular API. This is an optional
13   - * API component which allows an API to specify customisations and additions to the loader environment
14   - * in order to provide a more comfortable integration for the API.
15   - *
16   - * Since some branding options simply stack (like the API copyright notices for example) all APIs will
17   - * be allowed to supply this information, however other options (like the main logo image) can only be
18   - * set by one API. To determine which API should be used to set this information, the getPriority()
19   - * method will be called and used to sort branding providers by priority, with highest priority winning.
20   - *
21   - * All branding options may return a null/not set value, allowing a branding provider to only override
22   - * the branding features it wishes. Some options require a non-null value to be returned from a set of
23   - * methods in order to take effect. eg. the logo option requires non-null return values from BOTH the
24   - * getLogoResource() and getLogoCoords() methods.
25   - *
26   - * @author Adam Mummery-Smith
27   - */
28   -public interface BrandingProvider extends CustomisationProvider
29   -{
30   - /**
31   - * Get the priority of this provider, higher numbers take precedence. Some brandings can only be set
32   - * by one provider (eg. the main "about" logo) so the branding provider with the highest priority will
33   - * be the one which gets control of that feature.
34   - */
35   - public abstract int getPriority();
36   -
37   - /**
38   - * Get the primary branding colour for this API, the branding provider should return 0 if it
39   - * does not wish to override the branding colour. The branding colour is used for the mod list
40   - * entries and hyper-links within the about GUI panels, the colour returned should be fully opaque.
41   - */
42   - public abstract int getBrandingColour();
43   -
44   - /**
45   - * Get the resource to use for the main logo, the API with the highest priority gets to define the
46   - * logo, this method can return null if this API does not want to override the logo
47   - */
48   - public abstract ResourceLocation getLogoResource();
49   -
50   - /**
51   - * Gets the coordinates of the logo as an IIcon instance, only called if getLogoResource() returns
52   - * a non-null value and the logo will only be used if BOTH methods return a valid object.
53   - */
54   - public abstract Icon getLogoCoords();
55   -
56   - /**
57   - * Get the resource to use for the icon logo (the chicken in the default setup), the API with the
58   - * highest priority gets to define the icon logo, this method can return null if this API does not
59   - * want to override the icon
60   - */
61   - public abstract ResourceLocation getIconResource();
62   -
63   - /**
64   - * Gets the coordinates of the icon logo as an IIcon instance, only called if getIconResource()
65   - * returns a non-null value and the icon will only be used if BOTH methods return a valid object.
66   - */
67   - public abstract Icon getIconCoords();
68   -
69   - /**
70   - * Get the display name for this API, used on the "about" screen, must not return null
71   - */
72   - public abstract String getDisplayName();
73   -
74   - /**
75   - * Get the copyright text for this API, used on the "about" screen, must not return null
76   - */
77   - public abstract String getCopyrightText();
78   -
79   - /**
80   - * Get the main home page URL for this API, used on the "about" screen, must not return null
81   - */
82   - public abstract URI getHomepage();
83   -
84   - /**
85   - * If you wish to display a clickable twitter icon next to the API information in the "about" panel
86   - * then you must return values from this method as well as getTwitterAvatarResource() and
87   - * getTwitterAvatarCoords(). Return the twitter user name here.
88   - */
89   - public abstract String getTwitterUserName();
90   -
91   - /**
92   - * If you wish to display a clickable twitter icon next to the API information, return the icon
93   - * resource here.
94   - */
95   - public abstract ResourceLocation getTwitterAvatarResource();
96   -
97   - /**
98   - * If you wish to display a clickable twitter icon next to the API information, return the icon
99   - * coordinates here.
100   - */
101   - public abstract Icon getTwitterAvatarCoords();
102   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.net.URI;
  4 +
  5 +import net.minecraft.util.ResourceLocation;
  6 +
  7 +import com.mumfrey.liteloader.util.render.Icon;
  8 +
  9 +/**
  10 + * LiteLoader Extensible API - Branding Provider
  11 + *
  12 + * The Branding Provider manages loader branding alterations for a particular API. This is an optional
  13 + * API component which allows an API to specify customisations and additions to the loader environment
  14 + * in order to provide a more comfortable integration for the API.
  15 + *
  16 + * Since some branding options simply stack (like the API copyright notices for example) all APIs will
  17 + * be allowed to supply this information, however other options (like the main logo image) can only be
  18 + * set by one API. To determine which API should be used to set this information, the getPriority()
  19 + * method will be called and used to sort branding providers by priority, with highest priority winning.
  20 + *
  21 + * All branding options may return a null/not set value, allowing a branding provider to only override
  22 + * the branding features it wishes. Some options require a non-null value to be returned from a set of
  23 + * methods in order to take effect. eg. the logo option requires non-null return values from BOTH the
  24 + * getLogoResource() and getLogoCoords() methods.
  25 + *
  26 + * @author Adam Mummery-Smith
  27 + */
  28 +public interface BrandingProvider extends CustomisationProvider
  29 +{
  30 + /**
  31 + * Get the priority of this provider, higher numbers take precedence. Some brandings can only be set
  32 + * by one provider (eg. the main "about" logo) so the branding provider with the highest priority will
  33 + * be the one which gets control of that feature.
  34 + */
  35 + public abstract int getPriority();
  36 +
  37 + /**
  38 + * Get the primary branding colour for this API, the branding provider should return 0 if it
  39 + * does not wish to override the branding colour. The branding colour is used for the mod list
  40 + * entries and hyper-links within the about GUI panels, the colour returned should be fully opaque.
  41 + */
  42 + public abstract int getBrandingColour();
  43 +
  44 + /**
  45 + * Get the resource to use for the main logo, the API with the highest priority gets to define the
  46 + * logo, this method can return null if this API does not want to override the logo
  47 + */
  48 + public abstract ResourceLocation getLogoResource();
  49 +
  50 + /**
  51 + * Gets the coordinates of the logo as an IIcon instance, only called if getLogoResource() returns
  52 + * a non-null value and the logo will only be used if BOTH methods return a valid object.
  53 + */
  54 + public abstract Icon getLogoCoords();
  55 +
  56 + /**
  57 + * Get the resource to use for the icon logo (the chicken in the default setup), the API with the
  58 + * highest priority gets to define the icon logo, this method can return null if this API does not
  59 + * want to override the icon
  60 + */
  61 + public abstract ResourceLocation getIconResource();
  62 +
  63 + /**
  64 + * Gets the coordinates of the icon logo as an IIcon instance, only called if getIconResource()
  65 + * returns a non-null value and the icon will only be used if BOTH methods return a valid object.
  66 + */
  67 + public abstract Icon getIconCoords();
  68 +
  69 + /**
  70 + * Get the display name for this API, used on the "about" screen, must not return null
  71 + */
  72 + public abstract String getDisplayName();
  73 +
  74 + /**
  75 + * Get the copyright text for this API, used on the "about" screen, must not return null
  76 + */
  77 + public abstract String getCopyrightText();
  78 +
  79 + /**
  80 + * Get the main home page URL for this API, used on the "about" screen, must not return null
  81 + */
  82 + public abstract URI getHomepage();
  83 +
  84 + /**
  85 + * If you wish to display a clickable twitter icon next to the API information in the "about" panel
  86 + * then you must return values from this method as well as getTwitterAvatarResource() and
  87 + * getTwitterAvatarCoords(). Return the twitter user name here.
  88 + */
  89 + public abstract String getTwitterUserName();
  90 +
  91 + /**
  92 + * If you wish to display a clickable twitter icon next to the API information, return the icon
  93 + * resource here.
  94 + */
  95 + public abstract ResourceLocation getTwitterAvatarResource();
  96 +
  97 + /**
  98 + * If you wish to display a clickable twitter icon next to the API information, return the icon
  99 + * coordinates here.
  100 + */
  101 + public abstract Icon getTwitterAvatarCoords();
  102 +}
... ...
java/common/com/mumfrey/liteloader/api/ContainerRegistry.java renamed to src/main/java/com/mumfrey/liteloader/api/ContainerRegistry.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.io.File;
4   -import java.util.Collection;
5   -
6   -import com.mumfrey.liteloader.core.ModInfo;
7   -import com.mumfrey.liteloader.interfaces.Loadable;
8   -import com.mumfrey.liteloader.interfaces.LoadableMod;
9   -import com.mumfrey.liteloader.interfaces.TweakContainer;
10   -
11   -/**
12   - * Registry for enabled, disabled, injected and bad containers
13   - *
14   - * @author Adam Mummery-Smith
15   - */
16   -public interface ContainerRegistry
17   -{
18   - public enum DisabledReason
19   - {
20   - UNKNOWN("Container %s is could not be loaded for UNKNOWN reason"),
21   - USER_DISABLED("Container %s is disabled"),
22   - MISSING_DEPENDENCY("Container %s is missing one or more dependencies"),
23   - MISSING_API("Container %s is missing one or more required APIs");
24   -
25   - private final String message;
26   -
27   - private DisabledReason(String message)
28   - {
29   - this.message = message;
30   - }
31   -
32   - public String getMessage(LoadableMod<?> container)
33   - {
34   - return String.format(this.message, container);
35   - }
36   - }
37   -
38   - /**
39   - * Register an enabled container, removes the container from the disabled containers list if present
40   - */
41   - public abstract void registerEnabledContainer(LoadableMod<?> container);
42   -
43   - /**
44   - * Get all enabled containers
45   - */
46   - public abstract Collection<? extends LoadableMod<?>> getEnabledContainers();
47   -
48   - /**
49   - * Get a specific enabled container by id
50   - */
51   - public abstract LoadableMod<?> getEnabledContainer(String identifier);
52   -
53   - /**
54   - * Register a disabled container
55   - */
56   - public abstract void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason);
57   -
58   - /**
59   - * Get all disabled containers
60   - */
61   - public abstract Collection<? extends ModInfo<Loadable<?>>> getDisabledContainers();
62   -
63   - /**
64   - * Check whether a specific container is registered as disabled
65   - */
66   - public abstract boolean isDisabledContainer(LoadableMod<?> container);
67   -
68   - /**
69   - * Register a bad container
70   - */
71   - public abstract void registerBadContainer(Loadable<?> container, String reason);
72   -
73   - /**
74   - * Get all bad containers
75   - */
76   - public abstract Collection<? extends ModInfo<Loadable<?>>> getBadContainers();
77   -
78   - /**
79   - * Register a candidate tweak container
80   - */
81   - public abstract void registerTweakContainer(TweakContainer<File> container);
82   -
83   - /**
84   - * Get all registered tweak containers
85   - */
86   - public abstract Collection<TweakContainer<File>> getTweakContainers();
87   -
88   - /**
89   - * Register an injected tweak container
90   - */
91   - public abstract void registerInjectedTweak(TweakContainer<File> container);
92   -
93   - /**
94   - * Get all injected tweak containers
95   - */
96   - public abstract Collection<? extends ModInfo<Loadable<?>>> getInjectedTweaks();
97   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.io.File;
  4 +import java.util.Collection;
  5 +
  6 +import com.mumfrey.liteloader.core.ModInfo;
  7 +import com.mumfrey.liteloader.interfaces.Loadable;
  8 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  9 +import com.mumfrey.liteloader.interfaces.TweakContainer;
  10 +
  11 +/**
  12 + * Registry for enabled, disabled, injected and bad containers
  13 + *
  14 + * @author Adam Mummery-Smith
  15 + */
  16 +public interface ContainerRegistry
  17 +{
  18 + public enum DisabledReason
  19 + {
  20 + UNKNOWN("Container %s is could not be loaded for UNKNOWN reason"),
  21 + USER_DISABLED("Container %s is disabled"),
  22 + MISSING_DEPENDENCY("Container %s is missing one or more dependencies"),
  23 + MISSING_API("Container %s is missing one or more required APIs");
  24 +
  25 + private final String message;
  26 +
  27 + private DisabledReason(String message)
  28 + {
  29 + this.message = message;
  30 + }
  31 +
  32 + public String getMessage(LoadableMod<?> container)
  33 + {
  34 + return String.format(this.message, container);
  35 + }
  36 + }
  37 +
  38 + /**
  39 + * Register an enabled container, removes the container from the disabled containers list if present
  40 + */
  41 + public abstract void registerEnabledContainer(LoadableMod<?> container);
  42 +
  43 + /**
  44 + * Get all enabled containers
  45 + */
  46 + public abstract Collection<? extends LoadableMod<?>> getEnabledContainers();
  47 +
  48 + /**
  49 + * Get a specific enabled container by id
  50 + */
  51 + public abstract LoadableMod<?> getEnabledContainer(String identifier);
  52 +
  53 + /**
  54 + * Register a disabled container
  55 + */
  56 + public abstract void registerDisabledContainer(LoadableMod<?> container, DisabledReason reason);
  57 +
  58 + /**
  59 + * Get all disabled containers
  60 + */
  61 + public abstract Collection<? extends ModInfo<Loadable<?>>> getDisabledContainers();
  62 +
  63 + /**
  64 + * Check whether a specific container is registered as disabled
  65 + */
  66 + public abstract boolean isDisabledContainer(LoadableMod<?> container);
  67 +
  68 + /**
  69 + * Register a bad container
  70 + */
  71 + public abstract void registerBadContainer(Loadable<?> container, String reason);
  72 +
  73 + /**
  74 + * Get all bad containers
  75 + */
  76 + public abstract Collection<? extends ModInfo<Loadable<?>>> getBadContainers();
  77 +
  78 + /**
  79 + * Register a candidate tweak container
  80 + */
  81 + public abstract void registerTweakContainer(TweakContainer<File> container);
  82 +
  83 + /**
  84 + * Get all registered tweak containers
  85 + */
  86 + public abstract Collection<TweakContainer<File>> getTweakContainers();
  87 +
  88 + /**
  89 + * Register an injected tweak container
  90 + */
  91 + public abstract void registerInjectedTweak(TweakContainer<File> container);
  92 +
  93 + /**
  94 + * Get all injected tweak containers
  95 + */
  96 + public abstract Collection<? extends ModInfo<Loadable<?>>> getInjectedTweaks();
  97 +}
... ...
java/common/com/mumfrey/liteloader/api/CoreProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/CoreProvider.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import net.minecraft.network.INetHandler;
4   -import net.minecraft.network.play.server.S01PacketJoinGame;
5   -
6   -import com.mumfrey.liteloader.common.GameEngine;
7   -import com.mumfrey.liteloader.core.LiteLoaderMods;
8   -
9   -/**
10   - * LiteLoader Extensible API - API Core Provider
11   - *
12   - * Core Providers are objects whose lifecycle is equivalent to the run time of game and thus the entire
13   - * lifecycle of your API, they are instanced early in the loader startup process. CoreProviders can implement
14   - * any Observer interface as appropriate and are automatically considered when allocating Observers to
15   - * callback lists
16   - *
17   - * @author Adam Mummery-Smith
18   - */
19   -public interface CoreProvider extends TickObserver, WorldObserver, ShutdownObserver, PostRenderObserver
20   -{
21   - public abstract void onInit();
22   -
23   - /**
24   - * During the postInit phase, the mods which were discovered during preInit phase are initialised and the
25   - * interfaces are allocated. This callback is invoked at the very start of the postInit phase, before mods
26   - * are initialised but after the point at which it is safe to assume it's ok to access game classes. This
27   - * is the first point at which the Minecraft game instance should be referenced. Be aware that certain game
28   - * classes (such as the EntityRenderer) are NOT initialised at this point.
29   - *
30   - * @param engine
31   - */
32   - public abstract void onPostInit(GameEngine<?, ?> engine);
33   -
34   - /**
35   - * Once the mods are initialised and the interfaces have been allocated, this callback is invoked to allow
36   - * the CoreProvider to perform any tasks which should be performed in the postInit phase but after mods
37   - * have been initialised.
38   - *
39   - * @param mods
40   - */
41   - public abstract void onPostInitComplete(LiteLoaderMods mods);
42   -
43   - /**
44   - * Called once startup is complete and the game loop begins running. This callback is invoked immediately
45   - * prior to the first "tick" event and immediately AFTER the the "late init" phase for mods (InitCompleteListener)
46   - */
47   - public abstract void onStartupComplete();
48   -
49   - /**
50   - * Called immediately on joining a single or multi-player world when the JoinGame packet is received. Only called on the client.
51   - *
52   - * @param netHandler
53   - * @param loginPacket
54   - */
55   - public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket);
56   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import net.minecraft.network.INetHandler;
  4 +import net.minecraft.network.play.server.S01PacketJoinGame;
  5 +
  6 +import com.mumfrey.liteloader.common.GameEngine;
  7 +import com.mumfrey.liteloader.core.LiteLoaderMods;
  8 +
  9 +/**
  10 + * LiteLoader Extensible API - API Core Provider
  11 + *
  12 + * Core Providers are objects whose lifecycle is equivalent to the run time of game and thus the entire
  13 + * lifecycle of your API, they are instanced early in the loader startup process. CoreProviders can implement
  14 + * any Observer interface as appropriate and are automatically considered when allocating Observers to
  15 + * callback lists
  16 + *
  17 + * @author Adam Mummery-Smith
  18 + */
  19 +public interface CoreProvider extends TickObserver, WorldObserver, ShutdownObserver, PostRenderObserver
  20 +{
  21 + public abstract void onInit();
  22 +
  23 + /**
  24 + * During the postInit phase, the mods which were discovered during preInit phase are initialised and the
  25 + * interfaces are allocated. This callback is invoked at the very start of the postInit phase, before mods
  26 + * are initialised but after the point at which it is safe to assume it's ok to access game classes. This
  27 + * is the first point at which the Minecraft game instance should be referenced. Be aware that certain game
  28 + * classes (such as the EntityRenderer) are NOT initialised at this point.
  29 + *
  30 + * @param engine
  31 + */
  32 + public abstract void onPostInit(GameEngine<?, ?> engine);
  33 +
  34 + /**
  35 + * Once the mods are initialised and the interfaces have been allocated, this callback is invoked to allow
  36 + * the CoreProvider to perform any tasks which should be performed in the postInit phase but after mods
  37 + * have been initialised.
  38 + *
  39 + * @param mods
  40 + */
  41 + public abstract void onPostInitComplete(LiteLoaderMods mods);
  42 +
  43 + /**
  44 + * Called once startup is complete and the game loop begins running. This callback is invoked immediately
  45 + * prior to the first "tick" event and immediately AFTER the the "late init" phase for mods (InitCompleteListener)
  46 + */
  47 + public abstract void onStartupComplete();
  48 +
  49 + /**
  50 + * Called immediately on joining a single or multi-player world when the JoinGame packet is received. Only called on the client.
  51 + *
  52 + * @param netHandler
  53 + * @param loginPacket
  54 + */
  55 + public abstract void onJoinGame(INetHandler netHandler, S01PacketJoinGame loginPacket);
  56 +}
... ...
java/common/com/mumfrey/liteloader/api/CustomisationProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/CustomisationProvider.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * Base interface for loader customisation providers, has to be here so that we don't load branding provider classes too soon
5   - *
6   - * @author Adam Mummery-Smith
7   - */
8   -public interface CustomisationProvider
9   -{
10   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * Base interface for loader customisation providers, has to be here so that we don't load branding provider classes too soon
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface CustomisationProvider
  9 +{
  10 +}
... ...
java/common/com/mumfrey/liteloader/api/EnumerationObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/EnumerationObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.io.File;
4   -
5   -import com.mumfrey.liteloader.api.ContainerRegistry.DisabledReason;
6   -import com.mumfrey.liteloader.core.ModInfo;
7   -import com.mumfrey.liteloader.interfaces.LoadableMod;
8   -import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
9   -import com.mumfrey.liteloader.interfaces.TweakContainer;
10   -
11   -/**
12   - * LiteLoader Extensible API - Enumeration observer
13   - *
14   - * EnumerationObserver receive callbacks when mod containers are enumerated. Instances of this class MUST be returned from
15   - * getPreInitObservers in order to work
16   - *
17   - * @author Adam Mummery-Smith
18   - */
19   -public interface EnumerationObserver extends Observer
20   -{
21   - /**
22   - * Called upon registration for every discovered container which is enabled
23   - *
24   - * @param enumerator
25   - * @param container
26   - */
27   - public abstract void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container);
28   -
29   - /**
30   - * Called upon registration for every discovered container which is currently disabled, either because
31   - *
32   - * @param enumerator
33   - * @param container
34   - * @param reason
35   - */
36   - public abstract void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason);
37   -
38   - /**
39   - * Called AFTER registration of an ENABLED container (eg. onRegisterEnabledContainer will be called first) if that container also
40   - * contains tweaks.
41   - *
42   - * @param enumerator
43   - * @param container
44   - */
45   - public abstract void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container);
46   -
47   - /**
48   - * Called when a mod container is added to the pending mods list. This does not mean that the specific mod will actually be instanced since
49   - * the mod can still be disabled via the exclusion list (this is to allow entire containers to be disabled or just individual mods) and so
50   - * if you wish to observe actual mod instantiation you should still provide a {@link ResourceObserver}. However this event expresses a
51   - * declaration by the enumerator of an intention to load the specified mod.
52   - *
53   - * @param enumerator
54   - * @param mod
55   - */
56   - public abstract void onModAdded(LoaderEnumerator enumerator, ModInfo<LoadableMod<?>> mod);
57   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.io.File;
  4 +
  5 +import com.mumfrey.liteloader.api.ContainerRegistry.DisabledReason;
  6 +import com.mumfrey.liteloader.core.ModInfo;
  7 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  8 +import com.mumfrey.liteloader.interfaces.LoaderEnumerator;
  9 +import com.mumfrey.liteloader.interfaces.TweakContainer;
  10 +
  11 +/**
  12 + * LiteLoader Extensible API - Enumeration observer
  13 + *
  14 + * EnumerationObserver receive callbacks when mod containers are enumerated. Instances of this class MUST be returned from
  15 + * getPreInitObservers in order to work
  16 + *
  17 + * @author Adam Mummery-Smith
  18 + */
  19 +public interface EnumerationObserver extends Observer
  20 +{
  21 + /**
  22 + * Called upon registration for every discovered container which is enabled
  23 + *
  24 + * @param enumerator
  25 + * @param container
  26 + */
  27 + public abstract void onRegisterEnabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container);
  28 +
  29 + /**
  30 + * Called upon registration for every discovered container which is currently disabled, either because
  31 + *
  32 + * @param enumerator
  33 + * @param container
  34 + * @param reason
  35 + */
  36 + public abstract void onRegisterDisabledContainer(LoaderEnumerator enumerator, LoadableMod<?> container, DisabledReason reason);
  37 +
  38 + /**
  39 + * Called AFTER registration of an ENABLED container (eg. onRegisterEnabledContainer will be called first) if that container also
  40 + * contains tweaks.
  41 + *
  42 + * @param enumerator
  43 + * @param container
  44 + */
  45 + public abstract void onRegisterTweakContainer(LoaderEnumerator enumerator, TweakContainer<File> container);
  46 +
  47 + /**
  48 + * Called when a mod container is added to the pending mods list. This does not mean that the specific mod will actually be instanced since
  49 + * the mod can still be disabled via the exclusion list (this is to allow entire containers to be disabled or just individual mods) and so
  50 + * if you wish to observe actual mod instantiation you should still provide a {@link ResourceObserver}. However this event expresses a
  51 + * declaration by the enumerator of an intention to load the specified mod.
  52 + *
  53 + * @param enumerator
  54 + * @param mod
  55 + */
  56 + public abstract void onModAdded(LoaderEnumerator enumerator, ModInfo<LoadableMod<?>> mod);
  57 +}
... ...
java/common/com/mumfrey/liteloader/api/EnumeratorModule.java renamed to src/main/java/com/mumfrey/liteloader/api/EnumeratorModule.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import com.mumfrey.liteloader.interfaces.ModularEnumerator;
4   -import com.mumfrey.liteloader.launch.LoaderEnvironment;
5   -import com.mumfrey.liteloader.launch.LoaderProperties;
6   -
7   -import net.minecraft.launchwrapper.LaunchClassLoader;
8   -
9   -/**
10   - * LiteLoader Extensible API - Interface for objects which can enumerate mods in places
11   - *
12   - * EnumeratorModules plug into the LoaderEnumerator and are used to discover mod containers in various
13   - * locations, for example searching in a specific folder for particular files.
14   - *
15   - * @author Adam Mummery-Smith
16   - */
17   -public interface EnumeratorModule
18   -{
19   - /**
20   - * @param environment Loader environment
21   - * @param properties Loader properties
22   - */
23   - public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
24   -
25   - /**
26   - * @param environment Loader environment
27   - * @param properties Loader properties
28   - */
29   - public abstract void writeSettings(LoaderEnvironment environment, LoaderProperties properties);
30   -
31   - /**
32   - * Find loadable mods in this enumerator's domain, the enumerator module should call back against the enumerator
33   - * itself to register containers it discovers using the registerModContainer() and registerTweakContainer()
34   - * callbacks.
35   - *
36   - * This method is called during loader PREINIT phase so **DO NOT USE ANY GAME CLASSES HERE**!
37   - *
38   - * @param enumerator
39   - * @param profile
40   - */
41   - public abstract void enumerate(ModularEnumerator enumerator, String profile);
42   -
43   - /**
44   - * The enumerator module should inject (as required) any discovered containers into the classpath
45   - *
46   - * This method is called during the loader INIT phase
47   - *
48   - * @param enumerator
49   - * @param classLoader
50   - */
51   - public abstract void injectIntoClassLoader(ModularEnumerator enumerator, LaunchClassLoader classLoader);
52   -
53   - /**
54   - * The enumerator module should callback against the enumerator using the registerModsFrom() callback to
55   - * register mods from discovered containers
56   - *
57   - * This method is called during the loader INIT phase
58   - *
59   - * @param enumerator
60   - * @param classLoader
61   - */
62   - public abstract void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader);
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import com.mumfrey.liteloader.interfaces.ModularEnumerator;
  4 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  5 +import com.mumfrey.liteloader.launch.LoaderProperties;
  6 +
  7 +import net.minecraft.launchwrapper.LaunchClassLoader;
  8 +
  9 +/**
  10 + * LiteLoader Extensible API - Interface for objects which can enumerate mods in places
  11 + *
  12 + * EnumeratorModules plug into the LoaderEnumerator and are used to discover mod containers in various
  13 + * locations, for example searching in a specific folder for particular files.
  14 + *
  15 + * @author Adam Mummery-Smith
  16 + */
  17 +public interface EnumeratorModule
  18 +{
  19 + /**
  20 + * @param environment Loader environment
  21 + * @param properties Loader properties
  22 + */
  23 + public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
  24 +
  25 + /**
  26 + * @param environment Loader environment
  27 + * @param properties Loader properties
  28 + */
  29 + public abstract void writeSettings(LoaderEnvironment environment, LoaderProperties properties);
  30 +
  31 + /**
  32 + * Find loadable mods in this enumerator's domain, the enumerator module should call back against the enumerator
  33 + * itself to register containers it discovers using the registerModContainer() and registerTweakContainer()
  34 + * callbacks.
  35 + *
  36 + * This method is called during loader PREINIT phase so **DO NOT USE ANY GAME CLASSES HERE**!
  37 + *
  38 + * @param enumerator
  39 + * @param profile
  40 + */
  41 + public abstract void enumerate(ModularEnumerator enumerator, String profile);
  42 +
  43 + /**
  44 + * The enumerator module should inject (as required) any discovered containers into the classpath
  45 + *
  46 + * This method is called during the loader INIT phase
  47 + *
  48 + * @param enumerator
  49 + * @param classLoader
  50 + */
  51 + public abstract void injectIntoClassLoader(ModularEnumerator enumerator, LaunchClassLoader classLoader);
  52 +
  53 + /**
  54 + * The enumerator module should callback against the enumerator using the registerModsFrom() callback to
  55 + * register mods from discovered containers
  56 + *
  57 + * This method is called during the loader INIT phase
  58 + *
  59 + * @param enumerator
  60 + * @param classLoader
  61 + */
  62 + public abstract void registerMods(ModularEnumerator enumerator, LaunchClassLoader classLoader);
63 63 }
64 64 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/api/EnumeratorPlugin.java renamed to src/main/java/com/mumfrey/liteloader/api/EnumeratorPlugin.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.util.List;
4   -
5   -import com.mumfrey.liteloader.interfaces.LoadableMod;
6   -import com.mumfrey.liteloader.launch.LoaderEnvironment;
7   -import com.mumfrey.liteloader.launch.LoaderProperties;
8   -
9   -/**
10   - * LiteLoader Extensible API - Interface for objects which can interact with the enumeration process, not yet available to APIs
11   - *
12   - * @author Adam Mummery-Smith
13   - */
14   -public interface EnumeratorPlugin
15   -{
16   - /**
17   - * Initialise this plugin
18   - */
19   - public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
20   -
21   - /**
22   - * Get classes in the supplied container
23   - *
24   - * @param container Container to inspect
25   - * @param classloader ClassLoader for this container
26   - * @param superClass Superclass the class must implement
27   - * @param supportedPrefixes Registered class prefixes
28   - * @return
29   - */
30   - public abstract <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator);
31   -
32   - public abstract boolean checkEnabled(ContainerRegistry containers, LoadableMod<?> container);
33   -
34   - public abstract boolean checkDependencies(ContainerRegistry containers, LoadableMod<?> base);
35   -
36   - public abstract boolean checkAPIRequirements(ContainerRegistry containers, LoadableMod<?> container);
37   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  6 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  7 +import com.mumfrey.liteloader.launch.LoaderProperties;
  8 +
  9 +/**
  10 + * LiteLoader Extensible API - Interface for objects which can interact with the enumeration process, not yet available to APIs
  11 + *
  12 + * @author Adam Mummery-Smith
  13 + */
  14 +public interface EnumeratorPlugin
  15 +{
  16 + /**
  17 + * Initialise this plugin
  18 + */
  19 + public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
  20 +
  21 + /**
  22 + * Get classes in the supplied container
  23 + *
  24 + * @param container Container to inspect
  25 + * @param classloader ClassLoader for this container
  26 + * @param superClass Superclass the class must implement
  27 + * @param supportedPrefixes Registered class prefixes
  28 + * @return
  29 + */
  30 + public abstract <T> List<Class<? extends T>> getClasses(LoadableMod<?> container, ClassLoader classloader, ModClassValidator validator);
  31 +
  32 + public abstract boolean checkEnabled(ContainerRegistry containers, LoadableMod<?> container);
  33 +
  34 + public abstract boolean checkDependencies(ContainerRegistry containers, LoadableMod<?> base);
  35 +
  36 + public abstract boolean checkAPIRequirements(ContainerRegistry containers, LoadableMod<?> container);
  37 +}
... ...
java/common/com/mumfrey/liteloader/api/GenericObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/GenericObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * Generic Observer class, for Intra-API Observer inking
5   - *
6   - * @author Adam Mummery-Smith
7   - *
8   - * @param <T> Argument type for observable events
9   - */
10   -public interface GenericObserver<T> extends Observer
11   -{
12   - public abstract void onObservableEvent(String eventName, T... eventArgs) throws ClassCastException;
13   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * Generic Observer class, for Intra-API Observer inking
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + *
  8 + * @param <T> Argument type for observable events
  9 + */
  10 +public interface GenericObserver<T> extends Observer
  11 +{
  12 + public abstract void onObservableEvent(String eventName, T... eventArgs) throws ClassCastException;
  13 +}
... ...
java/common/com/mumfrey/liteloader/api/InterfaceObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/InterfaceObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * Observer for interface binding events
5   - *
6   - * @author Adam Mummery-Smith
7   - */
8   -public interface InterfaceObserver extends Observer
9   -{
10   - public void onRegisterListener(InterfaceProvider provider, Class<? extends Listener> interfaceType, Listener listener);
11   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * Observer for interface binding events
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface InterfaceObserver extends Observer
  9 +{
  10 + public void onRegisterListener(InterfaceProvider provider, Class<? extends Listener> interfaceType, Listener listener);
  11 +}
... ...
java/common/com/mumfrey/liteloader/api/InterfaceProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/InterfaceProvider.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
4   -
5   -/**
6   - * LiteLoader Extensible API - Interface Provider
7   - *
8   - * InterfaceProviders are able to advertise and provide Listener interfaces which can be implemented
9   - * by mods or other Listener-derived classes
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface InterfaceProvider
14   -{
15   - /**
16   - * Base type of Listeners which can consume events provided by this provider
17   - */
18   - public abstract Class<? extends Listener> getListenerBaseType();
19   -
20   - /**
21   - * The provider should call back against the supplied delegate in order to advertise the interfaces
22   - * it provides.
23   - *
24   - * @param delegate
25   - */
26   - public abstract void registerInterfaces(InterfaceRegistrationDelegate delegate);
27   -
28   - /**
29   - * Initialise this provider, called AFTER enumeration but before binding
30   - */
31   - public abstract void initProvider();
32   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import com.mumfrey.liteloader.core.InterfaceRegistrationDelegate;
  4 +
  5 +/**
  6 + * LiteLoader Extensible API - Interface Provider
  7 + *
  8 + * InterfaceProviders are able to advertise and provide Listener interfaces which can be implemented
  9 + * by mods or other Listener-derived classes
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface InterfaceProvider
  14 +{
  15 + /**
  16 + * Base type of Listeners which can consume events provided by this provider
  17 + */
  18 + public abstract Class<? extends Listener> getListenerBaseType();
  19 +
  20 + /**
  21 + * The provider should call back against the supplied delegate in order to advertise the interfaces
  22 + * it provides.
  23 + *
  24 + * @param delegate
  25 + */
  26 + public abstract void registerInterfaces(InterfaceRegistrationDelegate delegate);
  27 +
  28 + /**
  29 + * Initialise this provider, called AFTER enumeration but before binding
  30 + */
  31 + public abstract void initProvider();
  32 +}
... ...
java/common/com/mumfrey/liteloader/api/Listener.java renamed to src/main/java/com/mumfrey/liteloader/api/Listener.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * LiteLoader Extensible API - Listener is the base interface for (counter-intuitively) consumable Listener interfaces, in
5   - * that derived interfaces are consumable (from the point of view of the providers) but actual implementors consume the events
6   - * thus advertised by implementing those interfaces, making them themselves the consumers. Okay so that's probably pretty
7   - * confusing but I can't think of any better terminology so it's staying :)
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface Listener
12   -{
13   - /**
14   - * Get the display name
15   - *
16   - * @return display name
17   - */
18   - public abstract String getName();
19   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * LiteLoader Extensible API - Listener is the base interface for (counter-intuitively) consumable Listener interfaces, in
  5 + * that derived interfaces are consumable (from the point of view of the providers) but actual implementors consume the events
  6 + * thus advertised by implementing those interfaces, making them themselves the consumers. Okay so that's probably pretty
  7 + * confusing but I can't think of any better terminology so it's staying :)
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface Listener
  12 +{
  13 + /**
  14 + * Get the display name
  15 + *
  16 + * @return display name
  17 + */
  18 + public abstract String getName();
  19 +}
... ...
java/common/com/mumfrey/liteloader/api/LiteAPI.java renamed to src/main/java/com/mumfrey/liteloader/api/LiteAPI.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.util.List;
4   -
5   -import com.mumfrey.liteloader.launch.LoaderEnvironment;
6   -import com.mumfrey.liteloader.launch.LoaderProperties;
7   -
8   -/**
9   - * LiteLoader Extensible API - main Mod API
10   - *
11   - * Implementors of this class don't really do anything except provide instances of other classes which make up the API proper.
12   - * Where possible, instance things as LATE as possible (eg. do not instance your CoreProviders in the constructor or init()) because
13   - * it's possible to screw up the game startup if things get loaded out of order, in general it's best to instance things only at
14   - * the earliest point in time at which they are needed.
15   - *
16   - * @author Adam Mummery-Smith
17   - */
18   -public interface LiteAPI
19   -{
20   - /**
21   - * Initialise this API, the API should do as little processing as possible here, but should also cache
22   - * the supplied environment and properties instances for later use
23   - *
24   - * @param environment
25   - * @param properties
26   - */
27   - public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
28   -
29   - /**
30   - * Get the identifier for this API, the identifier is used to retrieve the API and match it against specified mod API dependencies
31   - */
32   - public abstract String getIdentifier();
33   -
34   - /**
35   - * Get the friendly name of this API
36   - */
37   - public abstract String getName();
38   -
39   - /**
40   - * Get the human-readable version of the API, can be any value
41   - */
42   - public abstract String getVersion();
43   -
44   - /**
45   - * Get the revision number of this API. Unlike the version number, the revision number should only change when an incompatible
46   - * change is made to the APIs interfaces, it is also used when a mod specifies an API dependency using the api@revision syntax
47   - */
48   - public abstract int getRevision();
49   -
50   - /**
51   - * Should return an array of required transformer names, these transformers will be injected UPSTREAM. Can return null.
52   - */
53   - public abstract String[] getRequiredTransformers();
54   -
55   - /**
56   - * Should return an array of required transformer names, these transformers will be injected DOWNSTREAM. Can return null.
57   - */
58   - public abstract String[] getRequiredDownstreamTransformers();
59   -
60   - /**
61   - * Return a mod class prefix supported by this API, can return null if an API just wants to use "LiteMod" as a standard class name prefix
62   - */
63   - public abstract String getModClassPrefix();
64   -
65   - /**
66   - * Should return a list of Enumerator modules to be injected, can return null if the API doesn't want to inject any additonal modules
67   - */
68   - public abstract List<EnumeratorModule> getEnumeratorModules();
69   -
70   - /**
71   - * Should return a list of CoreProviders for this API, can return null if the API doesn't have any CoreProviders, (almost) guaranteed to only be called once
72   - */
73   - public abstract List<CoreProvider> getCoreProviders();
74   -
75   - /**
76   - * Should return a list of InterfaceProviders for this API, can return null if the API doesn't have any InterfaceProviders, (almost) guaranteed to only be called once
77   - */
78   - public abstract List<InterfaceProvider> getInterfaceProviders();
79   -
80   - /**
81   - * Should return a list of Observers which are safe to instantiate during pre-init, for example EnumerationObservers. Can return null if the API doesn't have any
82   - * Observers.
83   - */
84   - public abstract List<Observer> getPreInitObservers();
85   -
86   - /**
87   - * Should return a list of Observers for this API, can return null if the API doesn't have any Observers, (almost) guaranteed to only be called once. This list may
88   - * include Observers returned by getPreInitObservers if the observers are still required.
89   - */
90   - public abstract List<Observer> getObservers();
91   -
92   - /**
93   - * Get the customisation providers for this API, can return null
94   - */
95   - public abstract List<CustomisationProvider> getCustomisationProviders();
96   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  6 +import com.mumfrey.liteloader.launch.LoaderProperties;
  7 +
  8 +/**
  9 + * LiteLoader Extensible API - main Mod API
  10 + *
  11 + * Implementors of this class don't really do anything except provide instances of other classes which make up the API proper.
  12 + * Where possible, instance things as LATE as possible (eg. do not instance your CoreProviders in the constructor or init()) because
  13 + * it's possible to screw up the game startup if things get loaded out of order, in general it's best to instance things only at
  14 + * the earliest point in time at which they are needed.
  15 + *
  16 + * @author Adam Mummery-Smith
  17 + */
  18 +public interface LiteAPI
  19 +{
  20 + /**
  21 + * Initialise this API, the API should do as little processing as possible here, but should also cache
  22 + * the supplied environment and properties instances for later use
  23 + *
  24 + * @param environment
  25 + * @param properties
  26 + */
  27 + public abstract void init(LoaderEnvironment environment, LoaderProperties properties);
  28 +
  29 + /**
  30 + * Get the identifier for this API, the identifier is used to retrieve the API and match it against specified mod API dependencies
  31 + */
  32 + public abstract String getIdentifier();
  33 +
  34 + /**
  35 + * Get the friendly name of this API
  36 + */
  37 + public abstract String getName();
  38 +
  39 + /**
  40 + * Get the human-readable version of the API, can be any value
  41 + */
  42 + public abstract String getVersion();
  43 +
  44 + /**
  45 + * Get the revision number of this API. Unlike the version number, the revision number should only change when an incompatible
  46 + * change is made to the APIs interfaces, it is also used when a mod specifies an API dependency using the api@revision syntax
  47 + */
  48 + public abstract int getRevision();
  49 +
  50 + /**
  51 + * Should return an array of required transformer names, these transformers will be injected UPSTREAM. Can return null.
  52 + */
  53 + public abstract String[] getRequiredTransformers();
  54 +
  55 + /**
  56 + * Should return an array of required transformer names, these transformers will be injected DOWNSTREAM. Can return null.
  57 + */
  58 + public abstract String[] getRequiredDownstreamTransformers();
  59 +
  60 + /**
  61 + * Return a mod class prefix supported by this API, can return null if an API just wants to use "LiteMod" as a standard class name prefix
  62 + */
  63 + public abstract String getModClassPrefix();
  64 +
  65 + /**
  66 + * Should return a list of Enumerator modules to be injected, can return null if the API doesn't want to inject any additonal modules
  67 + */
  68 + public abstract List<EnumeratorModule> getEnumeratorModules();
  69 +
  70 + /**
  71 + * Should return a list of CoreProviders for this API, can return null if the API doesn't have any CoreProviders, (almost) guaranteed to only be called once
  72 + */
  73 + public abstract List<CoreProvider> getCoreProviders();
  74 +
  75 + /**
  76 + * Should return a list of InterfaceProviders for this API, can return null if the API doesn't have any InterfaceProviders, (almost) guaranteed to only be called once
  77 + */
  78 + public abstract List<InterfaceProvider> getInterfaceProviders();
  79 +
  80 + /**
  81 + * Should return a list of Observers which are safe to instantiate during pre-init, for example EnumerationObservers. Can return null if the API doesn't have any
  82 + * Observers.
  83 + */
  84 + public abstract List<Observer> getPreInitObservers();
  85 +
  86 + /**
  87 + * Should return a list of Observers for this API, can return null if the API doesn't have any Observers, (almost) guaranteed to only be called once. This list may
  88 + * include Observers returned by getPreInitObservers if the observers are still required.
  89 + */
  90 + public abstract List<Observer> getObservers();
  91 +
  92 + /**
  93 + * Get the customisation providers for this API, can return null
  94 + */
  95 + public abstract List<CustomisationProvider> getCustomisationProviders();
  96 +}
... ...
java/common/com/mumfrey/liteloader/api/ModClassValidator.java renamed to src/main/java/com/mumfrey/liteloader/api/ModClassValidator.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * Interface for object which validates whether a supplied mod class can be loaded
5   - *
6   - * @author Adam Mummery-Smith
7   - */
8   -public interface ModClassValidator
9   -{
10   - public abstract boolean validateName(String className);
11   -
12   - public abstract boolean validateClass(ClassLoader classLoader, Class<?> candidateClass);
13   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * Interface for object which validates whether a supplied mod class can be loaded
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface ModClassValidator
  9 +{
  10 + public abstract boolean validateName(String className);
  11 +
  12 + public abstract boolean validateClass(ClassLoader classLoader, Class<?> candidateClass);
  13 +}
... ...
java/common/com/mumfrey/liteloader/api/ModInfoDecorator.java renamed to src/main/java/com/mumfrey/liteloader/api/ModInfoDecorator.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.util.List;
4   -
5   -import com.mumfrey.liteloader.core.ModInfo;
6   -import com.mumfrey.liteloader.util.render.IconTextured;
7   -
8   -/**
9   - * LiteLoader Extensible API - Branding Provider
10   - *
11   - * Decorator for ModInfo classes, to alter the appearance of ModInfo entries in the mod list
12   - *
13   - * @author Adam Mummery-Smith
14   - */
15   -public interface ModInfoDecorator extends CustomisationProvider
16   -{
17   - /**
18   - * Add icons to the mod list entry for this mod
19   - *
20   - * @param mod
21   - * @param icons
22   - */
23   - public abstract void addIcons(ModInfo<?> mod, List<IconTextured> icons);
24   -
25   - /**
26   - * Allows this decorator to modify the status text for the specified mod, return null if no modification required
27   - *
28   - * @param statusText
29   - * @return new status text or NULL to indicate the text should remain default
30   - */
31   - public abstract String modifyStatusText(ModInfo<?> mod, String statusText);
32   -
33   - /**
34   - * Allow decorators to draw custom content on the mod list entries
35   - *
36   - * @param mouseX Mouse X position
37   - * @param mouseY Mouse Y position
38   - * @param partialTicks
39   - * @param xPosition Panel X position
40   - * @param yPosition Panel Y position
41   - * @param width Panel width
42   - * @param selected Panel height
43   - * @param mod ModInfo
44   - * @param gradientColour
45   - * @param titleColour
46   - * @param statusColour
47   - */
48   - public abstract void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour);
49   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.mumfrey.liteloader.core.ModInfo;
  6 +import com.mumfrey.liteloader.util.render.IconTextured;
  7 +
  8 +/**
  9 + * LiteLoader Extensible API - Branding Provider
  10 + *
  11 + * Decorator for ModInfo classes, to alter the appearance of ModInfo entries in the mod list
  12 + *
  13 + * @author Adam Mummery-Smith
  14 + */
  15 +public interface ModInfoDecorator extends CustomisationProvider
  16 +{
  17 + /**
  18 + * Add icons to the mod list entry for this mod
  19 + *
  20 + * @param mod
  21 + * @param icons
  22 + */
  23 + public abstract void addIcons(ModInfo<?> mod, List<IconTextured> icons);
  24 +
  25 + /**
  26 + * Allows this decorator to modify the status text for the specified mod, return null if no modification required
  27 + *
  28 + * @param statusText
  29 + * @return new status text or NULL to indicate the text should remain default
  30 + */
  31 + public abstract String modifyStatusText(ModInfo<?> mod, String statusText);
  32 +
  33 + /**
  34 + * Allow decorators to draw custom content on the mod list entries
  35 + *
  36 + * @param mouseX Mouse X position
  37 + * @param mouseY Mouse Y position
  38 + * @param partialTicks
  39 + * @param xPosition Panel X position
  40 + * @param yPosition Panel Y position
  41 + * @param width Panel width
  42 + * @param selected Panel height
  43 + * @param mod ModInfo
  44 + * @param gradientColour
  45 + * @param titleColour
  46 + * @param statusColour
  47 + */
  48 + public abstract void onDrawListEntry(int mouseX, int mouseY, float partialTicks, int xPosition, int yPosition, int width, int height, boolean selected, ModInfo<?> mod, int gradientColour, int titleColour, int statusColour);
  49 +}
... ...
java/common/com/mumfrey/liteloader/api/ModLoadObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/ModLoadObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import java.io.File;
4   -
5   -import com.mumfrey.liteloader.LiteMod;
6   -import com.mumfrey.liteloader.core.ModInfo;
7   -import com.mumfrey.liteloader.interfaces.LoadableMod;
8   -
9   -/**
10   - * LiteLoader Extensible API - Mod Load Observer
11   - *
12   - * ModLoadObservers receive callbacks when mod loading events are occurring, prior to init and other
13   - * loader-managed processes
14   - *
15   - * @author Adam Mummery-Smith
16   - */
17   -public interface ModLoadObserver extends Observer
18   -{
19   - /**
20   - * Called immediately after a mod instance is created, throw an exception from this method in
21   - * order to prevent further initialisation
22   - */
23   - public abstract void onModLoaded(LiteMod mod);
24   -
25   - /**
26   - * Called after a mod is instanced and has been successfully added to the active mods list
27   - *
28   - * @param handle Mod handle
29   - */
30   - public abstract void onPostModLoaded(ModInfo<LoadableMod<?>> handle);
31   -
32   - /**
33   - * Called if mod loading fails
34   - *
35   - * @param container
36   - * @param identifier
37   - * @param reason
38   - * @param th
39   - */
40   - public abstract void onModLoadFailed(LoadableMod<?> container, String identifier, String reason, Throwable th);
41   -
42   - /**
43   - * Called before a mod's init() method is called
44   - *
45   - * @param mod
46   - */
47   - public abstract void onPreInitMod(LiteMod mod);
48   -
49   - /**
50   - * Called after a mod's init() method is called
51   - *
52   - * @param mod
53   - */
54   - public abstract void onPostInitMod(LiteMod mod);
55   -
56   - /**
57   - * Called when migrating mod config from version to version
58   - *
59   - * @param mod
60   - * @param newConfigPath
61   - * @param oldConfigPath
62   - */
63   - public abstract void onMigrateModConfig(LiteMod mod, File newConfigPath, File oldConfigPath);
64   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import java.io.File;
  4 +
  5 +import com.mumfrey.liteloader.LiteMod;
  6 +import com.mumfrey.liteloader.core.ModInfo;
  7 +import com.mumfrey.liteloader.interfaces.LoadableMod;
  8 +
  9 +/**
  10 + * LiteLoader Extensible API - Mod Load Observer
  11 + *
  12 + * ModLoadObservers receive callbacks when mod loading events are occurring, prior to init and other
  13 + * loader-managed processes
  14 + *
  15 + * @author Adam Mummery-Smith
  16 + */
  17 +public interface ModLoadObserver extends Observer
  18 +{
  19 + /**
  20 + * Called immediately after a mod instance is created, throw an exception from this method in
  21 + * order to prevent further initialisation
  22 + */
  23 + public abstract void onModLoaded(LiteMod mod);
  24 +
  25 + /**
  26 + * Called after a mod is instanced and has been successfully added to the active mods list
  27 + *
  28 + * @param handle Mod handle
  29 + */
  30 + public abstract void onPostModLoaded(ModInfo<LoadableMod<?>> handle);
  31 +
  32 + /**
  33 + * Called if mod loading fails
  34 + *
  35 + * @param container
  36 + * @param identifier
  37 + * @param reason
  38 + * @param th
  39 + */
  40 + public abstract void onModLoadFailed(LoadableMod<?> container, String identifier, String reason, Throwable th);
  41 +
  42 + /**
  43 + * Called before a mod's init() method is called
  44 + *
  45 + * @param mod
  46 + */
  47 + public abstract void onPreInitMod(LiteMod mod);
  48 +
  49 + /**
  50 + * Called after a mod's init() method is called
  51 + *
  52 + * @param mod
  53 + */
  54 + public abstract void onPostInitMod(LiteMod mod);
  55 +
  56 + /**
  57 + * Called when migrating mod config from version to version
  58 + *
  59 + * @param mod
  60 + * @param newConfigPath
  61 + * @param oldConfigPath
  62 + */
  63 + public abstract void onMigrateModConfig(LiteMod mod, File newConfigPath, File oldConfigPath);
  64 +}
... ...
java/common/com/mumfrey/liteloader/api/Observer.java renamed to src/main/java/com/mumfrey/liteloader/api/Observer.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * LiteLoader Extensible API - Observer base interface
5   - *
6   - * Observers are essentially "core listeners" which are objects which make up the core a of a particular API implementation
7   - * and sink events generated by the Loader or by other observable components. See the derived interfaces for more detail.
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface Observer
12   -{
13   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * LiteLoader Extensible API - Observer base interface
  5 + *
  6 + * Observers are essentially "core listeners" which are objects which make up the core a of a particular API implementation
  7 + * and sink events generated by the Loader or by other observable components. See the derived interfaces for more detail.
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface Observer
  12 +{
  13 +}
... ...
java/common/com/mumfrey/liteloader/api/PostRenderObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/PostRenderObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * LiteLoader Extensible API - Post-render Observers
5   - *
6   - * PostRenderObservers receive the onPostRender event every frame, allowing "draw-on-top" behaviour for API components
7   - *
8   - * @author Adam Mummery-Smith
9   - */
10   -public interface PostRenderObserver extends Observer
11   -{
12   - public abstract void onPostRender(int mouseX, int mouseY, float partialTicks);
13   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * LiteLoader Extensible API - Post-render Observers
  5 + *
  6 + * PostRenderObservers receive the onPostRender event every frame, allowing "draw-on-top" behaviour for API components
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface PostRenderObserver extends Observer
  11 +{
  12 + public abstract void onPostRender(int mouseX, int mouseY, float partialTicks);
  13 +}
... ...
java/common/com/mumfrey/liteloader/api/ShutdownObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/ShutdownObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * LiteLoader Extensible API - ShutDownObserver
5   - *
6   - * ShutDownObservers receive an event when the game is shutting down due to a user request. They do NOT receive the
7   - * callback when the VM is terminating, use a regular VM shutdownhook for that.
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public interface ShutdownObserver extends Observer
12   -{
13   - public abstract void onShutDown();
14   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * LiteLoader Extensible API - ShutDownObserver
  5 + *
  6 + * ShutDownObservers receive an event when the game is shutting down due to a user request. They do NOT receive the
  7 + * callback when the VM is terminating, use a regular VM shutdownhook for that.
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public interface ShutdownObserver extends Observer
  12 +{
  13 + public abstract void onShutDown();
  14 +}
... ...
java/common/com/mumfrey/liteloader/api/TickObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/TickObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * LiteLoader Extensible API - TickObserver
5   - *
6   - * Received a callback every tick (duh) PRIOR to the mod tick event
7   - *
8   - * @author Adam Mummery-Smith
9   - */
10   -public interface TickObserver extends Observer
11   -{
12   - public abstract void onTick(boolean clock, float partialTicks, boolean inGame);
13   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * LiteLoader Extensible API - TickObserver
  5 + *
  6 + * Received a callback every tick (duh) PRIOR to the mod tick event
  7 + *
  8 + * @author Adam Mummery-Smith
  9 + */
  10 +public interface TickObserver extends Observer
  11 +{
  12 + public abstract void onTick(boolean clock, float partialTicks, boolean inGame);
  13 +}
... ...
java/common/com/mumfrey/liteloader/api/TranslationProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/TranslationProvider.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -/**
4   - * Interface for providers which can handle translation requests
5   - *
6   - * @author Adam Mummery-Smith
7   - */
8   -public interface TranslationProvider extends CustomisationProvider
9   -{
10   - /**
11   - * Translate the supplied key or return NULL if the provider has no translation for the specified key
12   - */
13   - public abstract String translate(String key, Object... args);
14   -
15   - /**
16   - * Translate the supplied key to the specified locale, or return NULL if the provider has no translation for this key
17   - */
18   - public abstract String translate(String locale, String key, Object... args);
19   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +/**
  4 + * Interface for providers which can handle translation requests
  5 + *
  6 + * @author Adam Mummery-Smith
  7 + */
  8 +public interface TranslationProvider extends CustomisationProvider
  9 +{
  10 + /**
  11 + * Translate the supplied key or return NULL if the provider has no translation for the specified key
  12 + */
  13 + public abstract String translate(String key, Object... args);
  14 +
  15 + /**
  16 + * Translate the supplied key to the specified locale, or return NULL if the provider has no translation for this key
  17 + */
  18 + public abstract String translate(String locale, String key, Object... args);
  19 +}
... ...
java/common/com/mumfrey/liteloader/api/WorldObserver.java renamed to src/main/java/com/mumfrey/liteloader/api/WorldObserver.java
1   -package com.mumfrey.liteloader.api;
2   -
3   -import net.minecraft.world.World;
4   -
5   -/**
6   - * LiteLoader Extensible API - WorldObserver
7   - *
8   - * WorldObservers receive a callback when the Minecraft.theWorld reference changes, beware the value is allowed
9   - * to be null
10   - *
11   - * @author Adam Mummery-Smith
12   - */
13   -public interface WorldObserver extends Observer
14   -{
15   - public abstract void onWorldChanged(World world);
16   -}
  1 +package com.mumfrey.liteloader.api;
  2 +
  3 +import net.minecraft.world.World;
  4 +
  5 +/**
  6 + * LiteLoader Extensible API - WorldObserver
  7 + *
  8 + * WorldObservers receive a callback when the Minecraft.theWorld reference changes, beware the value is allowed
  9 + * to be null
  10 + *
  11 + * @author Adam Mummery-Smith
  12 + */
  13 +public interface WorldObserver extends Observer
  14 +{
  15 + public abstract void onWorldChanged(World world);
  16 +}
... ...
java/common/com/mumfrey/liteloader/api/exceptions/APIException.java renamed to src/main/java/com/mumfrey/liteloader/api/exceptions/APIException.java
1   -package com.mumfrey.liteloader.api.exceptions;
2   -
3   -public abstract class APIException extends RuntimeException
4   -{
5   - private static final long serialVersionUID = 1L;
6   -
7   - public APIException()
8   - {
9   - super();
10   - }
11   -
12   - public APIException(String message)
13   - {
14   - super(message);
15   - }
16   -
17   - public APIException(Throwable cause)
18   - {
19   - super(cause);
20   - }
21   -
22   - public APIException(String message, Throwable cause)
23   - {
24   - super(message, cause);
25   - }
26   -
  1 +package com.mumfrey.liteloader.api.exceptions;
  2 +
  3 +public abstract class APIException extends RuntimeException
  4 +{
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public APIException()
  8 + {
  9 + super();
  10 + }
  11 +
  12 + public APIException(String message)
  13 + {
  14 + super(message);
  15 + }
  16 +
  17 + public APIException(Throwable cause)
  18 + {
  19 + super(cause);
  20 + }
  21 +
  22 + public APIException(String message, Throwable cause)
  23 + {
  24 + super(message, cause);
  25 + }
  26 +
27 27 }
28 28 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/api/exceptions/InvalidAPIException.java renamed to src/main/java/com/mumfrey/liteloader/api/exceptions/InvalidAPIException.java
1   -package com.mumfrey.liteloader.api.exceptions;
2   -
3   -public class InvalidAPIException extends APIException
4   -{
5   - private static final long serialVersionUID = 1L;
6   -
7   - public InvalidAPIException(String message, Throwable cause)
8   - {
9   - super(message, cause);
10   - }
11   -
12   - public InvalidAPIException(String message)
13   - {
14   - super(message);
15   - }
16   -}
  1 +package com.mumfrey.liteloader.api.exceptions;
  2 +
  3 +public class InvalidAPIException extends APIException
  4 +{
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public InvalidAPIException(String message, Throwable cause)
  8 + {
  9 + super(message, cause);
  10 + }
  11 +
  12 + public InvalidAPIException(String message)
  13 + {
  14 + super(message);
  15 + }
  16 +}
... ...
java/common/com/mumfrey/liteloader/api/exceptions/InvalidAPIStateException.java renamed to src/main/java/com/mumfrey/liteloader/api/exceptions/InvalidAPIStateException.java
1   -package com.mumfrey.liteloader.api.exceptions;
2   -
3   -public class InvalidAPIStateException extends APIException
4   -{
5   - private static final long serialVersionUID = 1L;
6   -
7   - public InvalidAPIStateException(String message)
8   - {
9   - super(message);
10   - }
11   -}
  1 +package com.mumfrey.liteloader.api.exceptions;
  2 +
  3 +public class InvalidAPIStateException extends APIException
  4 +{
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public InvalidAPIStateException(String message)
  8 + {
  9 + super(message);
  10 + }
  11 +}
... ...
java/common/com/mumfrey/liteloader/api/exceptions/InvalidProviderException.java renamed to src/main/java/com/mumfrey/liteloader/api/exceptions/InvalidProviderException.java
1   -package com.mumfrey.liteloader.api.exceptions;
2   -
3   -public class InvalidProviderException extends APIException
4   -{
5   - private static final long serialVersionUID = 1L;
6   -
7   - public InvalidProviderException(String message, Throwable cause)
8   - {
9   - super(message, cause);
10   - }
11   -
12   - public InvalidProviderException(String message)
13   - {
14   - super(message);
15   - }
16   -}
  1 +package com.mumfrey.liteloader.api.exceptions;
  2 +
  3 +public class InvalidProviderException extends APIException
  4 +{
  5 + private static final long serialVersionUID = 1L;
  6 +
  7 + public InvalidProviderException(String message, Throwable cause)
  8 + {
  9 + super(message, cause);
  10 + }
  11 +
  12 + public InvalidProviderException(String message)
  13 + {
  14 + super(message);
  15 + }
  16 +}
... ...
java/common/com/mumfrey/liteloader/api/manager/APIAdapter.java renamed to src/main/java/com/mumfrey/liteloader/api/manager/APIAdapter.java
1   -package com.mumfrey.liteloader.api.manager;
2   -
3   -import java.util.List;
4   -
5   -import com.mumfrey.liteloader.api.CoreProvider;
6   -import com.mumfrey.liteloader.api.LiteAPI;
7   -import com.mumfrey.liteloader.api.Observer;
8   -import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
9   -
10   -/**
11   - * API Adapter provides convenience methods for invoking actions on ALL registered APIs
12   - *
13   - * @author Adam Mummery-Smith
14   - */
15   -public interface APIAdapter
16   -{
17   - /**
18   - * Aggregate and return required transformers from all registered APIs
19   - */
20   - public abstract List<String> getRequiredTransformers();
21   -
22   - /**
23   - * Aggregate and return required downstream transformers from all registered APIs
24   - */
25   - public abstract List<String> getRequiredDownstreamTransformers();
26   -
27   - /**
28   - * Register interfaces from all registered APIs with the specified registry
29   - */
30   - public abstract void registerInterfaces(InterfaceRegistry interfaceManager);
31   -
32   - /**
33   - * Get the CoreProviders for the specified API. Consuming classes should call this method instead of calling API::getCoreProviders()
34   - * directly since getCoreProviders() should only be invoked once and the resulting collection is cached by the API Adapter
35   - */
36   - public abstract List<CoreProvider> getCoreProviders();
37   -
38   - /**
39   - * Get the observers for the specified API. Consuming classes should call this method instead of calling API::getObservers() directly
40   - * since getObservers() should only be invoked once and the resulting list is cached by the API Adapter
41   - *
42   - * @param api API to get observers for
43   - */
44   - public abstract List<? extends Observer> getObservers(LiteAPI api);
45   -
46   - /**
47   - * Get the observers for the specified API which implement the specified Observer interface. Always returns a valid list (even if
48   - * empty) and doesn't return null.
49   - *
50   - * @param api API to get observers for
51   - * @param observerType type of observer to search for
52   - */
53   - public abstract <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType);
54   -
55   - /**
56   - * Get the observers for all registered APIs which implement the specified Observer interface. Always returns a valid list (even if
57   - * empty) and doesn't return null. Also includes core providers
58   - *
59   - * @param observerType type of observer to search for
60   - */
61   - public abstract <T extends Observer> List<T> getAllObservers(Class<T> observerType);
62   -
63   - /**
64   - * @param api
65   - */
66   - public abstract List<? extends Observer> getPreInitObservers(LiteAPI api);
67   -
68   - /**
69   - * @param observerType
70   - */
71   - public abstract <T extends Observer> List<T> getPreInitObservers(Class<T> observerType);
72   -}
  1 +package com.mumfrey.liteloader.api.manager;
  2 +
  3 +import java.util.List;
  4 +
  5 +import com.mumfrey.liteloader.api.CoreProvider;
  6 +import com.mumfrey.liteloader.api.LiteAPI;
  7 +import com.mumfrey.liteloader.api.Observer;
  8 +import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
  9 +
  10 +/**
  11 + * API Adapter provides convenience methods for invoking actions on ALL registered APIs
  12 + *
  13 + * @author Adam Mummery-Smith
  14 + */
  15 +public interface APIAdapter
  16 +{
  17 + /**
  18 + * Aggregate and return required transformers from all registered APIs
  19 + */
  20 + public abstract List<String> getRequiredTransformers();
  21 +
  22 + /**
  23 + * Aggregate and return required downstream transformers from all registered APIs
  24 + */
  25 + public abstract List<String> getRequiredDownstreamTransformers();
  26 +
  27 + /**
  28 + * Register interfaces from all registered APIs with the specified registry
  29 + */
  30 + public abstract void registerInterfaces(InterfaceRegistry interfaceManager);
  31 +
  32 + /**
  33 + * Get the CoreProviders for the specified API. Consuming classes should call this method instead of calling API::getCoreProviders()
  34 + * directly since getCoreProviders() should only be invoked once and the resulting collection is cached by the API Adapter
  35 + */
  36 + public abstract List<CoreProvider> getCoreProviders();
  37 +
  38 + /**
  39 + * Get the observers for the specified API. Consuming classes should call this method instead of calling API::getObservers() directly
  40 + * since getObservers() should only be invoked once and the resulting list is cached by the API Adapter
  41 + *
  42 + * @param api API to get observers for
  43 + */
  44 + public abstract List<? extends Observer> getObservers(LiteAPI api);
  45 +
  46 + /**
  47 + * Get the observers for the specified API which implement the specified Observer interface. Always returns a valid list (even if
  48 + * empty) and doesn't return null.
  49 + *
  50 + * @param api API to get observers for
  51 + * @param observerType type of observer to search for
  52 + */
  53 + public abstract <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType);
  54 +
  55 + /**
  56 + * Get the observers for all registered APIs which implement the specified Observer interface. Always returns a valid list (even if
  57 + * empty) and doesn't return null. Also includes core providers
  58 + *
  59 + * @param observerType type of observer to search for
  60 + */
  61 + public abstract <T extends Observer> List<T> getAllObservers(Class<T> observerType);
  62 +
  63 + /**
  64 + * @param api
  65 + */
  66 + public abstract List<? extends Observer> getPreInitObservers(LiteAPI api);
  67 +
  68 + /**
  69 + * @param observerType
  70 + */
  71 + public abstract <T extends Observer> List<T> getPreInitObservers(Class<T> observerType);
  72 +}
... ...
java/common/com/mumfrey/liteloader/api/manager/APIProvider.java renamed to src/main/java/com/mumfrey/liteloader/api/manager/APIProvider.java
1   -package com.mumfrey.liteloader.api.manager;
2   -
3   -import java.util.regex.Pattern;
4   -
5   -import com.mumfrey.liteloader.api.LiteAPI;
6   -
7   -/**
8   - * Interface for the API Provider, which manages API instances and lifecycle
9   - *
10   - * @author Adam Mummery-Smith
11   - */
12   -public interface APIProvider
13   -{
14   - public static final Pattern idAndRevisionPattern = Pattern.compile("^([^@]+)@([0-9]{1,5})$");
15   -
16   - /**
17   - * Get all available API instances in an array
18   - */
19   - public abstract LiteAPI[] getAPIs();
20   -
21   - /**
22   - * Returns true if the specified API is available
23   - *
24   - * @param identifier API identifier (case sensitive) or API identifier-plus-minrevision in the form "identifier@minver"
25   - */
26   - public abstract boolean isAPIAvailable(String identifier);
27   -
28   - /**
29   - * Returns true if the specified API is available
30   - *
31   - * @param identifier API identifier (case sensitive)
32   - * @param minRevision minimum required revision
33   - */
34   - public abstract boolean isAPIAvailable(String identifier, int minRevision);
35   -
36   - /**
37   - * Gets a specific API by identifier
38   - *
39   - * @param identifier API identifier (case sensitive)
40   - */
41   - public abstract LiteAPI getAPI(String identifier);
42   -
43   - /**
44   - * Gets a specific API by class
45   - *
46   - * @param apiClass
47   - */
48   - public abstract <T extends LiteAPI> T getAPI(Class<T> apiClass);
  1 +package com.mumfrey.liteloader.api.manager;
  2 +
  3 +import java.util.regex.Pattern;
  4 +
  5 +import com.mumfrey.liteloader.api.LiteAPI;
  6 +
  7 +/**
  8 + * Interface for the API Provider, which manages API instances and lifecycle
  9 + *
  10 + * @author Adam Mummery-Smith
  11 + */
  12 +public interface APIProvider
  13 +{
  14 + public static final Pattern idAndRevisionPattern = Pattern.compile("^([^@]+)@([0-9]{1,5})$");
  15 +
  16 + /**
  17 + * Get all available API instances in an array
  18 + */
  19 + public abstract LiteAPI[] getAPIs();
  20 +
  21 + /**
  22 + * Returns true if the specified API is available
  23 + *
  24 + * @param identifier API identifier (case sensitive) or API identifier-plus-minrevision in the form "identifier@minver"
  25 + */
  26 + public abstract boolean isAPIAvailable(String identifier);
  27 +
  28 + /**
  29 + * Returns true if the specified API is available
  30 + *
  31 + * @param identifier API identifier (case sensitive)
  32 + * @param minRevision minimum required revision
  33 + */
  34 + public abstract boolean isAPIAvailable(String identifier, int minRevision);
  35 +
  36 + /**
  37 + * Gets a specific API by identifier
  38 + *
  39 + * @param identifier API identifier (case sensitive)
  40 + */
  41 + public abstract LiteAPI getAPI(String identifier);
  42 +
  43 + /**
  44 + * Gets a specific API by class
  45 + *
  46 + * @param apiClass
  47 + */
  48 + public abstract <T extends LiteAPI> T getAPI(Class<T> apiClass);
49 49 }
50 50 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/api/manager/APIProviderBasic.java renamed to src/main/java/com/mumfrey/liteloader/api/manager/APIProviderBasic.java
1   -package com.mumfrey.liteloader.api.manager;
2   -
3   -import java.util.ArrayList;
4   -import java.util.Arrays;
5   -import java.util.Collections;
6   -import java.util.HashMap;
7   -import java.util.List;
8   -import java.util.Map;
9   -import java.util.regex.Matcher;
10   -
11   -import com.mumfrey.liteloader.api.CoreProvider;
12   -import com.mumfrey.liteloader.api.LiteAPI;
13   -import com.mumfrey.liteloader.api.Observer;
14   -import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
15   -
16   -/**
17   - * Basic implementation of APIProvider and APIAdapter
18   - *
19   - * @author Adam Mummery-Smith
20   - */
21   -class APIProviderBasic implements APIProvider, APIAdapter
22   -{
23   - /**
24   - * API instances
25   - */
26   - private final LiteAPI[] apis;
27   -
28   - /**
29   - * Map of API identifiers to API instances
30   - */
31   - private final Map<String, LiteAPI> apiMap = new HashMap<String, LiteAPI>();
32   -
33   - /**
34   - * Cached observer set
35   - */
36   - private final Map<LiteAPI, List<? extends Observer>> observers = new HashMap<LiteAPI, List<? extends Observer>>();
37   -
38   - /**
39   - * Cached preinit observers
40   - */
41   - private final Map<LiteAPI, List<? extends Observer>> preInitiObservers = new HashMap<LiteAPI, List<? extends Observer>>();
42   -
43   - /**
44   - * Cached CoreProvider set
45   - */
46   - private List<CoreProvider> coreProviders;
47   -
48   - APIProviderBasic(LiteAPI[] apis)
49   - {
50   - this.apis = apis;
51   -
52   - for (LiteAPI api : this.apis)
53   - {
54   - this.apiMap.put(api.getIdentifier(), api);
55   - }
56   - }
57   -
58   - /* (non-Javadoc)
59   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredTransformers()
60   - */
61   - @Override
62   - public List<String> getRequiredTransformers()
63   - {
64   - List<String> requiredTransformers = new ArrayList<String>();
65   -
66   - for (LiteAPI api : this.apis)
67   - {
68   - String[] apiTransformers = api.getRequiredTransformers();
69   - if (apiTransformers != null)
70   - {
71   - requiredTransformers.addAll(Arrays.asList(apiTransformers));
72   - }
73   - }
74   -
75   - return requiredTransformers;
76   - }
77   -
78   - /* (non-Javadoc)
79   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredDownstreamTransformers()
80   - */
81   - @Override
82   - public List<String> getRequiredDownstreamTransformers()
83   - {
84   - List<String> requiredDownstreamTransformers = new ArrayList<String>();
85   -
86   - for (LiteAPI api : this.apis)
87   - {
88   - String[] apiTransformers = api.getRequiredDownstreamTransformers();
89   - if (apiTransformers != null)
90   - {
91   - requiredDownstreamTransformers.addAll(Arrays.asList(apiTransformers));
92   - }
93   - }
94   -
95   - return requiredDownstreamTransformers;
96   - }
97   -
98   - /* (non-Javadoc)
99   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getObservers(com.mumfrey.liteloader.api.LiteAPI)
100   - */
101   - @Override
102   - public List<? extends Observer> getObservers(LiteAPI api)
103   - {
104   - if (!this.observers.containsKey(api))
105   - {
106   - List<Observer> apiObservers = api.getObservers();
107   - this.observers.put(api, Collections.unmodifiableList(apiObservers != null ? apiObservers : new ArrayList<Observer>()));
108   - }
109   -
110   - return this.observers.get(api);
111   - }
112   -
113   - @Override
114   - public List<? extends Observer> getPreInitObservers(LiteAPI api)
115   - {
116   - if (!this.preInitiObservers.containsKey(api))
117   - {
118   - List<Observer> apiObservers = api.getPreInitObservers();
119   - this.preInitiObservers.put(api, Collections.unmodifiableList(apiObservers != null ? apiObservers : new ArrayList<Observer>()));
120   - }
121   -
122   - return this.preInitiObservers.get(api);
123   - }
124   -
125   - @SuppressWarnings("unchecked")
126   - @Override
127   - public <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType)
128   - {
129   - List<T> matchingObservers = new ArrayList<T>();
130   -
131   - for (Observer observer : this.getObservers(api))
132   - {
133   - if (observerType.isAssignableFrom(observer.getClass()) && !matchingObservers.contains(observer))
134   - {
135   - matchingObservers.add((T)observer);
136   - }
137   - }
138   -
139   - return matchingObservers;
140   - }
141   -
142   - @SuppressWarnings("unchecked")
143   - @Override
144   - public <T extends Observer> List<T> getAllObservers(Class<T> observerType)
145   - {
146   - List<T> matchingObservers = new ArrayList<T>();
147   - for (LiteAPI api : this.apis)
148   - {
149   - matchingObservers.addAll(this.<T>getObservers(api, observerType));
150   - }
151   -
152   - for (CoreProvider coreProvider : this.getCoreProviders())
153   - {
154   - if (observerType.isAssignableFrom(coreProvider.getClass()) && !matchingObservers.contains(coreProvider))
155   - matchingObservers.add((T)coreProvider);
156   - }
157   -
158   - return matchingObservers;
159   - }
160   -
161   - @SuppressWarnings("unchecked")
162   - @Override
163   - public <T extends Observer> List<T> getPreInitObservers(Class<T> observerType)
164   - {
165   - List<T> matchingObservers = new ArrayList<T>();
166   - for (LiteAPI api : this.apis)
167   - {
168   - for (Observer observer : this.getPreInitObservers(api))
169   - {
170   - if (observerType.isAssignableFrom(observer.getClass()) && !matchingObservers.contains(observer))
171   - {
172   - matchingObservers.add((T)observer);
173   - }
174   - }
175   - }
176   -
177   - return matchingObservers;
178   - }
179   -
180   - /* (non-Javadoc)
181   - * @see com.mumfrey.liteloader.api.manager.APIProvider#registerInterfaceProviders(com.mumfrey.liteloader.core.InterfaceManager)
182   - */
183   - @Override
184   - public void registerInterfaces(InterfaceRegistry interfaceManager)
185   - {
186   - for (LiteAPI api : this.apis)
187   - {
188   - interfaceManager.registerAPI(api);
189   - }
190   - }
191   -
192   - /* (non-Javadoc)
193   - * @see com.mumfrey.liteloader.api.manager.APIAdapter#getCoreProviders()
194   - */
195   - @Override
196   - public List<CoreProvider> getCoreProviders()
197   - {
198   - if (this.coreProviders == null)
199   - {
200   - List<CoreProvider> coreProviders = new ArrayList<CoreProvider>();
201   -
202   - for (LiteAPI api : this.apis)
203   - {
204   - List<CoreProvider> apiCoreProviders = api.getCoreProviders();
205   - if (apiCoreProviders != null)
206   - {
207   - coreProviders.addAll(apiCoreProviders);
208   - }
209   - }
210   -
211   - this.coreProviders = Collections.unmodifiableList(coreProviders);
212   - }
213   -
214   - return this.coreProviders;
215   - }
216   -
217   - /* (non-Javadoc)
218   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPIs()
219   - */
220   - @Override
221   - public LiteAPI[] getAPIs()
222   - {
223   - return this.apis;
224   - }
225   -
226   - /* (non-Javadoc)
227   - * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String)
228   - */
229   - @Override
230   - public boolean isAPIAvailable(String identifier)
231   - {
232   - if (identifier != null && identifier.contains("@"))
233   - {
234   - Matcher idAndRevisionPatternMatcher = APIProvider.idAndRevisionPattern.matcher(identifier);
235   - if (idAndRevisionPatternMatcher.matches())
236   - {
237   - return this.isAPIAvailable(idAndRevisionPatternMatcher.group(1), Integer.parseInt(idAndRevisionPatternMatcher.group(2)));
238   - }
239   - }
240   -
241   - return this.apiMap.containsKey(identifier);
242   - }
243   -
244   - /* (non-Javadoc)
245   - * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String, int)
246   - */
247   - @Override
248   - public boolean isAPIAvailable(String identifier, int minRevision)
249   - {
250   - LiteAPI api = this.apiMap.get(identifier);
251   - if (api == null) return false;
252   -
253   - return api.getRevision() >= minRevision;
254   - }
255   -
256   - /* (non-Javadoc)
257   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.String)
258   - */
259   - @Override
260   - public LiteAPI getAPI(String identifier)
261   - {
262   - return this.apiMap.get(identifier);
263   - }
264   -
265   - /* (non-Javadoc)
266   - * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.Class)
267   - */
268   - @SuppressWarnings("unchecked")
269   - @Override
270   - public <T extends LiteAPI> T getAPI(Class<T> apiClass)
271   - {
272   - try
273   - {
274   - for (LiteAPI api : this.apis)
275   - {
276   - if (apiClass.isAssignableFrom(api.getClass()))
277   - return (T)api;
278   - }
279   - }
280   - catch (NullPointerException ex1) {}
281   - catch (ClassCastException ex2) {}
282   -
283   - return null;
284   - }
285   -}
  1 +package com.mumfrey.liteloader.api.manager;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.Arrays;
  5 +import java.util.Collections;
  6 +import java.util.HashMap;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +import java.util.regex.Matcher;
  10 +
  11 +import com.mumfrey.liteloader.api.CoreProvider;
  12 +import com.mumfrey.liteloader.api.LiteAPI;
  13 +import com.mumfrey.liteloader.api.Observer;
  14 +import com.mumfrey.liteloader.interfaces.InterfaceRegistry;
  15 +
  16 +/**
  17 + * Basic implementation of APIProvider and APIAdapter
  18 + *
  19 + * @author Adam Mummery-Smith
  20 + */
  21 +class APIProviderBasic implements APIProvider, APIAdapter
  22 +{
  23 + /**
  24 + * API instances
  25 + */
  26 + private final LiteAPI[] apis;
  27 +
  28 + /**
  29 + * Map of API identifiers to API instances
  30 + */
  31 + private final Map<String, LiteAPI> apiMap = new HashMap<String, LiteAPI>();
  32 +
  33 + /**
  34 + * Cached observer set
  35 + */
  36 + private final Map<LiteAPI, List<? extends Observer>> observers = new HashMap<LiteAPI, List<? extends Observer>>();
  37 +
  38 + /**
  39 + * Cached preinit observers
  40 + */
  41 + private final Map<LiteAPI, List<? extends Observer>> preInitiObservers = new HashMap<LiteAPI, List<? extends Observer>>();
  42 +
  43 + /**
  44 + * Cached CoreProvider set
  45 + */
  46 + private List<CoreProvider> coreProviders;
  47 +
  48 + APIProviderBasic(LiteAPI[] apis)
  49 + {
  50 + this.apis = apis;
  51 +
  52 + for (LiteAPI api : this.apis)
  53 + {
  54 + this.apiMap.put(api.getIdentifier(), api);
  55 + }
  56 + }
  57 +
  58 + /* (non-Javadoc)
  59 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredTransformers()
  60 + */
  61 + @Override
  62 + public List<String> getRequiredTransformers()
  63 + {
  64 + List<String> requiredTransformers = new ArrayList<String>();
  65 +
  66 + for (LiteAPI api : this.apis)
  67 + {
  68 + String[] apiTransformers = api.getRequiredTransformers();
  69 + if (apiTransformers != null)
  70 + {
  71 + requiredTransformers.addAll(Arrays.asList(apiTransformers));
  72 + }
  73 + }
  74 +
  75 + return requiredTransformers;
  76 + }
  77 +
  78 + /* (non-Javadoc)
  79 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getRequiredDownstreamTransformers()
  80 + */
  81 + @Override
  82 + public List<String> getRequiredDownstreamTransformers()
  83 + {
  84 + List<String> requiredDownstreamTransformers = new ArrayList<String>();
  85 +
  86 + for (LiteAPI api : this.apis)
  87 + {
  88 + String[] apiTransformers = api.getRequiredDownstreamTransformers();
  89 + if (apiTransformers != null)
  90 + {
  91 + requiredDownstreamTransformers.addAll(Arrays.asList(apiTransformers));
  92 + }
  93 + }
  94 +
  95 + return requiredDownstreamTransformers;
  96 + }
  97 +
  98 + /* (non-Javadoc)
  99 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getObservers(com.mumfrey.liteloader.api.LiteAPI)
  100 + */
  101 + @Override
  102 + public List<? extends Observer> getObservers(LiteAPI api)
  103 + {
  104 + if (!this.observers.containsKey(api))
  105 + {
  106 + List<Observer> apiObservers = api.getObservers();
  107 + this.observers.put(api, Collections.unmodifiableList(apiObservers != null ? apiObservers : new ArrayList<Observer>()));
  108 + }
  109 +
  110 + return this.observers.get(api);
  111 + }
  112 +
  113 + @Override
  114 + public List<? extends Observer> getPreInitObservers(LiteAPI api)
  115 + {
  116 + if (!this.preInitiObservers.containsKey(api))
  117 + {
  118 + List<Observer> apiObservers = api.getPreInitObservers();
  119 + this.preInitiObservers.put(api, Collections.unmodifiableList(apiObservers != null ? apiObservers : new ArrayList<Observer>()));
  120 + }
  121 +
  122 + return this.preInitiObservers.get(api);
  123 + }
  124 +
  125 + @SuppressWarnings("unchecked")
  126 + @Override
  127 + public <T extends Observer> List<T> getObservers(LiteAPI api, Class<T> observerType)
  128 + {
  129 + List<T> matchingObservers = new ArrayList<T>();
  130 +
  131 + for (Observer observer : this.getObservers(api))
  132 + {
  133 + if (observerType.isAssignableFrom(observer.getClass()) && !matchingObservers.contains(observer))
  134 + {
  135 + matchingObservers.add((T)observer);
  136 + }
  137 + }
  138 +
  139 + return matchingObservers;
  140 + }
  141 +
  142 + @SuppressWarnings("unchecked")
  143 + @Override
  144 + public <T extends Observer> List<T> getAllObservers(Class<T> observerType)
  145 + {
  146 + List<T> matchingObservers = new ArrayList<T>();
  147 + for (LiteAPI api : this.apis)
  148 + {
  149 + matchingObservers.addAll(this.<T>getObservers(api, observerType));
  150 + }
  151 +
  152 + for (CoreProvider coreProvider : this.getCoreProviders())
  153 + {
  154 + if (observerType.isAssignableFrom(coreProvider.getClass()) && !matchingObservers.contains(coreProvider))
  155 + matchingObservers.add((T)coreProvider);
  156 + }
  157 +
  158 + return matchingObservers;
  159 + }
  160 +
  161 + @SuppressWarnings("unchecked")
  162 + @Override
  163 + public <T extends Observer> List<T> getPreInitObservers(Class<T> observerType)
  164 + {
  165 + List<T> matchingObservers = new ArrayList<T>();
  166 + for (LiteAPI api : this.apis)
  167 + {
  168 + for (Observer observer : this.getPreInitObservers(api))
  169 + {
  170 + if (observerType.isAssignableFrom(observer.getClass()) && !matchingObservers.contains(observer))
  171 + {
  172 + matchingObservers.add((T)observer);
  173 + }
  174 + }
  175 + }
  176 +
  177 + return matchingObservers;
  178 + }
  179 +
  180 + /* (non-Javadoc)
  181 + * @see com.mumfrey.liteloader.api.manager.APIProvider#registerInterfaceProviders(com.mumfrey.liteloader.core.InterfaceManager)
  182 + */
  183 + @Override
  184 + public void registerInterfaces(InterfaceRegistry interfaceManager)
  185 + {
  186 + for (LiteAPI api : this.apis)
  187 + {
  188 + interfaceManager.registerAPI(api);
  189 + }
  190 + }
  191 +
  192 + /* (non-Javadoc)
  193 + * @see com.mumfrey.liteloader.api.manager.APIAdapter#getCoreProviders()
  194 + */
  195 + @Override
  196 + public List<CoreProvider> getCoreProviders()
  197 + {
  198 + if (this.coreProviders == null)
  199 + {
  200 + List<CoreProvider> coreProviders = new ArrayList<CoreProvider>();
  201 +
  202 + for (LiteAPI api : this.apis)
  203 + {
  204 + List<CoreProvider> apiCoreProviders = api.getCoreProviders();
  205 + if (apiCoreProviders != null)
  206 + {
  207 + coreProviders.addAll(apiCoreProviders);
  208 + }
  209 + }
  210 +
  211 + this.coreProviders = Collections.unmodifiableList(coreProviders);
  212 + }
  213 +
  214 + return this.coreProviders;
  215 + }
  216 +
  217 + /* (non-Javadoc)
  218 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPIs()
  219 + */
  220 + @Override
  221 + public LiteAPI[] getAPIs()
  222 + {
  223 + return this.apis;
  224 + }
  225 +
  226 + /* (non-Javadoc)
  227 + * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String)
  228 + */
  229 + @Override
  230 + public boolean isAPIAvailable(String identifier)
  231 + {
  232 + if (identifier != null && identifier.contains("@"))
  233 + {
  234 + Matcher idAndRevisionPatternMatcher = APIProvider.idAndRevisionPattern.matcher(identifier);
  235 + if (idAndRevisionPatternMatcher.matches())
  236 + {
  237 + return this.isAPIAvailable(idAndRevisionPatternMatcher.group(1), Integer.parseInt(idAndRevisionPatternMatcher.group(2)));
  238 + }
  239 + }
  240 +
  241 + return this.apiMap.containsKey(identifier);
  242 + }
  243 +
  244 + /* (non-Javadoc)
  245 + * @see com.mumfrey.liteloader.api.manager.APIProvider#isAPIAvailable(java.lang.String, int)
  246 + */
  247 + @Override
  248 + public boolean isAPIAvailable(String identifier, int minRevision)
  249 + {
  250 + LiteAPI api = this.apiMap.get(identifier);
  251 + if (api == null) return false;
  252 +
  253 + return api.getRevision() >= minRevision;
  254 + }
  255 +
  256 + /* (non-Javadoc)
  257 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.String)
  258 + */
  259 + @Override
  260 + public LiteAPI getAPI(String identifier)
  261 + {
  262 + return this.apiMap.get(identifier);
  263 + }
  264 +
  265 + /* (non-Javadoc)
  266 + * @see com.mumfrey.liteloader.api.manager.APIProvider#getAPI(java.lang.Class)
  267 + */
  268 + @SuppressWarnings("unchecked")
  269 + @Override
  270 + public <T extends LiteAPI> T getAPI(Class<T> apiClass)
  271 + {
  272 + try
  273 + {
  274 + for (LiteAPI api : this.apis)
  275 + {
  276 + if (apiClass.isAssignableFrom(api.getClass()))
  277 + return (T)api;
  278 + }
  279 + }
  280 + catch (NullPointerException ex1) {}
  281 + catch (ClassCastException ex2) {}
  282 +
  283 + return null;
  284 + }
  285 +}
... ...
java/common/com/mumfrey/liteloader/api/manager/APIRegistry.java renamed to src/main/java/com/mumfrey/liteloader/api/manager/APIRegistry.java
1   -package com.mumfrey.liteloader.api.manager;
2   -
3   -import java.util.ArrayList;
4   -import java.util.LinkedHashMap;
5   -import java.util.LinkedHashSet;
6   -import java.util.List;
7   -import java.util.Map;
8   -import java.util.Set;
9   -
10   -import net.minecraft.launchwrapper.Launch;
11   -
12   -import com.mumfrey.liteloader.api.LiteAPI;
13   -import com.mumfrey.liteloader.api.exceptions.InvalidAPIStateException;
14   -import com.mumfrey.liteloader.launch.LoaderEnvironment;
15   -import com.mumfrey.liteloader.launch.LoaderProperties;
16   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
17   -import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
18   -
19   -/**
20   - * This is where we register API classes during early startup before baking the registered list into an
21   - * APIProvider instance
22   - *
23   - * @author Adam Mummery-Smith
24   - */
25   -public final class APIRegistry
26   -{
27   - private Set<String> registeredAPIClasses = new LinkedHashSet<String>();
28   - private Map<String, LiteAPI> instances = new LinkedHashMap<String, LiteAPI>();
29   -
30   - private final LoaderEnvironment environment;
31   -
32   - private final LoaderProperties properties;
33   -
34   - private APIProviderBasic baked;
35   -
36   - /**
37   - * @param environment
38   - * @param properties
39   - */
40   - public APIRegistry(LoaderEnvironment environment, LoaderProperties properties)
41   - {
42   - this.environment = environment;
43   - this.properties = properties;
44   - }
45   -
46   - /**
47   - * Register an API class, throws an exception if the API list has already been baked
48   - *
49   - * @param apiClass
50   - */
51   - public void registerAPI(String apiClass) throws InvalidAPIStateException
52   - {
53   - if (this.baked != null)
54   - {
55   - throw new InvalidAPIStateException("Unable to register API provider '" + apiClass + "' because the API state is now frozen, this probably means you are registering an API too late in the initialisation process");
56   - }
57   -
58   - if (!this.registeredAPIClasses.contains(apiClass))
59   - {
60   - LiteLoaderLogger.info(Verbosity.REDUCED, "Registering API provider class %s", apiClass);
61   - this.registeredAPIClasses.add(apiClass);
62   - }
63   - }
64   -
65   - /**
66   - * Get all currently registered API classes
67   - */
68   - public String[] getRegisteredAPIs()
69   - {
70   - return this.registeredAPIClasses.toArray(new String[0]);
71   - }
72   -
73   - /**
74   - * @param apiClassName
75   - */
76   - private LiteAPI spawnAPI(String apiClassName)
77   - {
78   - try
79   - {
80   - LiteLoaderLogger.info("Spawning API provider class '%s' ...", apiClassName);
81   -
82   - @SuppressWarnings("unchecked")
83   - Class<? extends LiteAPI> apiClass = (Class<? extends LiteAPI>)Class.forName(apiClassName, true, Launch.classLoader);
84   -
85   - LiteAPI api = apiClass.newInstance();
86   - String identifier = api.getIdentifier();
87   -
88   - if (!this.instances.containsKey(identifier))
89   - {
90   - LiteLoaderLogger.info(Verbosity.REDUCED, "API provider class '%s' provides API '%s'", apiClassName, identifier);
91   - this.instances.put(identifier, api);
92   - return api;
93   - }
94   -
95   - Class<? extends LiteAPI> conflictingAPIClass = this.instances.get(identifier).getClass();
96   - LiteLoaderLogger.severe("API identifier clash while registering '%s', identifier '%s' clashes with '%s'", apiClassName, identifier, conflictingAPIClass);
97   - }
98   - catch (ClassNotFoundException ex)
99   - {
100   - LiteLoaderLogger.severe("API class '%s' could not be created, the specified class could not be loaded", apiClassName);
101   - }
102   - catch (Exception ex)
103   - {
104   - LiteLoaderLogger.severe(ex, "Error while instancing API class '%s'", apiClassName);
105   - }
106   -
107   - return null;
108   - }
109   -
110   - /**
111   - * Populate and return the API instance array
112   - */
113   - private LiteAPI[] getAllAPIs()
114   - {
115   - List<LiteAPI> allAPIs = new ArrayList<LiteAPI>();
116   -
117   - for (String apiClass : this.registeredAPIClasses)
118   - {
119   - LiteAPI api = this.spawnAPI(apiClass);
120   - if (api != null)
121   - {
122   - allAPIs.add(api);
123   - }
124   - }
125   -
126   - for (LiteAPI api : allAPIs)
127   - {
128   - LiteLoaderLogger.info(Verbosity.REDUCED, "Initialising API '%s' ...", api.getIdentifier());
129   - api.init(this.environment, this.properties);
130   - }
131   -
132   - return allAPIs.toArray(new LiteAPI[allAPIs.size()]);
133   - }
134   -
135   - /**
136   - * Bakes all currently registered API classes to a new APIProvider containing the API instances
137   - * @throws InvalidAPIStateException if the API list was already baked
138   - */
139   - public APIProvider bake() throws InvalidAPIStateException
140   - {
141   - if (this.baked != null)
142   - {
143   - throw new InvalidAPIStateException("Unable to bake the API provider list because the API list is already baked");
144   - }
145   -
146   - LiteAPI[] apis = this.getAllAPIs();
147   - return this.baked = new APIProviderBasic(apis);
148   - }
149   -
150   - /**
151   - * Gets the current APIProvider instance
152   - * @throws InvalidAPIStateException if the provider list was not yet baked
153   - */
154   - public APIProvider getProvider() throws InvalidAPIStateException
155   - {
156   - if (this.baked == null)
157   - {
158   - throw new InvalidAPIStateException("Call to APIRegistry.getProvider() failed because the provider list has not been baked");
159   - }
160   -
161   - return this.baked;
162   - }
163   -
164   - /**
165   - * Gets the current APIAdapter instance
166   - * @throws InvalidAPIStateException if the provider list was not yet baked
167   - */
168   - public APIAdapter getAdapter() throws InvalidAPIStateException
169   - {
170   - if (this.baked == null)
171   - {
172   - throw new InvalidAPIStateException("Call to APIRegistry.APIAdapter() failed because the provider list has not been baked");
173   - }
174   -
175   - return this.baked;
176   - }
177   -}
  1 +package com.mumfrey.liteloader.api.manager;
  2 +
  3 +import java.util.ArrayList;
  4 +import java.util.LinkedHashMap;
  5 +import java.util.LinkedHashSet;
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +import java.util.Set;
  9 +
  10 +import net.minecraft.launchwrapper.Launch;
  11 +
  12 +import com.mumfrey.liteloader.api.LiteAPI;
  13 +import com.mumfrey.liteloader.api.exceptions.InvalidAPIStateException;
  14 +import com.mumfrey.liteloader.launch.LoaderEnvironment;
  15 +import com.mumfrey.liteloader.launch.LoaderProperties;
  16 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
  17 +import com.mumfrey.liteloader.util.log.LiteLoaderLogger.Verbosity;
  18 +
  19 +/**
  20 + * This is where we register API classes during early startup before baking the registered list into an
  21 + * APIProvider instance
  22 + *
  23 + * @author Adam Mummery-Smith
  24 + */
  25 +public final class APIRegistry
  26 +{
  27 + private Set<String> registeredAPIClasses = new LinkedHashSet<String>();
  28 + private Map<String, LiteAPI> instances = new LinkedHashMap<String, LiteAPI>();
  29 +
  30 + private final LoaderEnvironment environment;
  31 +
  32 + private final LoaderProperties properties;
  33 +
  34 + private APIProviderBasic baked;
  35 +
  36 + /**
  37 + * @param environment
  38 + * @param properties
  39 + */
  40 + public APIRegistry(LoaderEnvironment environment, LoaderProperties properties)
  41 + {
  42 + this.environment = environment;
  43 + this.properties = properties;
  44 + }
  45 +
  46 + /**
  47 + * Register an API class, throws an exception if the API list has already been baked
  48 + *
  49 + * @param apiClass
  50 + */
  51 + public void registerAPI(String apiClass) throws InvalidAPIStateException
  52 + {
  53 + if (this.baked != null)
  54 + {
  55 + throw new InvalidAPIStateException("Unable to register API provider '" + apiClass + "' because the API state is now frozen, this probably means you are registering an API too late in the initialisation process");
  56 + }
  57 +
  58 + if (!this.registeredAPIClasses.contains(apiClass))
  59 + {
  60 + LiteLoaderLogger.info(Verbosity.REDUCED, "Registering API provider class %s", apiClass);
  61 + this.registeredAPIClasses.add(apiClass);
  62 + }
  63 + }
  64 +
  65 + /**
  66 + * Get all currently registered API classes
  67 + */
  68 + public String[] getRegisteredAPIs()
  69 + {
  70 + return this.registeredAPIClasses.toArray(new String[0]);
  71 + }
  72 +
  73 + /**
  74 + * @param apiClassName
  75 + */
  76 + private LiteAPI spawnAPI(String apiClassName)
  77 + {
  78 + try
  79 + {
  80 + LiteLoaderLogger.info("Spawning API provider class '%s' ...", apiClassName);
  81 +
  82 + @SuppressWarnings("unchecked")
  83 + Class<? extends LiteAPI> apiClass = (Class<? extends LiteAPI>)Class.forName(apiClassName, true, Launch.classLoader);
  84 +
  85 + LiteAPI api = apiClass.newInstance();
  86 + String identifier = api.getIdentifier();
  87 +
  88 + if (!this.instances.containsKey(identifier))
  89 + {
  90 + LiteLoaderLogger.info(Verbosity.REDUCED, "API provider class '%s' provides API '%s'", apiClassName, identifier);
  91 + this.instances.put(identifier, api);
  92 + return api;
  93 + }
  94 +
  95 + Class<? extends LiteAPI> conflictingAPIClass = this.instances.get(identifier).getClass();
  96 + LiteLoaderLogger.severe("API identifier clash while registering '%s', identifier '%s' clashes with '%s'", apiClassName, identifier, conflictingAPIClass);
  97 + }
  98 + catch (ClassNotFoundException ex)
  99 + {
  100 + LiteLoaderLogger.severe("API class '%s' could not be created, the specified class could not be loaded", apiClassName);
  101 + }
  102 + catch (Exception ex)
  103 + {
  104 + LiteLoaderLogger.severe(ex, "Error while instancing API class '%s'", apiClassName);
  105 + }
  106 +
  107 + return null;
  108 + }
  109 +
  110 + /**
  111 + * Populate and return the API instance array
  112 + */
  113 + private LiteAPI[] getAllAPIs()
  114 + {
  115 + List<LiteAPI> allAPIs = new ArrayList<LiteAPI>();
  116 +
  117 + for (String apiClass : this.registeredAPIClasses)
  118 + {
  119 + LiteAPI api = this.spawnAPI(apiClass);
  120 + if (api != null)
  121 + {
  122 + allAPIs.add(api);
  123 + }
  124 + }
  125 +
  126 + for (LiteAPI api : allAPIs)
  127 + {
  128 + LiteLoaderLogger.info(Verbosity.REDUCED, "Initialising API '%s' ...", api.getIdentifier());
  129 + api.init(this.environment, this.properties);
  130 + }
  131 +
  132 + return allAPIs.toArray(new LiteAPI[allAPIs.size()]);
  133 + }
  134 +
  135 + /**
  136 + * Bakes all currently registered API classes to a new APIProvider containing the API instances
  137 + * @throws InvalidAPIStateException if the API list was already baked
  138 + */
  139 + public APIProvider bake() throws InvalidAPIStateException
  140 + {
  141 + if (this.baked != null)
  142 + {
  143 + throw new InvalidAPIStateException("Unable to bake the API provider list because the API list is already baked");
  144 + }
  145 +
  146 + LiteAPI[] apis = this.getAllAPIs();
  147 + return this.baked = new APIProviderBasic(apis);
  148 + }
  149 +
  150 + /**
  151 + * Gets the current APIProvider instance
  152 + * @throws InvalidAPIStateException if the provider list was not yet baked
  153 + */
  154 + public APIProvider getProvider() throws InvalidAPIStateException
  155 + {
  156 + if (this.baked == null)
  157 + {
  158 + throw new InvalidAPIStateException("Call to APIRegistry.getProvider() failed because the provider list has not been baked");
  159 + }
  160 +
  161 + return this.baked;
  162 + }
  163 +
  164 + /**
  165 + * Gets the current APIAdapter instance
  166 + * @throws InvalidAPIStateException if the provider list was not yet baked
  167 + */
  168 + public APIAdapter getAdapter() throws InvalidAPIStateException
  169 + {
  170 + if (this.baked == null)
  171 + {
  172 + throw new InvalidAPIStateException("Call to APIRegistry.APIAdapter() failed because the provider list has not been baked");
  173 + }
  174 +
  175 + return this.baked;
  176 + }
  177 +}
... ...
java/common/com/mumfrey/liteloader/common/GameEngine.java renamed to src/main/java/com/mumfrey/liteloader/common/GameEngine.java
1   -package com.mumfrey.liteloader.common;
2   -
3   -import java.util.List;
4   -
5   -import net.minecraft.client.settings.KeyBinding;
6   -import net.minecraft.profiler.Profiler;
7   -import net.minecraft.server.MinecraftServer;
8   -
9   -/**
10   - * @author Adam Mummery-Smith
11   - *
12   - * @param <TClient> Type of the client runtime, "Minecraft" on client and null on the server
13   - * @param <TServer> Type of the server runtime, "IntegratedServer" on the client, "MinecraftServer" on the server
14   - */
15   -public interface GameEngine<TClient, TServer extends MinecraftServer>
16   -{
17   - /**
18   - * True if the environment is a client environment
19   - */
20   - public abstract boolean isClient();
21   -
22   - /**
23   - * True if the current environment is a server environment, always true on dedicated and true in single player
24   - */
25   - public abstract boolean isServer();
26   -
27   - /**
28   - * True if the client is "in game", always true on server
29   - */
30   - public abstract boolean isInGame();
31   -
32   - /**
33   - * True if the game loop's "isRunning" flag is true
34   - */
35   - public abstract boolean isRunning();
36   -
37   - /**
38   - * True if the current world is single player, always false on the server
39   - */
40   - public abstract boolean isSinglePlayer();
41   -
42   - /**
43   - * Get the underlying client instance, returns a dummy on the server
44   - */
45   - public abstract TClient getClient();
46   -
47   - /**
48   - * Get the underlying server instance
49   - */
50   - public abstract TServer getServer();
51   -
52   - /**
53   - * Get the resources manager
54   - */
55   - public abstract Resources<?, ?> getResources();
56   -
57   - /**
58   - * Get the profiler instance
59   - */
60   - public abstract Profiler getProfiler();
61   -
62   - /**
63   - * Get the keybinding list, only supported on client will throw an exception on the server
64   - */
65   - public abstract List<KeyBinding> getKeyBindings();
66   -
67   - /**
68   - * Set the keybinding list, only supported on client will throw an exception on the server
69   - *
70   - * @param keyBindings
71   - */
72   - public abstract void setKeyBindings(List<KeyBinding> keyBindings);
73   -}
  1 +package com.mumfrey.liteloader.common;
  2 +
  3 +import java.util.List;
  4 +
  5 +import net.minecraft.client.settings.KeyBinding;
  6 +import net.minecraft.profiler.Profiler;
  7 +import net.minecraft.server.MinecraftServer;
  8 +
  9 +/**
  10 + * @author Adam Mummery-Smith
  11 + *
  12 + * @param <TClient> Type of the client runtime, "Minecraft" on client and null on the server
  13 + * @param <TServer> Type of the server runtime, "IntegratedServer" on the client, "MinecraftServer" on the server
  14 + */
  15 +public interface GameEngine<TClient, TServer extends MinecraftServer>
  16 +{
  17 + /**
  18 + * True if the environment is a client environment
  19 + */
  20 + public abstract boolean isClient();
  21 +
  22 + /**
  23 + * True if the current environment is a server environment, always true on dedicated and true in single player
  24 + */
  25 + public abstract boolean isServer();
  26 +
  27 + /**
  28 + * True if the client is "in game", always true on server
  29 + */
  30 + public abstract boolean isInGame();
  31 +
  32 + /**
  33 + * True if the game loop's "isRunning" flag is true
  34 + */
  35 + public abstract boolean isRunning();
  36 +
  37 + /**
  38 + * True if the current world is single player, always false on the server
  39 + */
  40 + public abstract boolean isSinglePlayer();
  41 +
  42 + /**
  43 + * Get the underlying client instance, returns a dummy on the server
  44 + */
  45 + public abstract TClient getClient();
  46 +
  47 + /**
  48 + * Get the underlying server instance
  49 + */
  50 + public abstract TServer getServer();
  51 +
  52 + /**
  53 + * Get the resources manager
  54 + */
  55 + public abstract Resources<?, ?> getResources();
  56 +
  57 + /**
  58 + * Get the profiler instance
  59 + */
  60 + public abstract Profiler getProfiler();
  61 +
  62 + /**
  63 + * Get the keybinding list, only supported on client will throw an exception on the server
  64 + */
  65 + public abstract List<KeyBinding> getKeyBindings();
  66 +
  67 + /**
  68 + * Set the keybinding list, only supported on client will throw an exception on the server
  69 + *
  70 + * @param keyBindings
  71 + */
  72 + public abstract void setKeyBindings(List<KeyBinding> keyBindings);
  73 +}
... ...
java/common/com/mumfrey/liteloader/common/LoadingProgress.java renamed to src/main/java/com/mumfrey/liteloader/common/LoadingProgress.java
1   -package com.mumfrey.liteloader.common;
2   -
3   -/**
4   - * @author Adam Mummery-Smith
5   - */
6   -public abstract class LoadingProgress
7   -{
8   - private static LoadingProgress instance;
9   -
10   - protected LoadingProgress()
11   - {
12   - LoadingProgress.instance = this;
13   - }
14   -
15   - public static void setEnabled(boolean enabled)
16   - {
17   - if (LoadingProgress.instance != null) LoadingProgress.instance._setEnabled(enabled);
18   - }
19   -
20   - public static void dispose()
21   - {
22   - if (LoadingProgress.instance != null) LoadingProgress.instance._dispose();
23   - }
24   -
25   - public static void incLiteLoaderProgress()
26   - {
27   - if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress();
28   - }
29   -
30   - public static void setMessage(String format, String... args)
31   - {
32   - if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(String.format(format, args));
33   - }
34   -
35   - public static void setMessage(String message)
36   - {
37   - if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(message);
38   - }
39   -
40   - public static void incLiteLoaderProgress(String format, String... args)
41   - {
42   - if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(String.format(format, args));
43   - }
44   -
45   - public static void incLiteLoaderProgress(String message)
46   - {
47   - if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(message);
48   - }
49   -
50   - public static void incTotalLiteLoaderProgress(int by)
51   - {
52   - if (LoadingProgress.instance != null) LoadingProgress.instance._incTotalLiteLoaderProgress(by);
53   - }
54   -
55   - protected abstract void _setEnabled(boolean enabled);
56   -
57   - protected abstract void _dispose();
58   -
59   - protected abstract void _incLiteLoaderProgress();
60   -
61   - protected abstract void _setMessage(String message);
62   -
63   - protected abstract void _incLiteLoaderProgress(String message);
64   -
65   - protected abstract void _incTotalLiteLoaderProgress(int by);
  1 +package com.mumfrey.liteloader.common;
  2 +
  3 +/**
  4 + * @author Adam Mummery-Smith
  5 + */
  6 +public abstract class LoadingProgress
  7 +{
  8 + private static LoadingProgress instance;
  9 +
  10 + protected LoadingProgress()
  11 + {
  12 + LoadingProgress.instance = this;
  13 + }
  14 +
  15 + public static void setEnabled(boolean enabled)
  16 + {
  17 + if (LoadingProgress.instance != null) LoadingProgress.instance._setEnabled(enabled);
  18 + }
  19 +
  20 + public static void dispose()
  21 + {
  22 + if (LoadingProgress.instance != null) LoadingProgress.instance._dispose();
  23 + }
  24 +
  25 + public static void incLiteLoaderProgress()
  26 + {
  27 + if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress();
  28 + }
  29 +
  30 + public static void setMessage(String format, String... args)
  31 + {
  32 + if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(String.format(format, args));
  33 + }
  34 +
  35 + public static void setMessage(String message)
  36 + {
  37 + if (LoadingProgress.instance != null) LoadingProgress.instance._setMessage(message);
  38 + }
  39 +
  40 + public static void incLiteLoaderProgress(String format, String... args)
  41 + {
  42 + if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(String.format(format, args));
  43 + }
  44 +
  45 + public static void incLiteLoaderProgress(String message)
  46 + {
  47 + if (LoadingProgress.instance != null) LoadingProgress.instance._incLiteLoaderProgress(message);
  48 + }
  49 +
  50 + public static void incTotalLiteLoaderProgress(int by)
  51 + {
  52 + if (LoadingProgress.instance != null) LoadingProgress.instance._incTotalLiteLoaderProgress(by);
  53 + }
  54 +
  55 + protected abstract void _setEnabled(boolean enabled);
  56 +
  57 + protected abstract void _dispose();
  58 +
  59 + protected abstract void _incLiteLoaderProgress();
  60 +
  61 + protected abstract void _setMessage(String message);
  62 +
  63 + protected abstract void _incLiteLoaderProgress(String message);
  64 +
  65 + protected abstract void _incTotalLiteLoaderProgress(int by);
66 66 }
67 67 \ No newline at end of file
... ...
java/common/com/mumfrey/liteloader/common/Resources.java renamed to src/main/java/com/mumfrey/liteloader/common/Resources.java
1   -package com.mumfrey.liteloader.common;
2   -
3   -public interface Resources<TResourceManager, TResourcePack>
4   -{
5   - /**
6   - * Refresh resource pack list
7   - *
8   - * @param force
9   - */
10   - public abstract void refreshResources(boolean force);
11   -
12   - /**
13   - * Get the resource manager for the current environment, returns the SimpleReloadableResourceManager on client and ModResourceManager on the server
14   - */
15   - public abstract TResourceManager getResourceManager();
16   -
17   - /**
18   - * @param resourcePack
19   - */
20   - public abstract boolean registerResourcePack(TResourcePack resourcePack);
21   -
22   - /**
23   - * @param resourcePack
24   - */
25   - public abstract boolean unRegisterResourcePack(TResourcePack resourcePack);
26   -}
  1 +package com.mumfrey.liteloader.common;
  2 +
  3 +public interface Resources<TResourceManager, TResourcePack>
  4 +{
  5 + /**
  6 + * Refresh resource pack list
  7 + *
  8 + * @param force
  9 + */
  10 + public abstract void refreshResources(boolean force);
  11 +
  12 + /**
  13 + * Get the resource manager for the current environment, returns the SimpleReloadableResourceManager on client and ModResourceManager on the server
  14 + */
  15 + public abstract TResourceManager getResourceManager();
  16 +
  17 + /**
  18 + * @param resourcePack
  19 + */
  20 + public abstract boolean registerResourcePack(TResourcePack resourcePack);
  21 +
  22 + /**
  23 + * @param resourcePack
  24 + */
  25 + public abstract boolean unRegisterResourcePack(TResourcePack resourcePack);
  26 +}
... ...
java/common/com/mumfrey/liteloader/common/transformers/LiteLoaderEventTransformer.java renamed to src/main/java/com/mumfrey/liteloader/common/transformers/LiteLoaderEventTransformer.java
1   -package com.mumfrey.liteloader.common.transformers;
2   -
3   -import static com.mumfrey.liteloader.core.runtime.Methods.*;
4   -import static com.mumfrey.liteloader.transformers.event.InjectionPoint.*;
5   -
6   -import org.objectweb.asm.Opcodes;
7   -
8   -import com.mumfrey.liteloader.core.runtime.Obf;
9   -import com.mumfrey.liteloader.transformers.event.Event;
10   -import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
11   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
12   -import com.mumfrey.liteloader.transformers.event.MethodInfo;
13   -import com.mumfrey.liteloader.transformers.event.inject.BeforeFieldAccess;
14   -import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
15   -import com.mumfrey.liteloader.transformers.event.inject.BeforeNew;
16   -import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
17   -import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
18   -
19   -/**
20   - * Injector for LiteLoader's common events
21   - *
22   - * @author Adam Mummery-Smith
23   - */
24   -public abstract class LiteLoaderEventTransformer extends EventInjectionTransformer
25   -{
26   - protected abstract Obf getProxy();
27   -
28   - @Override
29   - protected void addEvents()
30   - {
31   - // Event declarations
32   - Event onInitializePlayerConnection = Event.getOrCreate("onInitializePlayerConnection", false);
33   - Event onPlayerLogin = Event.getOrCreate("onPlayerLogin", false);
34   - Event onPlayerLogout = Event.getOrCreate("onPlayerLogout", false);
35   - Event onSpawnPlayer = Event.getOrCreate("onSpawnPlayer", false);
36   - Event onRespawnPlayer = Event.getOrCreate("onRespawnPlayer", false);
37   - Event onServerTick = Event.getOrCreate("onServerTick", false);
38   - Event onBlockClickedEvent = Event.getOrCreate("onBlockClicked", true);
39   - Event onActivateBlockOrUseItem = Event.getOrCreate("onActivateBlockOrUseItem", true);
40   - Event onPlayerDigging = Event.getOrCreate("onPlayerDigging", true);
41   - Event onPlaceBlock = Event.getOrCreate("onPlaceBlock", true);
42   - Event onClickedAir = Event.getOrCreate("onClickedAir", true);
43   - Event onSessionProfileBad = Event.getOrCreate("onSessionProfileBad", true);
44   - Event onPlayerMoved = Event.getOrCreate("onPlayerMoved", true);
45   -
46   - // Injection Points
47   - InjectionPoint methodHead = new MethodHead();
48   - InjectionPoint methodReturn = new BeforeReturn();
49   - InjectionPoint beforeNewGameProfile = new BeforeNew(1, Obf.GameProfile);
50   - InjectionPoint beforeThreadMarshall = new BeforeInvoke(checkThreadAndEnqueue);
51   - InjectionPoint beforeGetPosY = new BeforeFieldAccess(Opcodes.GETFIELD, Obf.entityPosY, Obf.EntityPlayerMP, 4).setCaptureLocals(true);
52   -
53   - // Hooks
54   - this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection");
55   - this.add(onPlayerLogin, playerLoggedIn, (methodReturn), "onPlayerLogin");
56   - this.add(onPlayerLogout, playerLoggedOut, (methodReturn), "onPlayerLogout");
57   - this.add(onSpawnPlayer, spawnPlayer, (methodReturn), "onSpawnPlayer");
58   - this.add(onRespawnPlayer, respawnPlayer, (methodReturn), "onRespawnPlayer");
59   - this.add(onServerTick, serverJobs, (methodHead), "onServerTick");
60   - this.add(onBlockClickedEvent, onBlockClicked, (methodHead), "onBlockClicked");
61   - this.add(onActivateBlockOrUseItem, activateBlockOrUseItem, (methodHead), "onUseItem");
62   - this.add(onPlaceBlock, processBlockPlacement, after(beforeThreadMarshall) , "onPlaceBlock");
63   - this.add(onClickedAir, handleAnimation, after(beforeThreadMarshall), "onClickedAir");
64   - this.add(onPlayerDigging, processPlayerDigging, after(beforeThreadMarshall), "onPlayerDigging");
65   - this.add(onPlayerMoved, processPlayer, (beforeGetPosY), "onPlayerMoved");
66   -
67   - // Compatibility handlers
68   - this.add(onSessionProfileBad, getProfile, (beforeNewGameProfile), "generateOfflineUUID");
69   - }
70   -
71   - protected final Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback)
72   - {
73   - return this.add(event, targetMethod, injectionPoint, callback, this.getProxy());
74   - }
75   -
76   - protected Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback, Obf proxy)
77   - {
78   - return this.addEvent(event, targetMethod, injectionPoint).addListener(new MethodInfo(proxy, callback));
79   - }
80   -}
  1 +package com.mumfrey.liteloader.common.transformers;
  2 +
  3 +import static com.mumfrey.liteloader.core.runtime.Methods.*;
  4 +import static com.mumfrey.liteloader.transformers.event.InjectionPoint.*;
  5 +
  6 +import org.objectweb.asm.Opcodes;
  7 +
  8 +import com.mumfrey.liteloader.core.runtime.Obf;
  9 +import com.mumfrey.liteloader.transformers.event.Event;
  10 +import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
  11 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  12 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  13 +import com.mumfrey.liteloader.transformers.event.inject.BeforeFieldAccess;
  14 +import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
  15 +import com.mumfrey.liteloader.transformers.event.inject.BeforeNew;
  16 +import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
  17 +import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
  18 +
  19 +/**
  20 + * Injector for LiteLoader's common events
  21 + *
  22 + * @author Adam Mummery-Smith
  23 + */
  24 +public abstract class LiteLoaderEventTransformer extends EventInjectionTransformer
  25 +{
  26 + protected abstract Obf getProxy();
  27 +
  28 + @Override
  29 + protected void addEvents()
  30 + {
  31 + // Event declarations
  32 + Event onInitializePlayerConnection = Event.getOrCreate("onInitializePlayerConnection", false);
  33 + Event onPlayerLogin = Event.getOrCreate("onPlayerLogin", false);
  34 + Event onPlayerLogout = Event.getOrCreate("onPlayerLogout", false);
  35 + Event onSpawnPlayer = Event.getOrCreate("onSpawnPlayer", false);
  36 + Event onRespawnPlayer = Event.getOrCreate("onRespawnPlayer", false);
  37 + Event onServerTick = Event.getOrCreate("onServerTick", false);
  38 + Event onBlockClickedEvent = Event.getOrCreate("onBlockClicked", true);
  39 + Event onActivateBlockOrUseItem = Event.getOrCreate("onActivateBlockOrUseItem", true);
  40 + Event onPlayerDigging = Event.getOrCreate("onPlayerDigging", true);
  41 + Event onPlaceBlock = Event.getOrCreate("onPlaceBlock", true);
  42 + Event onClickedAir = Event.getOrCreate("onClickedAir", true);
  43 + Event onSessionProfileBad = Event.getOrCreate("onSessionProfileBad", true);
  44 + Event onPlayerMoved = Event.getOrCreate("onPlayerMoved", true);
  45 +
  46 + // Injection Points
  47 + InjectionPoint methodHead = new MethodHead();
  48 + InjectionPoint methodReturn = new BeforeReturn();
  49 + InjectionPoint beforeNewGameProfile = new BeforeNew(1, Obf.GameProfile);
  50 + InjectionPoint beforeThreadMarshall = new BeforeInvoke(checkThreadAndEnqueue);
  51 + InjectionPoint beforeGetPosY = new BeforeFieldAccess(Opcodes.GETFIELD, Obf.entityPosY, Obf.EntityPlayerMP, 4).setCaptureLocals(true);
  52 +
  53 + // Hooks
  54 + this.add(onInitializePlayerConnection, initPlayerConnection, (methodReturn), "onInitializePlayerConnection");
  55 + this.add(onPlayerLogin, playerLoggedIn, (methodReturn), "onPlayerLogin");
  56 + this.add(onPlayerLogout, playerLoggedOut, (methodReturn), "onPlayerLogout");
  57 + this.add(onSpawnPlayer, spawnPlayer, (methodReturn), "onSpawnPlayer");
  58 + this.add(onRespawnPlayer, respawnPlayer, (methodReturn), "onRespawnPlayer");
  59 + this.add(onServerTick, serverJobs, (methodHead), "onServerTick");
  60 + this.add(onBlockClickedEvent, onBlockClicked, (methodHead), "onBlockClicked");
  61 + this.add(onActivateBlockOrUseItem, activateBlockOrUseItem, (methodHead), "onUseItem");
  62 + this.add(onPlaceBlock, processBlockPlacement, after(beforeThreadMarshall) , "onPlaceBlock");
  63 + this.add(onClickedAir, handleAnimation, after(beforeThreadMarshall), "onClickedAir");
  64 + this.add(onPlayerDigging, processPlayerDigging, after(beforeThreadMarshall), "onPlayerDigging");
  65 + this.add(onPlayerMoved, processPlayer, (beforeGetPosY), "onPlayerMoved");
  66 +
  67 + // Compatibility handlers
  68 + this.add(onSessionProfileBad, getProfile, (beforeNewGameProfile), "generateOfflineUUID");
  69 + }
  70 +
  71 + protected final Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback)
  72 + {
  73 + return this.add(event, targetMethod, injectionPoint, callback, this.getProxy());
  74 + }
  75 +
  76 + protected Event add(Event event, MethodInfo targetMethod, InjectionPoint injectionPoint, String callback, Obf proxy)
  77 + {
  78 + return this.addEvent(event, targetMethod, injectionPoint).addListener(new MethodInfo(proxy, callback));
  79 + }
  80 +}
... ...
java/common/com/mumfrey/liteloader/common/transformers/LiteLoaderPacketTransformer.java renamed to src/main/java/com/mumfrey/liteloader/common/transformers/LiteLoaderPacketTransformer.java
1   -package com.mumfrey.liteloader.common.transformers;
2   -
3   -import com.mumfrey.liteloader.core.runtime.Obf;
4   -import com.mumfrey.liteloader.core.runtime.Packets;
5   -import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
6   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
7   -import com.mumfrey.liteloader.transformers.event.MethodInfo;
8   -import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
9   -
10   -public class LiteLoaderPacketTransformer extends EventInjectionTransformer
11   -{
12   - @Override
13   - protected void addEvents()
14   - {
15   - InjectionPoint methodHead = new MethodHead();
16   - MethodInfo handlePacket = new MethodInfo(Obf.PacketEvents, "handlePacket");
17   -
18   - for (Packets packet : Packets.packets)
19   - {
20   - MethodInfo processPacket = new MethodInfo(packet, Obf.processPacket, Void.TYPE, Obf.INetHandler);
21   - this.addEvent(new PacketEvent(packet), processPacket, methodHead).addListener(handlePacket);
22   - }
23   - }
24   -}
  1 +package com.mumfrey.liteloader.common.transformers;
  2 +
  3 +import com.mumfrey.liteloader.core.runtime.Obf;
  4 +import com.mumfrey.liteloader.core.runtime.Packets;
  5 +import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
  6 +import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  7 +import com.mumfrey.liteloader.transformers.event.MethodInfo;
  8 +import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
  9 +
  10 +public class LiteLoaderPacketTransformer extends EventInjectionTransformer
  11 +{
  12 + @Override
  13 + protected void addEvents()
  14 + {
  15 + InjectionPoint methodHead = new MethodHead();
  16 + MethodInfo handlePacket = new MethodInfo(Obf.PacketEvents, "handlePacket");
  17 +
  18 + for (Packets packet : Packets.packets)
  19 + {
  20 + MethodInfo processPacket = new MethodInfo(packet, Obf.processPacket, Void.TYPE, Obf.INetHandler);
  21 + this.addEvent(new PacketEvent(packet), processPacket, methodHead).addListener(handlePacket);
  22 + }
  23 + }
  24 +}
... ...
java/common/com/mumfrey/liteloader/common/transformers/PacketEvent.java renamed to src/main/java/com/mumfrey/liteloader/common/transformers/PacketEvent.java
1   -package com.mumfrey.liteloader.common.transformers;
2   -
3   -import org.objectweb.asm.Opcodes;
4   -import org.objectweb.asm.tree.InsnList;
5   -import org.objectweb.asm.tree.InsnNode;
6   -import org.objectweb.asm.tree.IntInsnNode;
7   -import org.objectweb.asm.tree.LdcInsnNode;
8   -import org.objectweb.asm.tree.MethodInsnNode;
9   -import org.objectweb.asm.tree.VarInsnNode;
10   -
11   -import com.mumfrey.liteloader.core.runtime.Obf;
12   -import com.mumfrey.liteloader.core.runtime.Packets;
13   -import com.mumfrey.liteloader.transformers.event.Event;
14   -import com.mumfrey.liteloader.transformers.event.EventInfo;
15   -
16   -/**
17   - * Special event used to hook all packets
18   - *
19   - * @author Adam Mummery-Smith
20   - */
21   -public class PacketEvent extends Event
22   -{
23   - /**
24   - * Soft index for this packet, used as a lookup for speed when determining handlers
25   - */
26   - private int packetIndex;
27   -
28   - PacketEvent(Packets packet)
29   - {
30   - super("on" + packet.getShortName(), true, 1000);
31   - this.packetIndex = packet.getIndex();
32   - this.verbose = false;
33   - }
34   -
35   - /* (non-Javadoc)
36   - * @see com.mumfrey.liteloader.transformers.event.Event#getEventInfoClassName()
37   - */
38   - @Override
39   - public String getEventInfoClassName()
40   - {
41   - return "com/mumfrey/liteloader/common/transformers/PacketEventInfo";
42   - }
43   -
44   - /* (non-Javadoc)
45   - * @see com.mumfrey.liteloader.transformers.event.Event#invokeEventInfoConstructor(org.objectweb.asm.tree.InsnList, boolean)
46   - */
47   - @Override
48   - protected int invokeEventInfoConstructor(InsnList insns, boolean cancellable, boolean pushReturnValue, int marshallVar)
49   - {
50   - int ctorMAXS = 0;
51   -
52   - insns.add(new LdcInsnNode(this.name)); ctorMAXS++;
53   - insns.add(this.methodIsStatic ? new InsnNode(Opcodes.ACONST_NULL) : new VarInsnNode(Opcodes.ALOAD, 0)); ctorMAXS++;
54   - insns.add(new InsnNode(cancellable ? Opcodes.ICONST_1 : Opcodes.ICONST_0)); ctorMAXS++;
55   - insns.add(new IntInsnNode(Opcodes.BIPUSH, this.packetIndex));
56   - insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, EventInfo.getConstructorDescriptor().replace(")", "I)"), false));
57   -
58   - return ctorMAXS;
59   - }
60   -}
  1 +package com.mumfrey.liteloader.common.transformers;
  2 +
  3 +import org.objectweb.asm.Opcodes;
  4 +import org.objectweb.asm.tree.InsnList;
  5 +import org.objectweb.asm.tree.InsnNode;
  6 +import org.objectweb.asm.tree.IntInsnNode;
  7 +import org.objectweb.asm.tree.LdcInsnNode;
  8 +import org.objectweb.asm.tree.MethodInsnNode;
  9 +import org.objectweb.asm.tree.VarInsnNode;
  10 +
  11 +import com.mumfrey.liteloader.core.runtime.Obf;
  12 +import com.mumfrey.liteloader.core.runtime.Packets;
  13 +import com.mumfrey.liteloader.transformers.event.Event;
  14 +import com.mumfrey.liteloader.transformers.event.EventInfo;
  15 +
  16 +/**
  17 + * Special event used to hook all packets
  18 + *
  19 + * @author Adam Mummery-Smith
  20 + */
  21 +public class PacketEvent extends Event
  22 +{
  23 + /**
  24 + * Soft index for this packet, used as a lookup for speed when determining handlers
  25 + */
  26 + private int packetIndex;
  27 +
  28 + PacketEvent(Packets packet)
  29 + {
  30 + super("on" + packet.getShortName(), true, 1000);
  31 + this.packetIndex = packet.getIndex();
  32 + this.verbose = false;
  33 + }
  34 +
  35 + /* (non-Javadoc)
  36 + * @see com.mumfrey.liteloader.transformers.event.Event#getEventInfoClassName()
  37 + */
  38 + @Override
  39 + public String getEventInfoClassName()
  40 + {
  41 + return "com/mumfrey/liteloader/common/transformers/PacketEventInfo";
  42 + }
  43 +
  44 + /* (non-Javadoc)
  45 + * @see com.mumfrey.liteloader.transformers.event.Event#invokeEventInfoConstructor(org.objectweb.asm.tree.InsnList, boolean)
  46 + */
  47 + @Override
  48 + protected int invokeEventInfoConstructor(InsnList insns, boolean cancellable, boolean pushReturnValue, int marshallVar)
  49 + {
  50 + int ctorMAXS = 0;
  51 +
  52 + insns.add(new LdcInsnNode(this.name)); ctorMAXS++;
  53 + insns.add(this.methodIsStatic ? new InsnNode(Opcodes.ACONST_NULL) : new VarInsnNode(Opcodes.ALOAD, 0)); ctorMAXS++;
  54 + insns.add(new InsnNode(cancellable ? Opcodes.ICONST_1 : Opcodes.ICONST_0)); ctorMAXS++;
  55 + insns.add(new IntInsnNode(Opcodes.BIPUSH, this.packetIndex));
  56 + insns.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, this.eventInfoClass, Obf.constructor.name, EventInfo.getConstructorDescriptor().replace(")", "I)"), false));
  57 +
  58 + return ctorMAXS;
  59 + }
  60 +}
... ...
java/common/com/mumfrey/liteloader/common/transformers/PacketEventInfo.java renamed to src/main/java/com/mumfrey/liteloader/common/transformers/PacketEventInfo.java
1   -package com.mumfrey.liteloader.common.transformers;
2   -
3   -import com.mumfrey.liteloader.transformers.event.EventInfo;
4   -
5   -import net.minecraft.network.Packet;
6   -
7   -public class PacketEventInfo<S extends Packet> extends EventInfo<S>
8   -{
9   - private final int packetId;
10   -
11   - @SuppressWarnings("unchecked")
12   - public PacketEventInfo(String name, Object source, boolean cancellable, int packetId)
13   - {
14   - super(name, (S)source, cancellable);
15   -
16   - this.packetId = packetId;
17   - }
18   -
19   - public int getPacketId()
20   - {
21   - return this.packetId;
22   - }
23   -}
  1 +package com.mumfrey.liteloader.common.transformers;
  2 +
  3 +import com.mumfrey.liteloader.transformers.event.EventInfo;
  4 +
  5 +import net.minecraft.network.Packet;
  6 +
  7 +public class PacketEventInfo<S extends Packet> extends EventInfo<S>
  8 +{
  9 + private final int packetId;
  10 +
  11 + @SuppressWarnings("unchecked")
  12 + public PacketEventInfo(String name, Object source, boolean cancellable, int packetId)
  13 + {
  14 + super(name, (S)source, cancellable);
  15 +
  16 + this.packetId = packetId;
  17 + }
  18 +
  19 + public int getPacketId()
  20 + {
  21 + return this.packetId;
  22 + }
  23 +}
... ...
java/common/com/mumfrey/liteloader/core/BadContainerInfo.java renamed to src/main/java/com/mumfrey/liteloader/core/BadContainerInfo.java
1   -package com.mumfrey.liteloader.core;
2   -
3   -import com.mumfrey.liteloader.core.api.LoadableModFile;
4   -import com.mumfrey.liteloader.interfaces.Loadable;
5   -
6   -/**
7   - * ModInfo for invalid containers
8   - *
9   - * @author Adam Mummery-Smith
10   - */
11   -public class BadContainerInfo extends NonMod
12   -{
13   - /**
14   - * Reason the container could not be loaded
15   - */
16   - private final String reason;
17   -
18   - public BadContainerInfo(Loadable<?> container, String reason)
19   - {
20   - super(container, false);
21   - this.reason = reason;
22   - }
23   -
24   - /* (non-Javadoc)
25   - * @see com.mumfrey.liteloader.core.ModInfo#isToggleable()
26   - */
27   - @Override
28   - public boolean isToggleable()
29   - {
30   - return false;
31   - }
32   -
33   - /* (non-Javadoc)
34   - * @see com.mumfrey.liteloader.core.ModInfo#isValid()
35   - */
36   - @Override
37   - public boolean isValid()
38   - {
39   - return false;
40   - }
41   -
42   - /* (non-Javadoc)
43   - * @see com.mumfrey.liteloader.core.ModInfo#getDescription()
44   - */
45   - @Override
46   - public String getDescription()
47   - {
48   - return "\247c" + this.reason;
49   - }
50   -
51   - /* (non-Javadoc)
52   - * @see com.mumfrey.liteloader.core.ModInfo#getVersion()
53   - */
54   - @Override
55   - public String getVersion()
56   - {
57   - if (this.container instanceof LoadableModFile)
58   - {
59   - return "supported: \247c" + ((LoadableModFile)this.container).getTargetVersion() + "\247r";
60   - }
61   -
62   - return "supported: \247cUnknown";
63   - }
64   -}
  1 +package com.mumfrey.liteloader.core;
  2 +
  3 +import com.mumfrey.liteloader.core.api.LoadableModFile;
  4 +import com.mumfrey.liteloader.interfaces.Loadable;
  5 +
  6 +/**
  7 + * ModInfo for invalid containers
  8 + *
  9 + * @author Adam Mummery-Smith
  10 + */
  11 +public class BadContainerInfo extends NonMod
  12 +{
  13 + /**
  14 + * Reason the container could not be loaded
  15 + */
  16 + private final String reason;
  17 +
  18 + public BadContainerInfo(Loadable<?> container, String reason)
  19 + {
  20 + super(container, false);
  21 + this.reason = reason;
  22 + }
  23 +
  24 + /* (non-Javadoc)
  25 + * @see com.mumfrey.liteloader.core.ModInfo#isToggleable()
  26 + */
  27 + @Override
  28 + public boolean isToggleable()
  29 + {
  30 + return false;
  31 + }
  32 +
  33 + /* (non-Javadoc)
  34 + * @see com.mumfrey.liteloader.core.ModInfo#isValid()
  35 + */
  36 + @Override
  37 + public boolean isValid()
  38 + {
  39 + return false;
  40 + }
  41 +
  42 + /* (non-Javadoc)
  43 + * @see com.mumfrey.liteloader.core.ModInfo#getDescription()
  44 + */
  45 + @Override
  46 + public String getDescription()
  47 + {
  48 + return "\247c" + this.reason;
  49 + }
  50 +
  51 + /* (non-Javadoc)
  52 + * @see com.mumfrey.liteloader.core.ModInfo#getVersion()
  53 + */
  54 + @Override
  55 + public String getVersion()
  56 + {
  57 + if (this.container instanceof LoadableModFile)
  58 + {
  59 + return "supported: \247c" + ((LoadableModFile)this.container).getTargetVersion() + "\247r";
  60 + }
  61 +
  62 + return "supported: \247cUnknown";
  63 + }
  64 +}
... ...