Skip to content

Commit

Permalink
v1.0.0+fabric-1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
eth0net authored Jul 24, 2022
2 parents 957f6b1 + 1e50fde commit 3da64b3
Show file tree
Hide file tree
Showing 27 changed files with 631 additions and 48 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
name: Build
on:
push:
branches-ignore: [main]
branches-ignore: [ main ]
tags:
# match semver tags, triggering modrinth releases
# could be more restrictive, but this is a good start
- v[0-9]+.[0-9]+.[0-9]+*
pull_request:
branches: [main]
branches: [ main ]
jobs:
build:
name: Build
strategy:
matrix:
java: [17, 18]
os: [ubuntu-latest]
java: [ 17, 18 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Codebase
Expand All @@ -37,3 +37,7 @@ jobs:
with:
name: libs
path: build/libs/
# Changelog
# GitHub Release
# Modrinth Release - set env from secrets
# Curseforge Release?
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: Lint
on:
push:
branches-ignore: [main]
branches-ignore: [ main ]
pull_request:
branches: [main]
branches: [ main ]
jobs:
lint:
name: Lint
strategy:
matrix:
java: [17, 18]
os: [ubuntu-latest]
java: [ 17, 18 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Codebase
Expand Down
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# Enchant Menu

WIP enchantment menu mod for Minecraft Fabric
Enchant Menu adds a simple menu for modifying item enchantments.

## Current Features
- Select enchantments from the list of possible enchantments
- Select the level of enchantment from 1 to 10
- Supports custom enchantments

## Planned Features
- Toggle to surpass vanilla level limits
- Toggle to allow incompatible enchantments
- Toggle to allow treasure-only enchantments
- Configuration of menu features

## Gallery

![Item with enchantments](./assets/screenshots/item-with-enchantment.png)
![Custom enchantments](./assets/screenshots/custom-enchantments.png)

## Credit

This mod is based on the enchanting tool included in NEI from the days of Tekkit Classic - Thanks to the original
creator for the inspiration!
Binary file added assets/menu.aseprite
Binary file not shown.
Binary file added assets/screenshots/custom-enchantments.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/screenshots/item-with-enchantment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 30 additions & 15 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val javaVersion = JavaVersion.VERSION_17
val minecraftVersion: String by project
val yarnMappings: String by project
val loaderVersion: String by project
val fabricVersion: String by project
val fabricKotlinVersion: String by project
val modVersion: String by project
val mavenGroup: String by project
val archivesBaseName: String by project
val modReleaseType: String by project
val modId: String by project
val modVersion: String by project
//val modVersionType: String by project

plugins {
id("fabric-loom")
val kotlinVersion: String by System.getProperties()
kotlin("jvm").version(kotlinVersion)
// id("com.modrinth.minotaur").version("2.+")
}

base {
archivesName.set(archivesBaseName)
}
base { archivesName.set(modId) }

version = modVersion
group = mavenGroup
version = modVersion

repositories {}

Expand All @@ -37,24 +38,38 @@ tasks {
options.encoding = "UTF-8"
sourceCompatibility = javaVersion.toString()
targetCompatibility = javaVersion.toString()
options.release.set(javaVersion.toString().toInt())
options.release.set(targetCompatibility.toInt())
}

withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions { jvmTarget = javaVersion.toString() }
}


withType<KotlinCompile> { kotlinOptions { jvmTarget = javaVersion.toString() } }

jar { from("LICENSE") { rename { "${it}_${base.archivesName}" } } }

processResources {
inputs.property("version", project.version)
filesMatching("fabric.mod.json") { expand(mutableMapOf("version" to project.version)) }
}

java {
toolchain { languageVersion.set(JavaLanguageVersion.of(javaVersion.toString())) }
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
withSourcesJar()
}

// modrinth {
// print("Uploading to Modrinth...")
// debugMode.set(true)
// projectId.set(base.archivesName)
// versionType.set(modVersionType)
// uploadFile.set(remapJar.get())
// additionalFiles.set(listOf(remapSourcesJar.get()))
// gameVersions.add(minecraftVersion)
// dependencies {
// required.project("fabric-api")
// required.project("fabric-language-kotlin")
// }
// syncBodyFrom.set(rootProject.file("README.md").toString())
// print("Done!")
// }
}
32 changes: 14 additions & 18 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
kotlin.code.style = official
org.gradle.jvmargs = -Xmx1G
org.gradle.warning.mode = all

