Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.14.4] [SOLVED] How to interate through the player inventory


kwpugh
 Share

Recommended Posts

Hi,

 

I'm looking for some guidance on how to effectively interate through the player inventory, test for a condition, and take an action.

 

The following code is something I am attempting to migrate from 1.12.2, but having little luck.

 

package com.kwpugh.gobber2.util;

import com.kwpugh.gobber2.Gobber2;
import com.kwpugh.gobber2.lists.ItemList;

import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler;

@EventBusSubscriber(modid = Gobber2.modid, bus = EventBusSubscriber.Bus.FORGE )
public class RepairTickHandler
{
	int DELAY;
	
	Item repairGring;
	int time;
	
	public RepairTickHandler(Item item, int delay)
	{
		repairGring = item;
		DELAY = delay;
		time = DELAY;
	}
	
	@SubscribeEvent(receiveCanceled = true, priority= EventPriority.HIGHEST)
	public void onPlayerTick(TickEvent.PlayerTickEvent event)
	{
		PlayerEntity player = (PlayerEntity) event.player;
		IItemHandler inv = (IItemHandler) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
		for (int i = 0; i < inv.getSlots(); i++)
		{
			ItemStack target = inv.getStackInSlot(i);

			if (target.getItem() == ItemList.gobber2_ring_repair)
			{
				time--;
				if (time <= 0)
				{
					time = DELAY;
					repair(player);
				}
			}
		}			
	}
	
	private void repair(PlayerEntity player)
	{
		IItemHandler inv = (IItemHandler) player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
		for (int i = 0; i < ((IItemHandler) inv).getSlots(); i++)
		{
			ItemStack target = inv.getStackInSlot(i);
			if (!target.isEmpty() && target.getItem().isRepairable(target))
			{
				if (!(player.isSwingInProgress && target == player.getItemStackFromSlot(EquipmentSlotType.MAINHAND)))
				{
					if (target.isDamaged())
					{
						target.setDamage(target.getDamage() - 1);
						return; 
					}
				}
			}
		}
	}
}

 

It is not working as expected and I am not sure why.   Any guidance would be helpful.

 

Regards,

 

Thank you.

 

Edited by kwpugh
Link to comment
Share on other sites

7 minutes ago, kwpugh said:

It is not working as expected and I am not sure why.   Any guidance would be helpful.

Define not working as expected have you tried outputting values to the console? Specifically to determine where the execution stops and the values of the variables to determine why it stopped.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

35 minutes ago, kwpugh said:

@EventBusSubscriber(modid = Gobber2.modid, bus = EventBusSubscriber.Bus.FORGE )

You are using the FORGE event bus instead of the MOD one.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, diesieben07 said:

That is correct in this case.

Oh I see now. But that kinda brings back an old issue we had pre 1.10(I think). Where you had to know which bus you needed to use.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Ok, I see.   I mis-read.   The doc explains BOTH static and non-static methods and indicates that "An event handler may also be static", I didn't understand that it is required.

 

I got it working, thank you.

 

 

Link to comment
Share on other sites

1 minute ago, kwpugh said:

Ok, you confused me.   You said the event handler methods must be static before.   

Option A:

 - The event class is registered statically, therefor the methods must be static

Option B:

 - The event class is registered as an instance, therefor the methods must not be static

 

Notice how the first part and the second part match?

Notice how both options are possible?

 

