Skip to content

Commit

Permalink
[Fabric] Remove support for all versions below 1.21.4
Browse files Browse the repository at this point in the history
  • Loading branch information
NEZNAMY committed Mar 1, 2025
1 parent 16827bf commit dd6b964
Show file tree
Hide file tree
Showing 27 changed files with 182 additions and 2,030 deletions.
6 changes: 1 addition & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ val platforms = setOf(
projects.velocity,
projects.sponge7,
projects.sponge8,
projects.fabric,
projects.fabric.v1144,
projects.fabric.v1182,
projects.fabric.v1203,
projects.fabric.v1213
projects.fabric
).map { it.dependencyProject }

val special = setOf(
Expand Down
3 changes: 1 addition & 2 deletions fabric/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies {
modImplementation(fabricApi.module("fabric-lifecycle-events-v1", version))
modImplementation(fabricApi.module("fabric-networking-api-v1", version))
modImplementation(fabricApi.module("fabric-entity-events-v1", version))
modImplementation(fabricApi.module("fabric-command-api-v1", "0.77.0+1.18.2"))
modImplementation(fabricApi.module("fabric-command-api-v2", version))
}

Expand All @@ -35,6 +34,6 @@ tasks {
options.release.set(17)
}
validateAccessWidener {
enabled = false
enabled = true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public ServerBossEvent constructBossBar(@NotNull TabComponent title, float progr
BossBarColor.valueOf(color.name()),
BossBarOverlay.valueOf(style.name())
);
bar.setProgress(progress); // Somehow the compiled method name is same despite method being renamed in 1.17
bar.setProgress(progress);
return bar;
}

Expand All @@ -44,7 +44,7 @@ public void updateTitle(@NotNull BossBarInfo bar) {

@Override
public void updateProgress(@NotNull BossBarInfo bar) {
bar.getBossBar().setProgress(bar.getProgress()); // Somehow the compiled method name is same despite method being renamed in 1.17
bar.getBossBar().setProgress(bar.getProgress());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import me.neznamy.tab.shared.TAB;
import me.neznamy.tab.shared.platform.EventListener;
import me.neznamy.tab.shared.platform.TabPlayer;
import me.neznamy.tab.shared.util.ReflectionUtils;
import net.fabricmc.fabric.api.entity.event.v1.ServerEntityWorldChangeEvents;
import net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
Expand All @@ -22,17 +21,14 @@ public void register() {
ServerPlayConnectionEvents.DISCONNECT.register((connection, $) -> quit(connection.player.getUUID()));
ServerPlayConnectionEvents.JOIN.register((connection, $, $$) -> join(connection.player));
//TODO command preprocess
if (ReflectionUtils.classExists("net.fabricmc.fabric.api.entity.event.v1.ServerPlayerEvents")) {
// Added in 1.16
ServerPlayerEvents.AFTER_RESPAWN.register(
(oldPlayer, newPlayer, alive) -> {
replacePlayer(newPlayer.getUUID(), newPlayer);
// respawning from death & taking end portal in the end do not call world change event
worldChange(newPlayer.getUUID(), FabricMultiVersion.getLevelName(FabricMultiVersion.getLevel(newPlayer)));
});
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register(
(player, origin, destination) -> worldChange(player.getUUID(), FabricMultiVersion.getLevelName(destination)));
} // TODO else
ServerPlayerEvents.AFTER_RESPAWN.register(
(oldPlayer, newPlayer, alive) -> {
replacePlayer(newPlayer.getUUID(), newPlayer);
// respawning from death & taking end portal in the end does not call world change event
worldChange(newPlayer.getUUID(), FabricTAB.getLevelName(newPlayer.level()));
});
ServerEntityWorldChangeEvents.AFTER_PLAYER_CHANGE_WORLD.register(
(player, origin, destination) -> worldChange(player.getUUID(), FabricTAB.getLevelName(destination)));
}

@Override
Expand Down
Loading

0 comments on commit dd6b964

Please sign in to comment.