Skip to content

Commit 38ab46a

Browse files
committed
update to 26.1.1
1 parent b151f5e commit 38ab46a

10 files changed

Lines changed: 56 additions & 54 deletions

File tree

build.gradle

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
plugins {
2-
id 'fabric-loom' version "${loom_version}"
2+
id 'net.fabricmc.fabric-loom' version "${loom_version}"
33
id 'maven-publish'
44
}
55

66
version = "${project.mod_version}+mc${project.supported_minecraft_version}"
77
group = project.maven_group
88

9+
base {
10+
archivesName = project.archives_base_name
11+
}
12+
913
repositories {
1014
// Add repositories to retrieve artifacts from in here.
1115
// You should only use this when depending on other mods because
@@ -16,17 +20,28 @@ repositories {
1620
maven { url 'https://maven.nucleoid.xyz' } // playerdataapi
1721
}
1822

23+
loom {
24+
splitEnvironmentSourceSets()
25+
26+
mods {
27+
"magnet-command" {
28+
sourceSet sourceSets.main
29+
// sourceSet sourceSets.client
30+
}
31+
}
32+
33+
}
34+
1935
dependencies {
2036
// To change the versions see the gradle.properties file
2137
minecraft "com.mojang:minecraft:${project.minecraft_version}"
22-
mappings loom.officialMojangMappings()
23-
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
38+
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
2439

2540
// Fabric API. This is technically optional, but you probably want it anyway.
26-
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
41+
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
2742

28-
include(modImplementation('me.lucko:fabric-permissions-api:0.6.1'))
29-
modImplementation include("eu.pb4:player-data-api:${project.player_data_api}")
43+
include(implementation('me.lucko:fabric-permissions-api:0.7.0'))
44+
implementation include("eu.pb4:player-data-api:${project.player_data_api}")
3045
}
3146

3247
processResources {
@@ -38,40 +53,29 @@ processResources {
3853
}
3954
}
4055

41-
def targetJavaVersion = 17
42-
tasks.withType(JavaCompile).configureEach {
43-
// ensure that the encoding is set to UTF-8, no matter what the system default is
44-
// this fixes some edge cases with special characters not displaying correctly
45-
// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html
46-
// If Javadoc is generated, this must be specified in that task too.
47-
it.options.encoding = "UTF-8"
48-
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
49-
it.options.release = targetJavaVersion
50-
}
51-
}
52-
5356
java {
54-
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
55-
if (JavaVersion.current() < javaVersion) {
56-
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
57-
}
58-
archivesBaseName = project.archives_base_name
5957
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
6058
// if it is present.
6159
// If you remove this line, sources will not be generated.
6260
withSourcesJar()
61+
62+
sourceCompatibility = JavaVersion.VERSION_25
63+
targetCompatibility = JavaVersion.VERSION_25
6364
}
6465

6566
jar {
67+
inputs.property "archivesName", project.base.archivesName
68+
6669
from("LICENSE") {
67-
rename { "${it}_${project.archivesBaseName}" }
70+
rename { "${it}_${inputs.properties.archivesName}"}
6871
}
6972
}
7073

