generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add API to force modified speed logic on carts
Other mods can use AudakiCartEngine.registerModifiedEngineCheck to register a cart checker function. Return true to force modified speed logic, false to force vanilla speed logic.
- Loading branch information
1 parent
1f7056c
commit 54c13dd
Showing
3 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package audaki.cart_engine; | ||
|
||
import net.fabricmc.api.ModInitializer; | ||
import net.minecraft.entity.vehicle.AbstractMinecartEntity; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.function.Function; | ||
|
||
public class AudakiCartEngine implements ModInitializer { | ||
public static List<Function<AbstractMinecartEntity, Boolean>> CART_CHECK_MODIFIED_ENGINE = new ArrayList<>(); | ||
|
||
// Function should take one AbstractMinecartEntity. Return true to force | ||
// modified speed logic, false to force vanilla speed logic, and null | ||
// otherwise. | ||
public static void registerModifiedEngineCheck(Function<AbstractMinecartEntity, Boolean> cartChecker) { | ||
CART_CHECK_MODIFIED_ENGINE.add(cartChecker); | ||
} | ||
|
||
public void onInitialize() { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters