Build correctly for 1.21
This commit is contained in:
parent
737656c28d
commit
f3631bdedc
58
build.gradle
58
build.gradle
@ -1,38 +1,37 @@
|
|||||||
// https://github.com/FabricMC/fabric-example-mod/blob/9b028bdcd43190d4f848d5898b89177de6776535/build.gradle#L1
|
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '1.1-SNAPSHOT'
|
id 'fabric-loom' version '1.7-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_17
|
|
||||||
targetCompatibility = JavaVersion.VERSION_17
|
|
||||||
|
|
||||||
archivesBaseName = project.archives_base_name
|
|
||||||
version = project.mod_version
|
version = project.mod_version
|
||||||
group = project.maven_group
|
group = project.maven_group
|
||||||
|
|
||||||
|
base {
|
||||||
|
archivesName = project.archives_base_name
|
||||||
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// Add repositories to retrieve artifacts from in here.
|
// ...
|
||||||
// You should only use this when depending on other mods because
|
}
|
||||||
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
|
|
||||||
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
|
loom {
|
||||||
// for more information about repositories.
|
splitEnvironmentSourceSets()
|
||||||
|
|
||||||
|
mods {
|
||||||
|
"hotbarreplace" {
|
||||||
|
sourceSet sourceSets.main
|
||||||
|
// sourceSet sourceSets.client
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// To change the versions see the gradle.properties file
|
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||||
|
|
||||||
// Uncomment the following line to enable the deprecated Fabric API modules.
|
|
||||||
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
|
|
||||||
|
|
||||||
// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
@ -44,36 +43,31 @@ processResources {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile).configureEach {
|
tasks.withType(JavaCompile).configureEach {
|
||||||
// Minecraft 1.18 (1.18-pre2) upwards uses Java 17.
|
it.options.release = 21
|
||||||
it.options.release = 17
|
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
// 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()
|
withSourcesJar()
|
||||||
|
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_21
|
||||||
|
targetCompatibility = JavaVersion.VERSION_21
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
from("LICENSE") {
|
from("LICENSE") {
|
||||||
rename { "${it}_${project.archivesBaseName}"}
|
rename { "${it}_${project.base.archivesName.get()}"}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// configure the maven publication
|
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
create("mavenJava", MavenPublication) {
|
||||||
|
artifactId = project.archives_base_name
|
||||||
from components.java
|
from components.java
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
|
|
||||||
repositories {
|
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.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
# https://github.com/FabricMC/fabric-example-mod/blob/9b028bdcd43190d4f848d5898b89177de6776535/gradle.properties#L1
|
# Done to increase the memory available to Gradle
|
||||||
|
|
||||||
# Done to increase the memory available to gradle.
|
|
||||||
org.gradle.jvmargs=-Xmx1G
|
org.gradle.jvmargs=-Xmx1G
|
||||||
org.gradle.parallel=true
|
org.gradle.parallel=true
|
||||||
|
|
||||||
# Fabric Properties
|
# Fabric Properties
|
||||||
# check these on https://fabricmc.net/develop
|
minecraft_version=1.21
|
||||||
minecraft_version=1.20.4
|
yarn_mappings=1.21+build.9
|
||||||
yarn_mappings=1.20.4+build.3
|
loader_version=0.15.11
|
||||||
loader_version=0.15.6
|
|
||||||
|
|
||||||
# Mod Properties
|
# Mod Properties
|
||||||
mod_version = 0.1.2
|
mod_version = 0.1.2
|
||||||
maven_group = io.github.twokilohertz.hotbarreplace
|
maven_group = xyz.twokilohertz
|
||||||
archives_base_name = HotbarReplace
|
archives_base_name = HotbarReplace
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
fabric_version=0.95.1+1.20.4
|
fabric_version=0.100.7+1.21
|
||||||
|
@ -1,14 +1,3 @@
|
|||||||
/*
|
|
||||||
* This file was generated by the Gradle 'init' task.
|
|
||||||
*
|
|
||||||
* The settings file is used to specify which projects to include in your build.
|
|
||||||
*
|
|
||||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
|
||||||
* in the user manual at https://docs.gradle.org/8.0.2/userguide/multi_project_builds.html
|
|
||||||
*/
|
|
||||||
|
|
||||||
// https://github.com/FabricMC/fabric-example-mod/blob/9b028bdcd43190d4f848d5898b89177de6776535/settings.gradle#L1
|
|
||||||
|
|
||||||
pluginManagement {
|
pluginManagement {
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
maven {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package io.github.twokilohertz.hotbarreplace;
|
package xyz.twokilohertz;
|
||||||
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ClientModInitializer;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.PlayerInventory;
|
import net.minecraft.entity.player.PlayerInventory;
|
||||||
@ -15,13 +15,13 @@ import java.util.concurrent.Executors;
|
|||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class HotbarReplace implements ModInitializer {
|
public class HotbarReplace implements ClientModInitializer {
|
||||||
public static final Logger LOGGER = LoggerFactory.getLogger("hotbarreplace");
|
public static final Logger LOGGER = LoggerFactory.getLogger("hotbarreplace");
|
||||||
private static final MinecraftClient client = MinecraftClient.getInstance();
|
private static final MinecraftClient client = MinecraftClient.getInstance();
|
||||||
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
private static final ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onInitialize() {
|
public void onInitializeClient() {
|
||||||
LOGGER.info("HotbarReplace v0.1.2 initialised");
|
LOGGER.info("HotbarReplace v0.1.2 initialised");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ public class HotbarReplace implements ModInitializer {
|
|||||||
if (player.isSpectator())
|
if (player.isSpectator())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Creative inventories don't run out of anyway
|
// Creative inventories don't run out of blocks anyway
|
||||||
if (player.getAbilities().creativeMode)
|
if (player.getAbilities().creativeMode)
|
||||||
return;
|
return;
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package io.github.twokilohertz.hotbarreplace.mixin;
|
package xyz.twokilohertz.mixin;
|
||||||
|
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
@ -8,7 +8,7 @@ import org.spongepowered.asm.mixin.Mixin;
|
|||||||
import org.spongepowered.asm.mixin.injection.At;
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
import org.spongepowered.asm.mixin.injection.Inject;
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||||
import io.github.twokilohertz.hotbarreplace.HotbarReplace;
|
import xyz.twokilohertz.HotbarReplace;
|
||||||
|
|
||||||
@Mixin(BlockItem.class)
|
@Mixin(BlockItem.class)
|
||||||
public class BlockItemMixin {
|
public class BlockItemMixin {
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
@ -14,19 +14,22 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"icon": "assets/hotbarreplace/icon.png",
|
"icon": "assets/hotbarreplace/icon.png",
|
||||||
"environment": "*",
|
"environment": "client",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"main": [
|
"client": [
|
||||||
"io.github.twokilohertz.hotbarreplace.HotbarReplace"
|
"xyz.twokilohertz.HotbarReplace"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
"hotbarreplace.mixins.json"
|
{
|
||||||
|
"config": "hotbarreplace.mixins.json",
|
||||||
|
"environment": "client"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"depends": {
|
"depends": {
|
||||||
"fabricloader": ">=0.15.6",
|
"fabricloader": ">=0.15.11",
|
||||||
"fabric-api": "*",
|
"minecraft": "~1.21",
|
||||||
"minecraft": "~1.20",
|
"java": ">=21",
|
||||||
"java": ">=17"
|
"fabric-api": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,7 @@
|
|||||||
{
|
{
|
||||||
"required": true,
|
"required": true,
|
||||||
"minVersion": "0.8",
|
"package": "xyz.twokilohertz.mixin",
|
||||||
"package": "io.github.twokilohertz.hotbarreplace.mixin",
|
"compatibilityLevel": "JAVA_21",
|
||||||
"compatibilityLevel": "JAVA_17",
|
|
||||||
"mixins": [],
|
"mixins": [],
|
||||||
"client": [
|
"client": [
|
||||||
"BlockItemMixin"
|
"BlockItemMixin"
|
Loading…
x
Reference in New Issue
Block a user