Skip to content

Commit

Permalink
Added anvil bulk rename
Browse files Browse the repository at this point in the history
and forge 1.20.2 support
  • Loading branch information
blackd committed Oct 22, 2023
1 parent 8a1ef80 commit b34b0f5
Show file tree
Hide file tree
Showing 105 changed files with 4,576 additions and 66 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.anti_ad.mc.ipnext.buildsrc.loom_version
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream

val versionObj = Version("1", "10", "7",
val versionObj = Version("1", "10", "8",
preRelease = (System.getenv("IPNEXT_RELEASE") == null))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,18 @@ fun Project.forgeCommonDependency(minecraft_version: Any,
kotlin_for_forge_version: Any,
libIPN_version: Any?) {


/* configurations.all {
resolutionStrategy {
force(fgdeobf("org.anti_ad.mc:libIPN-$libIPN_version"))
}
}*/


dependencies {

"api"(fgdeobf("org.anti_ad.mc:libIPN-$libIPN_version"))

val kffverstr = kotlin_for_forge_version.toString()[0]

if (kffverstr == '4' || kffverstr == '3') {
Expand Down
1 change: 1 addition & 0 deletions description/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
out
venv
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ org.gradle.vfs.watch=true
kapt.use.worker.api=true
#kapt.include.compile.classpath=true
org.gradle.parallel=true
#org.gradle.caching=false
org.gradle.caching=true
#org.gradle.warning.mode=all
#org.gradle.logging.level=info
org.gradle.logging.level=info
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Inventory Profiles Next
*
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.anti_ad.mc.common.vanilla.accessors.menu

import net.minecraft.client.gui.screen.ingame.AnvilScreen
import net.minecraft.screen.ForgingScreenHandler


@Suppress("UnusedReceiverParameter")
val ForgingScreenHandler.`(inputSlotIndices)`
get() = listOf(ForgingScreenHandler.FIRST_INPUT_SLOT_INDEX, ForgingScreenHandler.SECOND_INPUT_SLOT_INDEX)

val AnvilScreen.`(nameField)`
get() = this.nameField

var AnvilScreen.`(nameFieldText)`
get() = this.nameField.text
set(value) {
this.nameField.text = value
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ val versionSpecificContainerTypes = setOf(PlayerContainer::class.java
ContainerType.CREATIVE),

EnchantingTableContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to setOf(ContainerType.PURE_BACKPACK,
ContainerType.ANVIL),
BeaconContainer::class.java /**/ to nonStorage,
BlastFurnaceContainer::class.java /**/ to nonStorage,
CartographyTableContainer::class.java /**/ to nonStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ fun PlayerContainer.`(sendContentUpdates)`() = sendContentUpdates()

val StonecutterContainer.`(selectedRecipe)`: Int
get() = selectedRecipe

fun MinecraftClient.`(send)`(runnable: Runnable) = send(runnable)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Inventory Profiles Next
*
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.anti_ad.mc.ipnext.mixin;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.AnvilScreenHandler;
import org.anti_ad.mc.common.vanilla.Vanilla;
import org.anti_ad.mc.ipnext.event.AnvilHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(AnvilScreenHandler.class)
public class MixinAnvilScreenHandler {

@Inject(at = @At("HEAD"), method = "Lnet/minecraft/screen/AnvilScreenHandler;onTakeOutput(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V")
public void onTakeOutputPre(PlayerEntity player, ItemStack stack, CallbackInfo ci) {
if (Vanilla.INSTANCE.mc().isOnThread()) {
AnvilHandler.INSTANCE.onTakeOutPre((AnvilScreenHandler) ((Object)this));
}
}

@Inject(at = @At("TAIL"), method = "Lnet/minecraft/screen/AnvilScreenHandler;onTakeOutput(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V")
public void onTakeOutputPost(PlayerEntity player, ItemStack stack, CallbackInfo ci) {
if (Vanilla.INSTANCE.mc().isOnThread()) {
AnvilHandler.INSTANCE.onTakeOutPost((AnvilScreenHandler) ((Object)this));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen offers [L
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen indexStartOffset I
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen selectedIndex I
accessible method net/minecraft/client/gui/screen/ingame/MerchantScreen syncRecipeIndex ()V
accessible field net/minecraft/client/gui/screen/ingame/AnvilScreen nameField Lnet/minecraft/client/gui/widget/TextFieldWidget;
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"IMixinContainerScreen",
"IMixinKeyBinding",
"IMixinSlot",
"MixinAnvilScreenHandler",
"MixinClientPlayerEntity",
"MixinClientPlayNetworkHandler",
"MixinContainerScreen",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Inventory Profiles Next
*
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.anti_ad.mc.common.vanilla.accessors.menu

import net.minecraft.client.gui.screen.ingame.AnvilScreen
import net.minecraft.screen.ForgingScreenHandler


@Suppress("UnusedReceiverParameter")
val ForgingScreenHandler.`(inputSlotIndices)`
get() = listOf(ForgingScreenHandler.FIRST_INPUT_SLOT_INDEX, ForgingScreenHandler.SECOND_INPUT_SLOT_INDEX)

val AnvilScreen.`(nameField)`
get() = this.nameField

var AnvilScreen.`(nameFieldText)`
get() = this.nameField.text
set(value) {
this.nameField.text = value
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ val versionSpecificContainerTypes = setOf(PlayerContainer::class.java
ContainerType.CREATIVE),

EnchantingTableContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to setOf(ContainerType.PURE_BACKPACK,
ContainerType.ANVIL),
BeaconContainer::class.java /**/ to nonStorage,
BlastFurnaceContainer::class.java /**/ to nonStorage,
CartographyTableContainer::class.java /**/ to nonStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ inline fun PlayerContainer.`(onSlotClick)`(slotIndex: Int, button: Int, actionTy
@Suppress("FunctionName")
fun PlayerContainer.`(sendContentUpdates)`() = sendContentUpdates()


val StonecutterContainer.`(selectedRecipe)`: Int
get() = selectedRecipe

fun MinecraftClient.`(send)`(runnable: Runnable) = send(runnable)
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Inventory Profiles Next
*
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.anti_ad.mc.ipnext.mixin;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.AnvilScreenHandler;
import org.anti_ad.mc.common.vanilla.Vanilla;
import org.anti_ad.mc.ipnext.event.AnvilHandler;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(AnvilScreenHandler.class)
public class MixinAnvilScreenHandler {

@Inject(at = @At("HEAD"), method = "Lnet/minecraft/screen/AnvilScreenHandler;onTakeOutput(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V")
public void onTakeOutputPre(PlayerEntity player, ItemStack stack, CallbackInfo ci) {
if (Vanilla.INSTANCE.mc().isOnThread()) {
AnvilHandler.INSTANCE.onTakeOutPre((AnvilScreenHandler) ((Object)this));
}
}

@Inject(at = @At("TAIL"), method = "Lnet/minecraft/screen/AnvilScreenHandler;onTakeOutput(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/item/ItemStack;)V")
public void onTakeOutputPost(PlayerEntity player, ItemStack stack, CallbackInfo ci) {
if (Vanilla.INSTANCE.mc().isOnThread()) {
AnvilHandler.INSTANCE.onTakeOutPost((AnvilScreenHandler) ((Object)this));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen offers [L
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen indexStartOffset I
accessible field net/minecraft/client/gui/screen/ingame/MerchantScreen selectedIndex I
accessible method net/minecraft/client/gui/screen/ingame/MerchantScreen syncRecipeIndex ()V
accessible field net/minecraft/client/gui/screen/ingame/AnvilScreen nameField Lnet/minecraft/client/gui/widget/TextFieldWidget;
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"IMixinFluid",
"IMixinKeyBinding",
"IMixinSlot",
"MixinAnvilScreenHandler",
"MixinClientPlayerInteractionManager",
"MixinClientPlayNetworkHandler",
"MixinContainerScreen",
Expand Down
16 changes: 8 additions & 8 deletions platforms/fabric-1.20.2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ val supported_minecraft_versions = mapOf(MODRINTH to listOf("23w33a"),
CURSEFORGE to listOf("1.20.2-Snapshot"))
val mod_loader = "fabric"
val mod_version = project.version.toString()
val minecraft_version = "23w33a"
val minecraft_version = "1.20.2"
val minecraft_version_string = "1.20.2"
val mappings_version = "23w33a+build.2"
val mappings_version = "1.20.2+build.1"
val loader_version = "0.14.22"
val modmenu_version = "7.2.1"
val fabric_api_version = "0.87.1+1.20.2"
val modmenu_version = "8.0.0-beta.2"
val fabric_api_version = "0.89.2+1.20.2"
val mod_artefact_version = project.ext["mod_artefact_version"]
val libIPN_version = "${project.name}:${project.ext["libIPN_version"]}"
val carpet_core_version = "23w32a-1.4.114+v230809"
val carpet_core_version = "1.20.2-pre4-1.4.117+v230914"

buildscript {
dependencies {
Expand Down Expand Up @@ -110,9 +110,9 @@ dependencies {
//"modCompileOnly"("com.terraformersmc:modmenu:$modmenu_version")
//modRuntimeOnly("curse.maven:minihud-244260:4160116")
//modRuntimeOnly("curse.maven:malilib-303119:4147598")
modRuntimeOnly("curse.maven:athena-841890:4686261")
modRuntimeOnly("curse.maven:resourcefullib-570073:4681832")
modImplementation("curse.maven:chipped-456956:4634858")
//modRuntimeOnly("curse.maven:athena-841890:4686261")
//modRuntimeOnly("curse.maven:resourcefullib-570073:4681832")
modCompileOnly("curse.maven:chipped-456956:4634858")
}

tasks.named("compileKotlin") {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Inventory Profiles Next
*
* Copyright (c) 2023 Plamen K. Kosseff <p.kosseff@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.anti_ad.mc.common.vanilla.accessors.menu

import net.minecraft.client.gui.screen.ingame.AnvilScreen
import net.minecraft.screen.ForgingScreenHandler

val ForgingScreenHandler.`(inputSlotIndices)`
get() = this.inputSlotIndices

val AnvilScreen.`(nameField)`
get() = this.nameField

var AnvilScreen.`(nameFieldText)`
get() = this.nameField.text
set(value) {
this.nameField.text = value
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ val versionSpecificContainerTypes = setOf(PlayerContainer::class.java
ContainerType.CREATIVE),

EnchantingTableContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to nonStorage,
AnvilContainer::class.java /**/ to setOf(ContainerType.PURE_BACKPACK,
ContainerType.ANVIL),
BeaconContainer::class.java /**/ to nonStorage,
BlastFurnaceContainer::class.java /**/ to nonStorage,
CartographyTableContainer::class.java /**/ to nonStorage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ inline fun PlayerContainer.`(onSlotClick)`(slotIndex: Int, button: Int, actionTy
@Suppress("FunctionName")
fun PlayerContainer.`(sendContentUpdates)`() = sendContentUpdates()


val StonecutterContainer.`(selectedRecipe)`: Int
get() = selectedRecipe

fun MinecraftClient.`(send)`(runnable: Runnable) = send(runnable)
Loading

0 comments on commit b34b0f5

Please sign in to comment.