Skip to content

Commit

Permalink
Use Forge's clientSideOnly feature
Browse files Browse the repository at this point in the history
This feature sets an appropriate DisplayTest and ignores the mod on dedicated servers, handling the sided loading for you so that you don't need to worry about it.
  • Loading branch information
PaintNinja committed Mar 10, 2024
1 parent 80e37ea commit 48a9b6f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
12 changes: 0 additions & 12 deletions forge/src/main/java/com/blamejared/controlling/Controlling.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,12 @@

import com.blamejared.controlling.events.ClientEventHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.IExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;

@Mod("controlling")
public class Controlling {

public Controlling() {

ModLoadingContext.get()
.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (remote, isServer) -> true));
FMLJavaModLoadingContext.get().getModEventBus().addListener(this::init);
}

private void init(final FMLClientSetupEvent event) {

MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
}

Expand Down
1 change: 1 addition & 0 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ modLoader = "javafml"
loaderVersion = "${FORGE_LOADER}"
issueTrackerURL = "${GIT_REPO}/issues"
license = "MIT"
clientSideOnly = true
[[mods]]
modId = "${MODID}"
updateJSONURL = "https://updates.blamejared.com/get?n=${MODID}&gv=${MINECRAFT}&ml=forge"
Expand Down

0 comments on commit 48a9b6f

Please sign in to comment.