Skip to content

Commit

Permalink
Remove unnecessary args from @Inject methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaming32 committed Jun 3, 2024
1 parent be40e30 commit 415dca6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,12 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

//#if MC > 1.18.2
import net.minecraft.commands.CommandBuildContext;
//#endif

@Mixin(Commands.class)
public class MixinCommands {
@Shadow @Final private CommandDispatcher<CommandSourceStack> dispatcher;

@Inject(method = "<init>", at = @At("RETURN"))
private void commandRegistrationEvent(
Commands.CommandSelection commandSelection,
//#if MC > 1.18.2
CommandBuildContext commandBuildContext,
//#endif
CallbackInfo ci
) {
private void commandRegistrationEvent(CallbackInfo ci) {
WorldHost.commandRegistrationHandler(dispatcher);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class MixinGameRenderer {
shift = At.Shift.AFTER
)
)
private void toastRender(float partialTicks, long nanoTime, boolean renderLevel, CallbackInfo ci) {
private void toastRender(CallbackInfo ci) {
int mouseX = (int)(
this.minecraft.mouseHandler.xpos() * (double)this.minecraft.getWindow().getGuiScaledWidth() / (double)this.minecraft.getWindow().getScreenWidth()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
import net.minecraft.server.packs.repository.PackRepository;
import net.minecraft.util.HttpUtil;
import net.minecraft.world.level.GameType;
import net.minecraft.world.level.storage.LevelStorageSource;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
Expand All @@ -25,7 +24,6 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import java.net.Proxy;
import java.util.UUID;

//#if MC > 1.18.2
import net.minecraft.server.Services;
Expand Down Expand Up @@ -97,14 +95,14 @@ public MixinIntegratedServer(
@Shadow private int publishedPort;

@Inject(method = "publishServer", at = @At(value = "RETURN", ordinal = 0))
private void serverIsOpen(GameType gameMode, boolean cheats, int port, CallbackInfoReturnable<Boolean> cir) {
private void serverIsOpen(CallbackInfoReturnable<Boolean> cir) {
if (WorldHost.protoClient != null && WorldHost.CONFIG.isEnableFriends()) {
WorldHost.protoClient.publishedWorld(WorldHost.CONFIG.getFriends());
}
}

@Inject(method = "halt", at = @At("TAIL"))
private void serverIsClosed(boolean waitForServer, CallbackInfo ci) {
private void serverIsClosed(CallbackInfo ci) {
WorldHost.CONNECTED_PROXY_CLIENTS.values().forEach(ProxyClient::close);
WorldHost.CONNECTED_PROXY_CLIENTS.clear();
if (isPublished() && WorldHost.protoClient != null) {
Expand All @@ -113,7 +111,7 @@ private void serverIsClosed(boolean waitForServer, CallbackInfo ci) {
}

@Inject(method = "setUUID", at = @At("TAIL"))
private void shareWorldOnLoad(UUID uuid, CallbackInfo ci) {
private void shareWorldOnLoad(CallbackInfo ci) {
if (!WorldHost.shareWorldOnLoad) return;
WorldHost.shareWorldOnLoad = false;
//#if MC < 1.20.5
Expand Down Expand Up @@ -158,7 +156,7 @@ private void shareWorldOnLoad(UUID uuid, CallbackInfo ci) {
shift = At.Shift.AFTER
)
)
private void startProxyChannel(GameType gameMode, boolean cheats, int port, CallbackInfoReturnable<Boolean> cir) {
private void startProxyChannel(CallbackInfoReturnable<Boolean> cir) {
WorldHost.proxySocketAddress = ProxyChannels.startProxyChannel(getConnection());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private void postTick(CallbackInfo ci) {
//$$ shift = At.Shift.AFTER
//$$ )
//$$ )
//$$ private void toastRender(boolean renderLevel, CallbackInfo ci) {
//$$ private void toastRender(CallbackInfo ci) {
//$$ int i = (int)(
//$$ this.mouseHandler.xpos() * (double)this.getWindow().getGuiScaledWidth() / (double)this.getWindow().getScreenWidth()
//$$ );
Expand Down

0 comments on commit 415dca6

Please sign in to comment.