Skip to content

Commit

Permalink
Added JEI integration (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealYusufIsmail authored Sep 28, 2023
1 parent b0dc3b4 commit eea9eb0
Show file tree
Hide file tree
Showing 21 changed files with 580 additions and 53 deletions.
170 changes: 150 additions & 20 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,156 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project
# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,macos
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,gradle,forgegradle,macos

### ForgeGradle ###
# Minecraft client/server files
run/

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# AWS User-specific
.idea/**/aws.xml

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# idea
out
*.ipr
# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws
*.iml
.idea

# gradle
build
# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# SonarLint plugin
.idea/sonarlint/

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij+all Patch ###
# Ignore everything but code style settings and run configurations
# that are supposed to be shared within teams.

.idea/*

!.idea/codeStyles
!.idea/runConfigurations

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### macOS Patch ###
# iCloud generated files
*.icloud

### Gradle ###
.gradle
**/build/
!src/**/build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Avoid ignore Gradle wrappper properties
!gradle-wrapper.properties

# Cache of project
.gradletasknamecache

# Eclipse Gradle plugin generated files
# Eclipse Core
.project
# JDT-specific (Eclipse Java Development Tools)
.classpath

# other
eclipse
run
### Gradle Patch ###
# Java heap dump
*.hprof

# Files from Forge MDK
forge*changelog.txt
.DS_Store
# End of https://www.toptal.com/developers/gitignore/api/intellij+all,gradle,forgegradle,macos
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog

## [1.20.1-1.0.4] - UNRELEASED
All notable changes to this project will be documented in this file.

## [1.20.1-1.0.5] - 2023-09-26

### Added JEI integration for custom crafting tables.

## [1.20.1-1.0.4] - 2023-09-25

### Added Sapphire tools.
### Added rest of advancments for all the rest of the ores.
Expand Down
25 changes: 16 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ plugins {

project.group = "io.github.realyusufismail"

project.version = "1.20.1-1.0.4"
project.version = "1.20.1-1.0.5"

base.archivesName.set("armourandtoolsmod")

Expand Down Expand Up @@ -98,7 +98,7 @@ configure<UserDevExtension> {
}

create("data") {
workingDirectory(file("run"))
workingDirectory(file("run-data"))
// add mixin
property("mixin.env.remapRefMap", "true")
property(
Expand Down Expand Up @@ -134,20 +134,27 @@ sourceSets.main { resources.srcDir("src/generated/resources") }
repositories {
maven { url = uri("https://thedarkcolour.github.io/KotlinForForge/") }
maven { url = uri("https://maven.blamejared.com") }
maven { url = uri("https://dvs1.progwml6.com/files/maven/") }
maven { url = uri("https://modmaven.dev") }
mavenCentral()
}

dependencies {
minecraft("net.minecraftforge:forge:1.20.1-47.2.0")
minecraft("net.minecraftforge:forge:" + properties["forgeVersion"])
// kotlin forge
implementation("thedarkcolour:kotlinforforge:4.4.0")
implementation("thedarkcolour:kotlinforforge:" + properties["kotlinForForgeVersion"])
// Logger
implementation(group = "ch.qos.logback", name = "logback-classic", version = "1.4.11")
implementation(group = "ch.qos.logback", name = "logback-core", version = "1.4.11")
implementation("ch.qos.logback:logback-classic:" + properties["logbackVersion"])
implementation("ch.qos.logback:logback-core:" + properties["logbackVersion"])
// test
testImplementation("org.junit.jupiter:junit-jupiter:5.10.0")
testImplementation("org.junit.jupiter:junit-jupiter:" + properties["junitVersion"])
// core
implementation("io.github.realyusufismail:realyusufismailcore:1.20.1-1.0.1")
implementation("io.github.realyusufismail:realyusufismailcore:" + properties["coreVersion"])

// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
compileOnly(fg.deobf("mezz.jei:jei-${mcVersion}-common-api:" + properties["jeiVersion"]))
compileOnly(fg.deobf("mezz.jei:jei-${mcVersion}-forge-api:" + properties["jeiVersion"]))
runtimeOnly(fg.deobf("mezz.jei:jei-${mcVersion}-forge:" + properties["jeiVersion"]))
}

tasks.test {
Expand Down Expand Up @@ -226,7 +233,7 @@ tasks.jacocoTestReport {
}

detekt {
config = files("gradle/config/detekt.yml")
config.setFrom(files("gradle/config/detekt.yml"))
baseline = file("gradle/config/detekt-baseline.xml")
allRules = false
}
Expand Down
9 changes: 8 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
kotlin.code.style=official
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false
org.gradle.daemon=false

forgeVersion = 1.20.1-47.2.0
kotlinForForgeVersion = 4.4.0
logbackVersion = 1.4.11
junitVersion = 5.10.0
coreVersion = 1.20.1-1.0.1
jeiVersion = 15.2.0.27
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ import net.minecraft.world.phys.BlockHitResult
*/
class CustomArmourCraftingTable :
Block(Properties.of().strength(5.0f, 6.0f).sound(SoundType.METAL)) {
private val containerTitle: Component =
Component.translatable("container.custom_armour_crafting_table")
private val containerDescription: Component =
Component.translatable("container.custom_armour_crafting_table.description")

Expand Down Expand Up @@ -90,4 +88,9 @@ class CustomArmourCraftingTable :
) {
pTooltip.add(containerDescription)
}

companion object {
val containerTitle: Component =
Component.translatable("container.custom_armour_crafting_table")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package io.github.realyusufismail.armourandtoolsmod.blocks

import io.github.realyusufismail.armourandtoolsmod.blocks.CustomArmourCraftingTable.Companion.containerTitle
import io.github.realyusufismail.armourandtoolsmod.blocks.tool.CustomToolCraftingTableMenu
import net.minecraft.core.BlockPos
import net.minecraft.network.chat.Component
Expand All @@ -41,8 +42,6 @@ import net.minecraft.world.phys.BlockHitResult

class CustomToolCraftingTable :
Block(Properties.of().strength(5.0f, 6.0f).sound(SoundType.METAL).mapColor(MapColor.METAL)) {
private val containerTitle: Component =
Component.translatable("container.custom_tool_crafting_table")
private val containerDescription: Component =
Component.translatable("container.custom_tool_crafting_table.description")

Expand Down Expand Up @@ -86,4 +85,9 @@ class CustomToolCraftingTable :
) {
pTooltip.add(containerDescription)
}

companion object {
val containerTitle: Component =
Component.translatable("container.custom_tool_crafting_table")
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright 2023 RealYusufIsmail.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
*
* you may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.github.realyusufismail.armourandtoolsmod.core.init

import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod
import io.github.realyusufismail.armourandtoolsmod.recipe.armour.CustomArmourCraftingTableRecipe
import io.github.realyusufismail.armourandtoolsmod.recipe.tool.CustomToolCraftingTableRecipe
import mezz.jei.api.recipe.RecipeType

object JEIRecipeTypes {
val toolCrafting =
RecipeType.create(
ArmourAndToolsMod.MOD_ID,
"custom_tool_crafting_table",
CustomToolCraftingTableRecipe::class.java)

val armourCrafting =
RecipeType.create(
ArmourAndToolsMod.MOD_ID,
"custom_armour_crafting_table",
CustomArmourCraftingTableRecipe::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,17 @@ object MenuTypeInit {
featureFlagSet: FeatureFlagSet = FeatureFlags.REGISTRY.allFlags()
): ObjectHolderDelegate<MenuType<T>> {
return MENU.registerObject(name) { MenuType(pFactory, featureFlagSet) }
.setGuiTitle("container.$name")
}

private var menuGuiTitle: String? = null

private fun <V> ObjectHolderDelegate<V>.setGuiTitle(s: String): ObjectHolderDelegate<V> {
menuGuiTitle = s
return this
}

fun <V> ObjectHolderDelegate<V>.getMenuGuiTitle(): String {
return menuGuiTitle ?: throw IllegalStateException("Menu gui title not set")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ package io.github.realyusufismail.armourandtoolsmod.core.init
import com.google.common.base.Supplier
import com.google.common.base.Suppliers
import com.google.common.collect.ImmutableList
import io.github.realyusufismail.armourandtoolsmod.blocks.armour.CustomArmourCraftingTableRecipe
import io.github.realyusufismail.armourandtoolsmod.blocks.armour.book.CustomArmourCraftingBookCategory
import io.github.realyusufismail.armourandtoolsmod.blocks.tool.CustomToolCraftingTableRecipe
import io.github.realyusufismail.armourandtoolsmod.blocks.tool.book.CustomToolsCraftingBookCategory
import io.github.realyusufismail.armourandtoolsmod.recipe.armour.CustomArmourCraftingTableRecipe
import io.github.realyusufismail.armourandtoolsmod.recipe.tool.CustomToolCraftingTableRecipe
import net.minecraft.client.RecipeBookCategories
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package io.github.realyusufismail.armourandtoolsmod.core.init

import io.github.realyusufismail.armourandtoolsmod.ArmourAndToolsMod.ArmorAndToolsMod.MOD_ID
import io.github.realyusufismail.armourandtoolsmod.blocks.armour.CustomArmourCraftingTableShapedRecipe
import io.github.realyusufismail.armourandtoolsmod.blocks.tool.CustomToolCraftingTableShapedRecipe
import io.github.realyusufismail.armourandtoolsmod.recipe.armour.CustomArmourCraftingTableShapedRecipe
import io.github.realyusufismail.armourandtoolsmod.recipe.tool.CustomToolCraftingTableShapedRecipe
import net.minecraft.world.item.crafting.Recipe
import net.minecraft.world.item.crafting.RecipeSerializer
import net.minecraftforge.registries.DeferredRegister
Expand Down
Loading

0 comments on commit eea9eb0

Please sign in to comment.