kotlin.code.style=official
org.gradle.jvmargs=-Xmx1G
org.gradle.warning.mode=all
# Fabric Properties - https://fabricmc.net/develop/
minecraftVersion = 1.19
yarnMappings = 1.19+build.4
loaderVersion = 0.14.8

minecraftVersion=1.19
yarnMappings=1.19+build.4
loaderVersion=0.14.8
# Fabric API
fabricVersion = 0.57.0+1.19
loomVersion = 0.12-SNAPSHOT

fabricVersion=0.57.0+1.19
loomVersion=0.12-SNAPSHOT
# Kotlin
systemProp.kotlinVersion = 1.7.0
fabricKotlinVersion = 1.8.1+kotlin.1.7.0

systemProp.kotlinVersion=1.7.0
fabricKotlinVersion=1.8.1+kotlin.1.7.0
# Mod Properties
modVersion = 0.1.0-alpha+1.19
mavenGroup = com.github.eth0net
archivesBaseName = enchant-menu
modReleaseType = alpha
mavenGroup=com.github.eth0net
modId=enchant-menu
modVersion=1.0.0-beta+fabric-1.19
modVersionType=beta
Empty file modified gradlew
100644 → 100755
Empty file.
31 changes: 28 additions & 3 deletions src/main/kotlin/com/github/eth0net/enchantmenu/EnchantMenu.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
package com.github.eth0net.enchantmenu

import com.github.eth0net.enchantmenu.network.channel.DecrementChannel
import com.github.eth0net.enchantmenu.network.channel.IncrementChannel
import com.github.eth0net.enchantmenu.network.channel.MenuChannel
import com.github.eth0net.enchantmenu.screen.EnchantMenuScreenHandler
import com.github.eth0net.enchantmenu.screen.EnchantMenuScreenHandlerFactory
import com.github.eth0net.enchantmenu.util.Identifier
import com.github.eth0net.enchantmenu.util.Logger
import net.fabricmc.api.ModInitializer
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking
import net.minecraft.screen.ScreenHandlerType
import net.minecraft.util.registry.Registry

@Suppress("UNUSED")
object EnchantMenu: ModInitializer {
private const val MOD_ID = "enchant-menu"
object EnchantMenu : ModInitializer {
internal val SCREEN_HANDLER = Registry.register(
Registry.SCREEN_HANDLER, Identifier("enchant_menu"), ScreenHandlerType(::EnchantMenuScreenHandler)
)

override fun onInitialize() {
println("Enchant menu mod has been initialized.")
Logger.info("EnchantMenu initializing...")

ServerPlayNetworking.registerGlobalReceiver(MenuChannel) { _, player, _, _, _ ->
player.openHandledScreen(EnchantMenuScreenHandlerFactory)
}
ServerPlayNetworking.registerGlobalReceiver(IncrementChannel) { _, player, _, _, _ ->
(player.currentScreenHandler as? EnchantMenuScreenHandler)?.incrementLevel()
}
ServerPlayNetworking.registerGlobalReceiver(DecrementChannel) { _, player, _, _, _ ->
(player.currentScreenHandler as? EnchantMenuScreenHandler)?.decrementLevel()
}

Logger.info("EnchantMenu initialized.")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.eth0net.enchantmenu.client

import com.github.eth0net.enchantmenu.EnchantMenu
import com.github.eth0net.enchantmenu.client.gui.screen.EnchantMenuScreen
import com.github.eth0net.enchantmenu.client.keybinding.MenuKeyBinding
import com.github.eth0net.enchantmenu.network.channel.MenuChannel
import com.github.eth0net.enchantmenu.util.Logger
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs
import net.minecraft.client.gui.screen.ingame.HandledScreens

@Suppress("UNUSED")
object EnchantMenuClient : ClientModInitializer {
override fun onInitializeClient() {
Logger.info("EnchantMenuClient initializing...")

HandledScreens.register(EnchantMenu.SCREEN_HANDLER, ::EnchantMenuScreen)

ClientTickEvents.END_CLIENT_TICK.register {
while (MenuKeyBinding.wasPressed()) ClientPlayNetworking.send(MenuChannel, PacketByteBufs.empty())
}

Logger.info("EnchantMenuClient initialized.")
}
}
Loading

0 comments on commit 3da64b3

Please sign in to comment.