diff --git a/build.gradle b/build.gradle index 2f8c32b..a350bfa 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.1.2' + id 'fabric-loom' version '1.6-SNAPSHOT' id 'maven-publish' } @@ -8,6 +8,19 @@ group = project.maven_group as String repositories { maven { url 'https://jitpack.io' } + mavenCentral() +} + +loom { + splitEnvironmentSourceSets() + + mods { + "modid" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } + } dependencies { @@ -19,33 +32,51 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" - include(implementation(annotationProcessor("com.github.llamalad7.mixinextras:mixinextras-fabric:0.2.0-beta.9"))) + include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:0.5.0"))) } processResources { - inputs.property "version", project.version - filteringCharset "UTF-8" + inputs.property "version", project.version + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} - filesMatching("fabric.mod.json") { - expand "version": project.version - } +tasks.withType(JavaCompile).configureEach { + it.options.release = 21 } -def targetJavaVersion = 17 java { - def javaVersion = JavaVersion.toVersion(targetJavaVersion) - if (JavaVersion.current() < javaVersion) { - toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion as String) - } - archivesBaseName = project.archives_base_name - // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task - // if it is present. - // If you remove this line, sources will not be generated. - withSourcesJar() + // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task + // if it is present. + // If you remove this line, sources will not be generated. + withSourcesJar() + + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 } jar { - from("LICENSE") { - rename { "${it}_${project.archivesBaseName}" } - } + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}"} + } +} + +// configure the maven publication +publishing { + publications { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name + from components.java + } + } + + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + repositories { + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. + } } diff --git a/gradle.properties b/gradle.properties index 5b6dc71..2ef46b7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,13 +2,16 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://modmuss50.me/fabric.html -minecraft_version=1.20.1 -yarn_mappings=1.20.1+build.9 -loader_version=0.14.21 +minecraft_version=1.21.1 +yarn_mappings=1.21.1+build.3 +loader_version=0.17.3 +loom_version=1.11-SNAPSHOT + +# Fabric API +fabric_version=0.116.7+1.21.1 # Mod Properties mod_version=1.0.2 maven_group=me.iru archives_base_name=bedoverhaul # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.86.0+1.20.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fc..81c736b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists +zipStorePath=wrapper/dists \ No newline at end of file diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/me/iru/bedoverhaul/mixin/BedBlockMixin.java b/src/main/java/me/iru/bedoverhaul/mixin/BedBlockMixin.java index 2bb98d5..6b4bbd6 100644 --- a/src/main/java/me/iru/bedoverhaul/mixin/BedBlockMixin.java +++ b/src/main/java/me/iru/bedoverhaul/mixin/BedBlockMixin.java @@ -33,19 +33,19 @@ protected BedBlockMixin(Settings settings) { } @Inject(method = "onUse", at = @At("HEAD"), cancellable = true) - public void bedoverhaul$applyBedUpgradeHandler(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit, CallbackInfoReturnable cir) { + public void bedoverhaul$applyBedUpgradeHandler(BlockState state, World world, BlockPos pos, PlayerEntity player, BlockHitResult hit, CallbackInfoReturnable cir) { ModifiedBedBlockEntity bed = (ModifiedBedBlockEntity) world.getBlockEntity(pos); if(bed != null) { - boolean shouldUpgradeCompass = player.getStackInHand(hand).isOf(Items.COMPASS) && !bed.bedOverhaul$getCanSetSpawnPoint(); - boolean shouldUpgradeClock = player.getStackInHand(hand).isOf(Items.CLOCK) && !bed.bedOverhaul$getCanResetTime(); + boolean shouldUpgradeCompass = player.getStackInHand(player.preferredHand).isOf(Items.COMPASS) && !bed.bedOverhaul$getCanSetSpawnPoint(); + boolean shouldUpgradeClock = player.getStackInHand(player.preferredHand).isOf(Items.CLOCK) && !bed.bedOverhaul$getCanResetTime(); boolean success = false; if(shouldUpgradeCompass) success = BedUpgradeHelper.upgradeFullBed(world, pos, BedUpgradeHelper.BedUpgrade.SpawnPointUpgrade); else if(shouldUpgradeClock) success = BedUpgradeHelper.upgradeFullBed(world, pos, BedUpgradeHelper.BedUpgrade.TimeResetUpgrade); if(success) { if(!player.getAbilities().creativeMode) { - player.getStackInHand(hand).decrement(1); + player.getStackInHand(player.preferredHand).decrement(1); } - player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, SoundCategory.BLOCKS, 1.0f, 1.0f); + player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP,1.0f,1.0f); for (int i = 0; i < 5; ++i) { double d = this.random.nextGaussian() * 0.02; double e = this.random.nextGaussian() * 0.02;