7174
// configure the maven publication
7275
publishing {
7376
publications {
74-
mavenJava(MavenPublication) {
77+
create("mavenJava", MavenPublication) {
78+
artifactId = project.archives_base_name
7579
from components.java
7680
}
7781
}

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ org.gradle.jvmargs=-Xmx1G
33

44
# Fabric Properties
55
# check these on https://modmuss50.me/fabric.html
6-
minecraft_version=1.21.11
7-
loader_version=0.18.2
8-
loom_version=1.13-SNAPSHOT
6+
minecraft_version=26.1.1
7+
loader_version=0.18.6
8+
loom_version=1.15-SNAPSHOT
99

1010
# Mod Properties
1111
mod_version=0.3.0
1212
maven_group=dev.keesmand
1313
archives_base_name=magnet-command
14-
supported_minecraft_version=1.21.11
14+
supported_minecraft_version=26.1.1
1515

1616
# Dependencies
1717
# check this on https://modmuss50.me/fabric.html
18-
fabric_version=0.139.4+1.21.11
18+
fabric_api_version=0.145.3+26.1.1
1919
# check this on https://maven.nucleoid.xyz/eu/pb4/player-data-api/
20-
player_data_api=0.9.0+1.21.9
20+
player_data_api=0.10.0+26.1

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/java/dev/keesmand/magnetcommand/mixin/BlockMixin.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import dev.keesmand.magnetcommand.enums.DropMode;
66
import dev.keesmand.magnetcommand.enums.MagnetMode;
77
import dev.keesmand.magnetcommand.util.MagnetModeData;
8+
import net.minecraft.world.item.ItemInstance;
89
import net.minecraft.world.level.block.Block;
910
import net.minecraft.world.level.block.state.BlockState;
1011
import net.minecraft.world.level.block.entity.BlockEntity;
@@ -13,6 +14,7 @@
1314
import net.minecraft.server.level.ServerPlayer;
1415
import net.minecraft.server.level.ServerLevel;
1516
import net.minecraft.core.BlockPos;
17+
import org.jspecify.annotations.Nullable;
1618
import org.spongepowered.asm.mixin.Mixin;
1719
import org.spongepowered.asm.mixin.injection.At;
1820
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -27,19 +29,19 @@
2729
public class BlockMixin {
2830
@Redirect(
2931
method = "dropResources(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemStack;)V",
30-
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemStack;)Ljava/util/List;")
32+
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;getDrops(Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/server/level/ServerLevel;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/entity/BlockEntity;Lnet/minecraft/world/entity/Entity;Lnet/minecraft/world/item/ItemInstance;)Ljava/util/List;")
3133
)
32-
private static List<ItemStack> onDropStacks(BlockState state, ServerLevel world, BlockPos pos, BlockEntity blockEntity, Entity entity, ItemStack tool) {
33-
List<ItemStack> droppedStacks = getDrops(state, world, pos, blockEntity, entity, tool);
34+
private static List<ItemStack> onDropStacks(BlockState state, ServerLevel level, BlockPos pos, @Nullable BlockEntity blockEntity, @Nullable Entity breaker, ItemInstance tool) {
35+
List<ItemStack> droppedStacks = getDrops(state, level, pos, blockEntity, breaker, tool);
3436

3537
MagnetCommandConfig config = MagnetCommandMod.CONFIG;
3638
if (config == null) return droppedStacks;
3739

38-
if (entity instanceof ServerPlayer player) {
40+
if (breaker instanceof ServerPlayer player) {
3941
MagnetMode mode = MagnetModeData.getMagnetMode(player);
4042
if (mode != MagnetMode.OnBreak) return droppedStacks;
4143

42-
droppedStacks.forEach(dropStack -> InjectStack(world,
44+
droppedStacks.forEach(dropStack -> InjectStack(level,
4345
config.dropLocation == DropMode.Block ? pos : player.blockPosition(),
4446
player, dropStack));
4547

src/main/java/dev/keesmand/magnetcommand/mixin/ContainersMixin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
@Mixin(Containers.class)
2121
public class ContainersMixin {
2222
@Inject(method = "dropContents(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/Container;)V", at = @At("HEAD"), cancellable = true)
23-
private static void inject(Level world, BlockPos pos, Container inventory, CallbackInfo ci) {
23+
private static void inject(Level level, BlockPos pos, Container container, CallbackInfo ci) {
2424
MagnetCommandConfig config = MagnetCommandMod.CONFIG;
2525
if (config == null || !config.includeContainerItems) return;
2626

@@ -29,10 +29,10 @@ private static void inject(Level world, BlockPos pos, Container inventory, Callb
2929

3030
if (MagnetModeData.getMagnetMode(player) != MagnetMode.OnBreak) return;
3131

32-
for (int i = 0; i < inventory.getContainerSize(); ++i) {
33-
InjectStack(world,
32+
for (int i = 0; i < container.getContainerSize(); ++i) {
33+
InjectStack(level,
3434
config.dropLocation == DropMode.Block ? pos : player.blockPosition(),
35-
player, inventory.getItem(i));
35+
player, container.getItem(i));
3636
}
3737

3838
ci.cancel();

src/main/java/dev/keesmand/magnetcommand/mixin/PlayerListMixin.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
11
package dev.keesmand.magnetcommand.mixin;
22

3+
import com.llamalad7.mixinextras.sugar.Local;
34
import dev.keesmand.magnetcommand.enums.MagnetMode;
45
import dev.keesmand.magnetcommand.util.MagnetModeData;
56
import net.minecraft.world.entity.Entity;
67
import net.minecraft.server.players.PlayerList;
78
import net.minecraft.server.level.ServerPlayer;
8-
import net.minecraft.server.level.ServerLevel;
9-
import net.minecraft.world.level.portal.TeleportTransition;
109
import org.spongepowered.asm.mixin.Mixin;
1110
import org.spongepowered.asm.mixin.injection.At;
1211
import org.spongepowered.asm.mixin.injection.Inject;
1312
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
14-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
1513

1614
@Mixin(PlayerList.class)
1715
public class PlayerListMixin {
1816
@Inject(
1917
method = "respawn",
20-
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;restoreFrom(Lnet/minecraft/server/level/ServerPlayer;Z)V"),
21-
locals = LocalCapture.CAPTURE_FAILHARD)
22-
void handlePlayerRespawn(ServerPlayer oldPlayer, boolean alive, Entity.RemovalReason removalReason, CallbackInfoReturnable<ServerPlayer> cir, TeleportTransition teleportTarget, ServerLevel serverWorld, ServerPlayer newPlayer) {
18+
at = @At(value = "INVOKE", target = "Lnet/minecraft/server/level/ServerPlayer;restoreFrom(Lnet/minecraft/server/level/ServerPlayer;Z)V")
19+
)
20+
void handlePlayerRespawn(ServerPlayer oldPlayer, boolean alive, Entity.RemovalReason removalReason, CallbackInfoReturnable<ServerPlayer> cir, @Local(name = "player") ServerPlayer newPlayer) {
2321
MagnetMode mode = MagnetModeData.getMagnetMode(oldPlayer);
2422
MagnetModeData.setMagnetMode(newPlayer, mode);
2523
}

src/main/java/dev/keesmand/magnetcommand/mixin/ServerLevelMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
@Mixin(ServerLevel.class)
1313
public class ServerLevelMixin {
1414
@Inject(method = "tick", at = @At("HEAD"))
15-
void clearBreakingAuthors(BooleanSupplier shouldKeepTicking, CallbackInfo ci) {
15+
void clearBreakingAuthors(BooleanSupplier haveTime, CallbackInfo ci) {
1616
MagnetCommandMod.BLOCKS_BROKEN_BY.clear();
1717
}
1818
}

src/main/java/dev/keesmand/magnetcommand/mixin/ServerPlayerGameModeMixin.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import org.spongepowered.asm.mixin.injection.At;
1111
import org.spongepowered.asm.mixin.injection.Inject;
1212
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
13-
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
1413

1514
@Mixin(ServerPlayerGameMode.class)
1615
public class ServerPlayerGameModeMixin {
@@ -20,8 +19,8 @@ public class ServerPlayerGameModeMixin {
2019

2120
@Inject(
2221
method = "destroyBlock",
23-
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;playerWillDestroy(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/player/Player;)Lnet/minecraft/world/level/block/state/BlockState;"),
24-
locals = LocalCapture.CAPTURE_FAILHARD)
22+
at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/Block;playerWillDestroy(Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;Lnet/minecraft/world/entity/player/Player;)Lnet/minecraft/world/level/block/state/BlockState;")
23+
)
2524
void storeBreakingAuthor(BlockPos pos, CallbackInfoReturnable<Boolean> cir) {
2625
MagnetCommandMod.BLOCKS_BROKEN_BY.put(pos, player);
2726
}

src/main/java/dev/keesmand/magnetcommand/mixin/ServerPlayerMixin.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
@Mixin(ServerPlayer.class)
2525
public abstract class ServerPlayerMixin {
26-
@SuppressWarnings("UnreachableCode")
2726
@Inject(method = "tick", at = @At("HEAD"))
2827
private void magnetRangeMode(CallbackInfo callbackInfo) {
2928
// well this sure is a nice trick, thanks u/tom_the_geek

src/main/resources/fabric.mod.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
],
2222
"depends": {
2323
"fabricloader": ">=0.14.21",
24-
"fabric": "*",
25-
"minecraft": ">=1.21.11"
24+
"fabric-api": "*",
25+
"minecraft": ">=26.1"
2626
}
2727
}

0 commit comments

Comments
 (0)