Event handlers are not required to be static, but you have to match.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Currently im trying to do this on forge 1.12.2.
    • What version of Minecraft are you using?
    • "D:\Program Files\scoop\apps\zulufx17-jdk\current\bin\java.exe" -Dfabric.dli.config=E:\Minecraft\draggable-resource-packs-fabric\forge\.gradle\loom-cache\launch.cfg -Dfabric.dli.env=client -p C:\Users\setti\.gradle\caches\modules-2\files-2.1\cpw.mods\securejarhandler\0.9.54\24b670f2c026ec9777e64a2c2126ebc8635dbe8d\securejarhandler-0.9.54.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-commons\9.1\8b971b182eb5cf100b9e8d4119152d83e00e0fdd\asm-commons-9.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-util\9.1\36464a45d871779f3383a8a9aba2b26562a86729\asm-util-9.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-analysis\9.1\4f61b83b81d8b659958f4bcc48907e93ecea55a0\asm-analysis-9.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm-tree\9.1\c333f2a855069cb8eb17a40a3eb8b1b67755d0eb\asm-tree-9.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm\9.1\a99500cf6eea30535eeac6be73899d048f8d12a8\asm-9.1.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Dfabric.dli.main=cpw.mods.bootstraplauncher.BootstrapLauncher -Darchitectury.main.class=E:\Minecraft\draggable-resource-packs-fabric\forge\.gradle\architectury\.main_class -Darchitectury.runtime.transformer=E:\Minecraft\draggable-resource-packs-fabric\forge\.gradle\architectury\.transforms -Darchitectury.properties=E:\Minecraft\draggable-resource-packs-fabric\forge\.gradle\architectury\.properties -Djdk.attach.allowAttachSelf=true -javaagent:E:\Minecraft\draggable-resource-packs-fabric\.gradle\architectury\architectury-transformer-agent.jar -javaagent:H:\Jetbrains\apps\IDEA-U\ch-0\213.5744.223\lib\idea_rt.jar=64988:H:\Jetbrains\apps\IDEA-U\ch-0\213.5744.223\bin -Dfile.encoding=UTF-8 -classpath E:\Minecraft\draggable-resource-packs-fabric\forge\build\classes\java\main;E:\Minecraft\draggable-resource-packs-fabric\forge\build\resources\main;C:\Users\setti\.gradle\caches\fabric-loom\1.18.1\forge\1.18.1-39.0.40\forge-client-extra.jar;E:\Minecraft\draggable-resource-packs-fabric\common\build\classes\java\main;E:\Minecraft\draggable-resource-packs-fabric\common\build\resources\main;C:\Users\setti\.gradle\caches\transforms-3\c25bcf69183a93641dc485650b44e1ff\transformed\fmlloader-1.18.1-39.0.40.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\b8c21507f372a8ed47aebc3c05b3e097\transformed\guava-31.0.1-jre.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.2\25ea2e8b0c338a877313bd4672d3fe056ea78f0d\jsr305-3.0.2.jar;C:\Users\setti\.gradle\caches\transforms-3\ee51a27084acbbf3223dea34974f682a\transformed\nashorn-core-15.3.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\a297408a9a9b8c4c50550417c93b0a74\transformed\modlauncher-9.0.24.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\4898ca03f9637f9276c2c3b526572cc9\transformed\asm-commons-9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\4d16908523e1f2bd5d226961920b57ce\transformed\asm-util-9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\33cbc336093ff105bb5ef326b3f9cb0c\transformed\asm-analysis-9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\83ead7d0bd0ea5e880ebcc005ab909c3\transformed\asm-tree-9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\d8b160dd9abd9f791f4bb05b03f72bcb\transformed\asm-9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\c0459ec7ae3df3cd50eb22a3835e496c\transformed\accesstransformers-8.0.4.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\1cc04d418abdbdd5a59f300e57002928\transformed\antlr4-runtime-4.9.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\752f3a7b7a9c1977c7671570684efa20\transformed\fmlcore-1.18.1-39.0.40.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\eafb9b2e14cb52e5925c80c3e13f28d1\transformed\eventbus-5.0.7.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\57e97ddf49e919fcaf1acb325d62b4bc\transformed\forgespi-4.0.11.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\ac88a788d0fae9b69fc3cd967d5ba0cd\transformed\coremods-5.0.2.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\9c158f065b3150316632fa20337190ef\transformed\unsafe-0.2.0.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\a7ab015a4a988daada728e528528c5aa\transformed\toml-3.6.4.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\e9efde238cb6741eafdb4703d6159e77\transformed\core-3.6.4.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\4091d15bb14378b500b62e3692cdc75f\transformed\maven-artifact-3.8.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\7790c3d2432b418449d08f641370a854\transformed\commons-lang3-3.12.0.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\98040f52814ca18f4de2ae42052e1072\transformed\typetools-0.8.3.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\ea789475a089abaebc692704b6a9dc7c\transformed\terminalconsoleappender-1.2.0.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\4d889324821d9cc7a7b1f84c5810ebd1\transformed\log4j-slf4j18-impl-2.15.0.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\e1af07eb5a22271ec214919c6712bbb0\transformed\jline-reader-3.12.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\cc2c0ce632b4ba0b35de1aa3177b4973\transformed\jline-terminal-3.12.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\fc2a7a14e25dcd1a109da8c103f9df2a\transformed\jopt-simple-5.0.4.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\d12fd980a746aa0d5674f6cc5b0e5690\transformed\mixin-patched-0.8.5.5.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\36eef3bfbf91fb6a95df6408203df4ea\transformed\gson-2.8.8.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\f63f61f3522348a1528d7ccbe986c620\transformed\bootstraplauncher-0.1.17.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\35a29354667e2b9bc46718556977fede\transformed\javafmllanguage-1.18.1-39.0.40.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\42e7f1bfa9c12b751868a132244e694c\transformed\mclanguage-1.18.1-39.0.40.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\dev.architectury\architectury-loom-runtime\1.1.3\5ca1d9609c1bdd10a3162a9e2d211a95ca79740e\architectury-loom-runtime-1.1.3.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\blocklist\1.0.6\7039c2c6209064ee4132cea7a0737b63b92c725e\blocklist-1.0.6.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\patchy\2.1.6\ce112c16c6275fdfff2d30208533ec906a191f71\patchy-2.1.6.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.github.oshi\oshi-core\5.8.2\3a4c610d5991654009653e55b3204065441e2f0d\oshi-core-5.8.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\net.java.dev.jna\jna\5.9.0\8f503e6d9b500ceff299052d6be75b38c7257758\jna-5.9.0.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\net.java.dev.jna\jna-platform\5.9.0\c535a5bda553d7d7690356c825010da74b2671b5\jna-platform-5.9.0.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.8.0-beta4\83b0359d847ee053d745be7ec0d8e9e8a44304b4\slf4j-api-1.8.0-beta4.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.ibm.icu\icu4j\69.1\ff666ac55986650893aacb9e2e0003538e9799c0\icu4j-69.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\javabridge\1.2.24\c876796229b2ef5120f186eab5acc870699d3b9\javabridge-1.2.24.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\io.netty\netty-all\4.1.68.Final\b8266a3c93c1c051109f71d3449e5dcd5d60b333\netty-all-4.1.68.Final.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.google.guava\failureaccess\1.0.1\1dcf1de382a0bf95a3d8b0849546c88bac1292c9\failureaccess-1.0.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\commons-io\commons-io\2.11.0\a2503f302b11ebde7ebc3df41daebe0e4eea3689\commons-io-2.11.0.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\commons-codec\commons-codec\1.15\49d94806b6e3dc933dacbd8acb0fdbab8ebd1e5d\commons-codec-1.15.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\brigadier\1.0.18\c1ef1234282716483c92183f49bef47b1a89bfa9\brigadier-1.0.18.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\datafixerupper\4.0.26\ebd6690f33871ccee9b6132c6480668ee2e35020\datafixerupper-4.0.26.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\authlib\3.2.38\7bba19e34be22fded9ceb409ca1e8fb7525daf55\authlib-3.2.38.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-compress\1.21\4ec95b60d4e86b5c95a0e919cb172a0af98011ef\commons-compress-1.21.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpclient\4.5.13\e5f6cae5ca7ecaac1ec2827a9e2d65ae2869cada\httpclient-4.5.13.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\commons-logging\commons-logging\1.2\4bfc12adfe4842bf07b657f0369c4cb522955686\commons-logging-1.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.apache.httpcomponents\httpcore\4.4.14\9dd1a631c082d92ecd4bd8fd4cf55026c720a8c1\httpcore-4.4.14.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\it.unimi.dsi\fastutil\8.5.6\76f95700418a68fbc4ac050525261f05dc681ca1\fastutil-8.5.6.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl\3.2.2\8ad6294407e15780b43e84929c40e4c5e997972e\lwjgl-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-jemalloc\3.2.2\ee8e57a79300f78294576d87c4a587f8c99402e2\lwjgl-jemalloc-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-openal\3.2.2\2b772a102b0a11ee5f2109a5b136f4dc7c630827\lwjgl-openal-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-opengl\3.2.2\6ac5bb88b44c43ea195a570aab059f63da004cd8\lwjgl-opengl-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-glfw\3.2.2\d3ad4df38e400b8afba1de63f84338809399df5b\lwjgl-glfw-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-stb\3.2.2\3b8e6ebc5851dd3d17e37e5cadce2eff2a429f0f\lwjgl-stb-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.lwjgl\lwjgl-tinyfd\3.2.2\fcbe606c8f8da6f8f9a05e2c540eb1ee8632b0e9\lwjgl-tinyfd-3.2.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.mojang\text2speech\1.11.3\f378f889797edd7df8d32272c06ca80a1b6b0f58\text2speech-1.11.3.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\ca.weblite\java-objc-bridge\1.0.0\6ef160c3133a78de015830860197602ca1c855d3\java-objc-bridge-1.0.0.jar;E:\Minecraft\draggable-resource-packs-fabric\.gradle\loom-cache\1.18.1\net.fabricmc.yarn.1_18_1.1.18.1+build.18-v2-forge-1.18.1-39.0.40\forge-1.18.1-39.0.40-minecraft-project-@forge-mapped.jar;E:\Minecraft\draggable-resource-packs-fabric\.gradle\loom-cache\remapped_mods\net_fabricmc_yarn_1_18_1_1_18_1_build_18_v2_forge_1_18_1_39_0_40_forge\dev\architectury\B67d3a12c5141\B67d3a12c5141\B67d3a12c5141-B67d3a12c5141.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.google.guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\b421526c5f297295adef1c886e5246c39d4ac629\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.checkerframework\checker-qual\3.12.0\d5692f0526415fcc6de94bb5bfbd3afd9dd3b3e5\checker-qual-3.12.0.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.google.errorprone\error_prone_annotations\2.7.1\458d9042f7aa6fa9a634df902b37f544e15aacac\error_prone_annotations-2.7.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\com.google.j2objc\j2objc-annotations\1.3\ba035118bc8bac37d7eff77700720999acd9986d\j2objc-annotations-1.3.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.antlr\antlr4\4.9.1\e92af8ab33e428461927b484e90bb155a4f3a052\antlr4-4.9.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.codehaus.plexus\plexus-utils\3.2.1\13b015768e0d04849d2794e4c47eb02d01a0de32\plexus-utils-3.2.1.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.antlr\ST4\4.3\92f2c1ad8d84abcbeead6cf7f2c53a04166293c2\ST4-4.3.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.antlr\antlr-runtime\3.5.2\cd9cd41361c155f3af0f653009dcecb08d8b4afd\antlr-runtime-3.5.2.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.abego.treelayout\org.abego.treelayout.core\1.0.3\457216e8e6578099ae63667bb1e4439235892028\org.abego.treelayout.core-1.0.3.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\org.glassfish\javax.json\1.0.4\3178f73569fd7a1e5ffc464e680f7a8cc784b85a\javax.json-1.0.4.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\dev.architectury\architectury-transformer\5.2.61\79c890fb9119b6913a60ebd0f6be11cd18e8b114\architectury-transformer-5.2.61-agent.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\dev.architectury\architectury-transformer\5.2.61\ebd9a466e5a887e8eae92203dbc5df57f7052e1\architectury-transformer-5.2.61-runtime.jar;C:\Users\setti\.gradle\caches\transforms-3\3035134a09d037c8593bcd22a86f8e6c\transformed\securejarhandler-0.9.61.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\335d78c0155c2e56521d92921343fa58\transformed\log4j-core-2.17.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\transforms-3\898f5bee38672c0073b247561b766e40\transformed\log4j-api-2.17.1.jar-alfd-transformed.jar;C:\Users\setti\.gradle\caches\modules-2\files-2.1\net.fabricmc\dev-launch-injector\0.2.1+build.8\da8bef7e6e2f952da707f282bdb46882a0fce5e3\dev-launch-injector-0.2.1+build.8.jar;C:\Users\setti\.gradle\caches\fabric-loom\1.18.1\net.fabricmc.yarn.1_18_1.1.18.1+build.18-v2-forge-1.18.1-39.0.40\mappings.jar dev.architectury.transformer.TransformerRuntime [Architectury Transformer] Architectury Runtime 5.2.61 [Architectury Transformer] Read classpath in 31.26 s [Architectury Transformer] Listening at E:\Minecraft\draggable-resource-packs-fabric\common\build\libs\DraggableResourcePacks-2.0.0-dev.jar [19:04:19] [main/INFO] (Launcher) ModLauncher running: args [--launchTarget, forgeclientuserdev, --version, MOD_DEV, --assetIndex, 1.18.1-1.18, --assetsDir, C:\Users\setti\.gradle\caches\fabric-loom\assets, --gameDir, ., --fml.forgeVersion, 39.0.40, --fml.mcVersion, 1.18.1, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20211210.034407, -mixin.config, DraggableResourcePacks.mixins.json, --mixin.config, /DraggableResourcePacks.mixins.json] [19:04:19] [main/INFO] (Launcher) ModLauncher 9.0.24+9.0.24+main.7be9f01d starting: java version 17.0.1 by Azul Systems, Inc. [19:04:20] [main/INFO] (mixin) SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/C:/Users/setti/.gradle/caches/transforms-3/d12fd980a746aa0d5674f6cc5b0e5690/transformed/mixin-patched-0.8.5.5.jar-alfd-transformed.jar%2322! Service=ModLauncher Env=CLIENT [19:04:21] [main/INFO] (ModDiscoverer) Found mod file javafmllanguage-1.18.1-39.0.40.jar-alfd-transformed.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file mclanguage-1.18.1-39.0.40.jar-alfd-transformed.jar of type LANGPROVIDER with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file fmlcore-1.18.1-39.0.40.jar-alfd-transformed.jar of type LIBRARY with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file forge-1.18.1-39.0.40-minecraft-project-@forge-mapped.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file main of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.MinecraftLocator@253a8bdb [19:04:21] [main/INFO] (ModDiscoverer) Found mod file B67d3a12c5141-B67d3a12c5141.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.ClasspathLocator@1bb21ec1 [19:04:21] [main/INFO] (ModDiscoverer) Found mod file 2992262530976056687.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.ClasspathLocator@1bb21ec1 [19:04:21] [main/INFO] (ModDiscoverer) Found mod file B67d3a12c5141-B67d3a12c5141.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.ClasspathLocator@1bb21ec1 [19:04:21] [main/INFO] (ModDiscoverer) Found mod file 2992262530976056687.jar of type MOD with locator net.minecraftforge.fml.loading.moddiscovery.ClasspathLocator@1bb21ec1 2022-01-22 19:04:21,812 main WARN Error parsing URI E:\Minecraft\draggable-resource-packs-fabric\forge\.gradle\loom-cache\log4j.xml Exception in thread "main" java.lang.IllegalArgumentException: draggable-resource-packs: Invalid module name: 'draggable-resource-packs' is not a Java identifier at java.base/jdk.internal.module.Checks.requireModuleName(Checks.java:59) at java.base/java.lang.module.ModuleDescriptor$Builder.<init>(ModuleDescriptor.java:1515) at java.base/java.lang.module.ModuleDescriptor.newAutomaticModule(ModuleDescriptor.java:2395) at MC-BOOTSTRAP/fmlloaderjar.alfd.transformed@1.18.1-39.0.40.jar-alfd-transformed/net.minecraftforge.fml.loading.moddiscovery.ModJarMetadata.descriptor(ModJarMetadata.java:66) at cpw.mods.securejarhandler@0.9.54/cpw.mods.jarhandling.impl.Jar.computeDescriptor(Jar.java:47) at cpw.mods.securejarhandler@0.9.54/cpw.mods.cl.JarModuleFinder$JarModuleReference.<init>(JarModuleFinder.java:50) at cpw.mods.securejarhandler@0.9.54/cpw.mods.cl.JarModuleFinder.lambda$new$0(JarModuleFinder.java:28) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197) at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682) at cpw.mods.securejarhandler@0.9.54/cpw.mods.cl.JarModuleFinder.<init>(JarModuleFinder.java:29) at cpw.mods.securejarhandler@0.9.54/cpw.mods.cl.JarModuleFinder.of(JarModuleFinder.java:43) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.ModuleLayerHandler.buildLayer(ModuleLayerHandler.java:70) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.TransformationServicesHandler.buildTransformingClassLoader(TransformationServicesHandler.java:60) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.Launcher.run(Launcher.java:104) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.Launcher.main(Launcher.java:77) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26) at MC-BOOTSTRAP/cpw.mods.modlauncher@9.0.24/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23) at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:90) at net.fabricmc.devlaunchinjector.Main.main(Main.java:86) at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:217) It's seems like there is something wrong in log4j2.xml. But the project can run with fabric with the same log4j2.xml. <?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN" packages="com.mojang.util,net.minecrell.terminalconsole.util"> <Appenders> <!-- System out --> <Console name="SysOut" target="SYSTEM_OUT"> <PatternLayout> <LoggerNamePatternSelector defaultPattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(%logger{1})}{cyan} %highlight{%msg%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}" disableAnsi="${sys:fabric.log.disableAnsi:-true}"> <!-- Dont show the logger name for minecraft classes--> <PatternMatch key="net.minecraft.,com.mojang." pattern="%style{[%d{HH:mm:ss}]}{blue} %highlight{[%t/%level]}{FATAL=red, ERROR=red, WARN=yellow, INFO=green, DEBUG=green, TRACE=blue} %style{(Minecraft)}{cyan} %highlight{%msg{nolookups}%n}{FATAL=red, ERROR=red, WARN=normal, INFO=normal, DEBUG=normal, TRACE=normal}"/> </LoggerNamePatternSelector> </PatternLayout> </Console> <!-- Vanilla server gui --> <Queue name="ServerGuiConsole" ignoreExceptions="true"> <PatternLayout> <LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss} %level] (%logger{1}) %msg{nolookups}%n"> <!-- Dont show the logger name for minecraft classes--> <PatternMatch key="net.minecraft.,com.mojang." pattern="[%d{HH:mm:ss} %level] %msg{nolookups}%n"/> </LoggerNamePatternSelector> </PatternLayout> </Queue> <!-- latest.log same as vanilla --> <RollingRandomAccessFile name="LatestFile" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz"> <PatternLayout> <LoggerNamePatternSelector defaultPattern="[%d{HH:mm:ss}] [%t/%level] (%logger{1}) %msg{nolookups}%n"> <!-- Dont show the logger name for minecraft classes--> <PatternMatch key="net.minecraft.,com.mojang." pattern="[%d{HH:mm:ss}] [%t/%level] (Minecraft) %msg{nolookups}%n"/> </LoggerNamePatternSelector> </PatternLayout> <Policies> <TimeBasedTriggeringPolicy /> <OnStartupTriggeringPolicy /> </Policies> </RollingRandomAccessFile> <!-- Debug log file --> <RollingRandomAccessFile name="DebugFile" fileName="logs/debug.log" filePattern="logs/debug-%i.log.gz"> <PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level] (%logger) %msg{nolookups}%n" /> <!-- Keep 5 files max --> <DefaultRolloverStrategy max="5" fileIndex="min"/> <Policies> <SizeBasedTriggeringPolicy size="200MB"/> <OnStartupTriggeringPolicy /> </Policies> </RollingRandomAccessFile> </Appenders> <Loggers> <Logger level="${sys:fabric.log.level:-info}" name="net.minecraft"/> <Logger level="warn" name="cpw.mods.modlauncher.ClassTransformer"/> <Root level="all"> <AppenderRef ref="DebugFile" level="${sys:fabric.log.debug.level:-debug}"/> <AppenderRef ref="SysOut" level="${sys:fabric.log.level:-info}"/> <AppenderRef ref="LatestFile" level="${sys:fabric.log.level:-info}"/> <AppenderRef ref="ServerGuiConsole" level="${sys:fabric.log.level:-info}"/> </Root> </Loggers> </Configuration>  
    • Then i use texture for the gui it throws an error "java.io.FileNotFoundExeption". This is code i used:  And this is location of gui.png:  Thanks in advance!
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.