Jump to content

[1.12.1 - 1.12.2] An already working method suddenly stop working out of nowhere


Recommended Posts

Posted
4 minutes ago, Animefan8888 said:

For the love of god no...go back to using an array. You need to initialize your array. If you don't know how to do that please look it up. It's very basic Java and many other languages.

the thing is : gigahertz never initialized his array, and it still work, and what do you want me to initialize it with?

Posted
Just now, Gess1t said:

and what do you want me to initialize it with?

It's meant to represent the player's inventory right? Then you should initialize it to have the same size as the inventory.

 

Just now, Gess1t said:

gigahertz never initialized his array

If his mod worked at all then he must have done it at some point.

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.

Posted (edited)

in theory, i should just have to do that : 

 

this.previous = new ItemStack[player.inventory.getSizeInventory()];  

 

but it doesn't work

 

package Gess.mod;

import Gess.mod.proxy.iProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import util.Reference;
@EventBusSubscriber
@Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION)

public class Main 
{
	public static Configuration config;
	//public static int time = 10;
	public static Main instance; 
	//float lastMessageTime = 0;
	public boolean inventoryIsFull;
	public static final String CLIENT = "gess.mod.proxy.ClientProxy";
	public static final String SERVER = "gess.mod.proxy.CommonProxy";
	
	@SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON)
	public static iProxy proxy;
	
	@EventHandler
	public void preInit(FMLPreInitializationEvent e){
		 //File directory = event.getModConfigurationDirectory();
         //config = new Configuration(new File(directory.getPath(), "FullInventoryChecker.cfg"));
         //Config.readConfig();
	}
	@EventHandler
	public void init(FMLInitializationEvent e){}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent e){
		// if (config.hasChanged()) 
        //    config.save();
		//}
	}
	
	public void log() {
		System.out.println("Does PckUpItm actually output anything?");
	}

	private ItemStack[] previous;
	private ItemStack[] now;
	private EntityPlayer playerEntity;
	final EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().player;
	
	@SubscribeEvent
	public void PckUpItm(TickEvent.ClientTickEvent event) {
		if(Minecraft.getMinecraft().player != null) {
			this.playerEntity = player;
	        this.previous = new ItemStack[player.inventory.getSizeInventory()];  
			Main pui = new Main();
			pui.log();
			EntityPlayer player = Minecraft.getMinecraft().player;
			int g = 0;
			System.out.println("starting to count e");
		for(int e=0; e < 36; e++) {
			System.out.println("checking slot " + e);
			ItemStack stack = player.inventory.getStackInSlot(e);
            if(ItemStack.areItemStacksEqual(previous[e], stack)) {
					if(!stack.isEmpty() && stack.getCount() == stack.getMaxStackSize()) {
						g++;
						System.out.println("g = " + g);
						previous[e] = stack;
						System.out.println("Itemstack " + e + "copied");
						if(g > 34) {
						Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full"));
						return;
						
					}
				}
				
			}
				
		}
					
	}				

}

	
	@SubscribeEvent
	public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException {
		if(Minecraft.getMinecraft().player != null) {	
			int s = 0;
			for(int i=0; i < 37; i++) {
				if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty() && Minecraft.getMinecraft()
						.player.inventory.getStackInSlot(i).getCount() == Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getMaxStackSize()) {
					s++;
					if(s > 35) {
						if(Minecraft.getMinecraft().world.getTotalWorldTime() % 200 == 3L && event.phase == TickEvent.Phase.END) {
						Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full"));
						System.out.println("chkInv: Triggerred with s = " + s);
						return;
						}
						
					}
				
				}
				
			}
			
			return;
					
		}
		
	}
	

}

 

log timeout:

 

[04:19:47] [main/INFO] [GradleStart]: Extra: []
[04:19:47] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/[user]/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[04:19:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[04:19:47] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[04:19:47] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[04:19:47] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[04:19:47] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading
[04:19:47] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_212, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_212
[04:19:47] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[04:19:47] [main/ERROR] [FML]: Full: C:\Users\[user]\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[04:19:47] [main/ERROR] [FML]: Trimmed: c:/users/[user]/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[04:19:48] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[04:19:48] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
2019-10-20 04:19:49,484 main WARN Disabling terminal, you're running in an unsupported environment.
[04:19:49] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[04:19:49] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[04:19:49] [main/INFO] [FML]: Searching D:\Modding\Minecraft\FullinventorycheckerRenewal\run\.\mods for mods
[04:19:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[04:19:49] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[04:19:49] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[04:19:49] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[04:19:49] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[04:19:49] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[04:19:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[04:19:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[04:19:49] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[04:19:52] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[04:19:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[04:19:52] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[04:19:53] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[04:19:53] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[04:19:53] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[04:19:53] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[04:19:55] [main/INFO] [minecraft/Minecraft]: Setting user: Player62
[04:20:01] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[04:20:01] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
[04:20:02] [main/INFO] [FML]: -- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 8.1 (amd64) version 6.3
	Java Version: 1.8.0_212, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 852475544 bytes (812 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 431.60' Renderer: 'GeForce GT 1030/PCIe/SSE2'
[04:20:03] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized
[04:20:03] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[04:20:03] [main/INFO] [FML]: Replaced 1036 ore ingredients
[04:20:04] [main/INFO] [FML]: Searching D:\Modding\Minecraft\FullinventorycheckerRenewal\run\.\mods for mods
[04:20:06] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[04:20:07] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, fullinvchecker] at CLIENT
[04:20:07] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, fullinvchecker] at SERVER
[04:20:08] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Full Inventory Checker
[04:20:08] [main/INFO] [FML]: Processing ObjectHolder annotations
[04:20:08] [main/INFO] [FML]: Found 1168 ObjectHolder annotations
[04:20:08] [main/INFO] [FML]: Identifying ItemStackHolder annotations
[04:20:08] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
[04:20:08] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
[04:20:08] [main/INFO] [FML]: Applying holder lookups
[04:20:08] [main/INFO] [FML]: Holder lookups applied
[04:20:08] [main/INFO] [FML]: Applying holder lookups
[04:20:08] [main/INFO] [FML]: Holder lookups applied
[04:20:08] [main/INFO] [FML]: Applying holder lookups
[04:20:08] [main/INFO] [FML]: Holder lookups applied
[04:20:08] [main/INFO] [FML]: Applying holder lookups
[04:20:08] [main/INFO] [FML]: Holder lookups applied
[04:20:08] [main/INFO] [FML]: Injecting itemstacks
[04:20:08] [main/INFO] [FML]: Itemstack injection complete
[04:20:08] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[04:20:09] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[04:20:09] [Thread-3/INFO] [FML]: Using alternative sync timing : 200 frames of Display.update took 5168364803 nanos
[04:20:15] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem...
[04:20:15] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL
[04:20:15] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[04:20:15] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized.
[04:20:16] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started
[04:20:25] [main/INFO] [FML]: Max texture size: 16384
[04:20:26] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas
[04:20:29] [main/INFO] [FML]: Applying holder lookups
[04:20:29] [main/INFO] [FML]: Holder lookups applied
[04:20:29] [main/INFO] [FML]: Injecting itemstacks
[04:20:29] [main/INFO] [FML]: Itemstack injection complete
[04:20:29] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
[04:20:29] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[04:20:30] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
[04:20:32] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[04:20:49] [main/INFO] [minecraft/GuiConnecting]: Connecting to localhost, 25565
[04:20:49] [Netty Client IO #1/INFO] [FML]: Aborting client handshake "VANILLA"
[04:20:49] [Netty Client IO #1/INFO] [FML]: [Netty Client IO #1] Client side vanilla connection established
[04:21:15] [Netty Client IO #1/ERROR] [FML]: NetworkDispatcher exception
java.io.IOException: Une connexion existante a dû être fermée par l’hôte distant // timeout
	at sun.nio.ch.SocketDispatcher.write0(Native Method) ~[?:1.8.0_212]
	at sun.nio.ch.SocketDispatcher.write(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.writeFromNativeBuffer(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.write(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.SocketChannelImpl.write(Unknown Source) ~[?:1.8.0_212]
	at io.netty.channel.socket.nio.NioSocketChannel.doWrite(NioSocketChannel.java:417) ~[NioSocketChannel.class:4.1.9.Final]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.flush0(AbstractChannel.java:856) ~[AbstractChannel$AbstractUnsafe.class:4.1.9.Final]
	at io.netty.channel.nio.AbstractNioChannel$AbstractNioUnsafe.flush0(AbstractNioChannel.java:362) ~[AbstractNioChannel$AbstractNioUnsafe.class:4.1.9.Final]
	at io.netty.channel.AbstractChannel$AbstractUnsafe.flush(AbstractChannel.java:823) ~[AbstractChannel$AbstractUnsafe.class:4.1.9.Final]
	at io.netty.channel.DefaultChannelPipeline$HeadContext.flush(DefaultChannelPipeline.java:1296) ~[DefaultChannelPipeline$HeadContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.ChannelDuplexHandler.flush(ChannelDuplexHandler.java:117) ~[ChannelDuplexHandler.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115) ~[ChannelOutboundHandlerAdapter.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115) ~[ChannelOutboundHandlerAdapter.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.ChannelOutboundHandlerAdapter.flush(ChannelOutboundHandlerAdapter.java:115) ~[ChannelOutboundHandlerAdapter.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush(AbstractChannelHandlerContext.java:768) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.flush(AbstractChannelHandlerContext.java:749) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher.flush(NetworkDispatcher.java:558) ~[NetworkDispatcher.class:?]
	at io.netty.channel.AbstractChannelHandlerContext.invokeFlush0(AbstractChannelHandlerContext.java:776) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:802) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:814) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:794) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:831) ~[AbstractChannelHandlerContext.class:4.1.9.Final]
	at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1032) ~[DefaultChannelPipeline.class:4.1.9.Final]
	at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:296) ~[AbstractChannel.class:4.1.9.Final]
	at net.minecraft.network.NetworkManager$4.run(NetworkManager.java:261) [NetworkManager$4.class:?]
	at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) [AbstractEventExecutor.class:4.1.9.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:403) [SingleThreadEventExecutor.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442) [NioEventLoop.class:4.1.9.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_212]
[04:21:16] [main/INFO] [FML]: Applying holder lookups
[04:21:16] [main/INFO] [FML]: Holder lookups applied
[04:21:39] [main/INFO] [minecraft/GuiConnecting]: Connecting to localhost, 25565
[04:21:40] [Netty Client IO #2/INFO] [FML]: Aborting client handshake "VANILLA"
[04:21:40] [Netty Client IO #2/INFO] [FML]: [Netty Client IO #2] Client side vanilla connection established
[04:22:05] [Netty Client IO #2/ERROR] [FML]: NetworkDispatcher exception
java.io.IOException: Une connexion existante a dû être fermée par l’hôte distant //timeout
	at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[?:1.8.0_212]
	at sun.nio.ch.SocketDispatcher.read(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.read(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.SocketChannelImpl.read(Unknown Source) ~[?:1.8.0_212]
	at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288) ~[PooledUnsafeDirectByteBuf.class:4.1.9.Final]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100) ~[AbstractByteBuf.class:4.1.9.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372) ~[NioSocketChannel.class:4.1.9.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [AbstractNioByteChannel$NioByteUnsafe.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) [NioEventLoop.class:4.1.9.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_212]
[04:22:06] [main/INFO] [FML]: Applying holder lookups
[04:22:06] [main/INFO] [FML]: Holder lookups applied

 

Edited by Gess1t
Posted
19 minutes ago, Gess1t said:

this.previous = new ItemStack[player.inventory.getSizeInventory()];

You're making it a new array every time that method is called therefore it is never the "previous" inventory. It is always an "empty" inventory. You only need to initialize it once. You also need to make sure that none of the values are null, but instead ItemStack.EMPTY.

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.

Posted (edited)
8 hours ago, Animefan8888 said:

You're making it a new array every time that method is called therefore it is never the "previous" inventory. It is always an "empty" inventory. You only need to initialize it once. You also need to make sure that none of the values are null, but instead ItemStack.EMPTY.

for the first part, make it an if statement with a boolean i set to false when activated so it only run once, then for the second part, i apparently have to set it outside of if statement, but where, and how?

 

it's not return ItemStack.EMPTY; cause it error and ask to edit void for ItemStack instead, whihch isn't what i want

 

EDIT: so apparently i have to use NonNullList<ItemStack> previous = NonNullList.withSize(player.inventory.getSizeInventory(), ItemStack.EMPTY); as someone suggested me, but just using this line won"t work

Edited by Gess1t
Posted (edited)

updated the github https://github.com/Mrcubix/Full-Inventory-Checker, with my actual code:

 

package Gess.mod;

import Gess.mod.proxy.iProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.NonNullList;
import net.minecraft.util.text.TextComponentString;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import util.Reference;
@EventBusSubscriber
@Mod(modid=Reference.MODID, name=Reference.MODNAME, version=Reference.VERSION)

public class Main 
{
	public static Configuration config;
	//public static int time = 10;
	public static Main instance; 
	//float lastMessageTime = 0;
	public boolean inventoryIsFull;
	public static final String CLIENT = "gess.mod.proxy.ClientProxy";
	public static final String SERVER = "gess.mod.proxy.CommonProxy";
	
	@SidedProxy(clientSide = Reference.CLIENT, serverSide = Reference.COMMON)
	public static iProxy proxy;
	
	@EventHandler
	public void preInit(FMLPreInitializationEvent e){
		 //File directory = event.getModConfigurationDirectory();
         //config = new Configuration(new File(directory.getPath(), "FullInventoryChecker.cfg"));
         //Config.readConfig();
	}
	@EventHandler
	public void init(FMLInitializationEvent e){}
	
	@EventHandler
	public void postInit(FMLPostInitializationEvent e){
		// if (config.hasChanged()) 
        //    config.save();
		//}
	}
	
	public void log() {
		System.out.println("Does PckUpItm actually output anything?");
	}

	private EntityPlayer playerEntity;
	final EntityPlayer player = (EntityPlayer)Minecraft.getMinecraft().player;
    private boolean enabled = true;
	private NonNullList<ItemStack> previous;
	
    @SubscribeEvent
	public void PckUpItm(final TickEvent.ClientTickEvent event) {
		if(Minecraft.getMinecraft().player != null) {
	        this.playerEntity = player;
	        if (enabled == true) {
	            NonNullList<ItemStack> previous = NonNullList.withSize(player.inventory.getSizeInventory(), ItemStack.EMPTY);
	            enabled = false;
	        }
			Main pui = new Main();
			pui.log();
			EntityPlayer player = Minecraft.getMinecraft().player;
			int g = 0;
			System.out.println("starting to count e");
		for(int e=0; e < 36; e++) {
			System.out.println("checking slot " + e);
			ItemStack stack = player.inventory.getStackInSlot(e);
            if(ItemStack.areItemStacksEqual(previous.get(e), stack)) {
            	previous.set(e,stack);	
            	if(!stack.isEmpty() && stack.getCount() == stack.getMaxStackSize()) {
						g++;
						System.out.println("g = " + g);
						System.out.println("Itemstack " + e + "copied");
						if(g > 34) {
						Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full"));
						return;
						
					}
				}
				
			}
				
		}
					
	}				

}

	
	@SubscribeEvent
	public static void chkInv(TickEvent.ClientTickEvent event) throws InterruptedException {
		if(Minecraft.getMinecraft().player != null) {	
			int s = 0;
			for(int i=0; i < 37; i++) {
				if(!Minecraft.getMinecraft().player.inventory.getStackInSlot(i).isEmpty() && Minecraft.getMinecraft()
						.player.inventory.getStackInSlot(i).getCount() == Minecraft.getMinecraft().player.inventory.getStackInSlot(i).getMaxStackSize()) {
					s++;
					if(s > 35) {
						if(Minecraft.getMinecraft().world.getTotalWorldTime() % 200 == 3L && event.phase == TickEvent.Phase.END) {
						Minecraft.getMinecraft().player.sendMessage(new TextComponentString("Your inventory is full"));
						System.out.println("chkInv: Triggerred with s = " + s);
						return;
						}
						
					}
				
				}
				
			}
			
			return;
					
		}
		
	}
	

}

 

it still doesn't work, even when using NonNullList<ItemStack> previous = NonNullList.withSize(player.inventory.getSizeInventory(), ItemStack.EMPTY); so idk at this point

 

same log as below:

 

[21:01:37] [main/INFO] [GradleStart]: Extra: []
[21:01:37] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, C:/Users/[user]/.gradle/caches/minecraft/assets, --assetIndex, 1.12, --accessToken{REDACTED}, --version, 1.12.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[21:01:38] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:01:38] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker
[21:01:38] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[21:01:38] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker
[21:01:38] [main/INFO] [FML]: Forge Mod Loader version 14.23.5.2768 for Minecraft 1.12.2 loading
[21:01:38] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_212, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jre1.8.0_212
[21:01:38] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[21:01:38] [main/ERROR] [FML]: Full: C:\Users\[user]\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[21:01:38] [main/ERROR] [FML]: Trimmed: c:/users/[user]/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[21:01:38] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[21:01:38] [main/INFO] [FML]: Detected deobfuscated environment, loading log configs for colored console logs.
2019-10-20 21:01:40,811 main WARN Disabling terminal, you're running in an unsupported environment.
[21:01:40] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLCorePlugin (net.minecraftforge.fml.relauncher.FMLCorePlugin), we are in deobf and it's a forge core plugin
[21:01:40] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[21:01:41] [main/INFO] [FML]: Searching D:\Modding\Minecraft\FullinventorycheckerRenewal\run\.\mods for mods
[21:01:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[21:01:41] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[21:01:41] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[21:01:41] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:01:41] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[21:01:41] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[21:01:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:01:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[21:01:41] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[21:01:44] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[21:01:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[21:01:44] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[21:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[21:01:45] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[21:01:45] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[21:01:45] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}
[21:01:47] [main/INFO] [minecraft/Minecraft]: Setting user: Player431
[21:01:56] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[21:01:56] [main/INFO] [minecraft/Minecraft]: LWJGL Version: 2.9.4
[21:01:57] [main/INFO] [FML]: -- System Details --
Details:
	Minecraft Version: 1.12.2
	Operating System: Windows 8.1 (amd64) version 6.3
	Java Version: 1.8.0_212, Oracle Corporation
	Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
	Memory: 852327856 bytes (812 MB) / 1038876672 bytes (990 MB) up to 1038876672 bytes (990 MB)
	JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
	IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
	FML: 
	Loaded coremods (and transformers): 
	GL info: ' Vendor: 'NVIDIA Corporation' Version: '4.6.0 NVIDIA 431.60' Renderer: 'GeForce GT 1030/PCIe/SSE2'
[21:01:57] [main/INFO] [FML]: MinecraftForge v14.23.5.2768 Initialized
[21:01:57] [main/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[21:01:58] [main/INFO] [FML]: Replaced 1036 ore ingredients
[21:01:59] [main/INFO] [FML]: Searching D:\Modding\Minecraft\FullinventorycheckerRenewal\run\.\mods for mods
[21:02:03] [main/INFO] [FML]: Forge Mod Loader has identified 5 mods to load
[21:02:04] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, fullinvchecker] at CLIENT
[21:02:04] [main/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, fullinvchecker] at SERVER
[21:02:05] [Thread-3/INFO] [FML]: Using alternative sync timing : 200 frames of Display.update took 6157975628 nanos
[21:02:05] [main/INFO] [minecraft/SimpleReloadableResourceManager]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Full Inventory Checker
[21:02:06] [main/INFO] [FML]: Processing ObjectHolder annotations
[21:02:06] [main/INFO] [FML]: Found 1168 ObjectHolder annotations
[21:02:06] [main/INFO] [FML]: Identifying ItemStackHolder annotations
[21:02:06] [main/INFO] [FML]: Found 0 ItemStackHolder annotations
[21:02:06] [main/INFO] [FML]: Configured a dormant chunk cache size of 0
[21:02:06] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[21:02:06] [main/INFO] [FML]: Applying holder lookups
[21:02:06] [main/INFO] [FML]: Holder lookups applied
[21:02:06] [main/INFO] [FML]: Applying holder lookups
[21:02:06] [main/INFO] [FML]: Holder lookups applied
[21:02:06] [main/INFO] [FML]: Applying holder lookups
[21:02:06] [main/INFO] [FML]: Holder lookups applied
[21:02:06] [main/INFO] [FML]: Applying holder lookups
[21:02:06] [main/INFO] [FML]: Holder lookups applied
[21:02:06] [main/INFO] [FML]: Injecting itemstacks
[21:02:06] [main/INFO] [FML]: Itemstack injection complete
[21:02:07] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[21:02:14] [Sound Library Loader/INFO] [minecraft/SoundManager]: Starting up SoundSystem...
[21:02:14] [Thread-5/INFO] [minecraft/SoundManager]: Initializing LWJGL OpenAL
[21:02:14] [Thread-5/INFO] [minecraft/SoundManager]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)
[21:02:14] [Thread-5/INFO] [minecraft/SoundManager]: OpenAL initialized.
[21:02:15] [Sound Library Loader/INFO] [minecraft/SoundManager]: Sound engine started
[21:02:26] [main/INFO] [FML]: Max texture size: 16384
[21:02:27] [main/INFO] [minecraft/TextureMap]: Created: 512x512 textures-atlas
[21:02:33] [main/INFO] [FML]: Applying holder lookups
[21:02:33] [main/INFO] [FML]: Holder lookups applied
[21:02:33] [main/INFO] [FML]: Injecting itemstacks
[21:02:33] [main/INFO] [FML]: Itemstack injection complete
[21:02:33] [main/INFO] [FML]: Forge Mod Loader has successfully loaded 5 mods
[21:02:33] [main/WARN] [minecraft/GameSettings]: Skipping bad option: lastServer:
[21:02:33] [main/INFO] [mojang/NarratorWindows]: Narrator library for x64 successfully loaded
[21:02:36] [Realms Notification Availability checker #1/INFO] [mojang/RealmsClient]: Could not authorize you against Realms server: Invalid session id
[21:03:52] [main/INFO] [minecraft/GuiConnecting]: Connecting to localhost, 25565
[21:03:52] [Server Connector #1/ERROR] [minecraft/GuiConnecting]: Couldn't connect to server
java.lang.NullPointerException: group
	at io.netty.bootstrap.AbstractBootstrap.group(AbstractBootstrap.java:84) ~[AbstractBootstrap.class:?]
	at net.minecraft.network.NetworkManager.createNetworkManagerAndConnect(NetworkManager.java:367) ~[NetworkManager.class:?]
	at net.minecraft.client.multiplayer.GuiConnecting$1.run(GuiConnecting.java:68) [GuiConnecting$1.class:?]
[21:03:54] [main/INFO] [minecraft/GuiConnecting]: Connecting to localhost, 25565
[21:03:55] [Netty Client IO #1/INFO] [FML]: Aborting client handshake "VANILLA"
[21:03:55] [Netty Client IO #1/INFO] [FML]: [Netty Client IO #1] Client side vanilla connection established
[21:04:20] [Netty Client IO #1/ERROR] [FML]: NetworkDispatcher exception
java.io.IOException: Une connexion existante a dû être fermée par l’hôte distant
	at sun.nio.ch.SocketDispatcher.read0(Native Method) ~[?:1.8.0_212]
	at sun.nio.ch.SocketDispatcher.read(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.readIntoNativeBuffer(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.IOUtil.read(Unknown Source) ~[?:1.8.0_212]
	at sun.nio.ch.SocketChannelImpl.read(Unknown Source) ~[?:1.8.0_212]
	at io.netty.buffer.PooledUnsafeDirectByteBuf.setBytes(PooledUnsafeDirectByteBuf.java:288) ~[PooledUnsafeDirectByteBuf.class:4.1.9.Final]
	at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100) ~[AbstractByteBuf.class:4.1.9.Final]
	at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372) ~[NioSocketChannel.class:4.1.9.Final]
	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [AbstractNioByteChannel$NioByteUnsafe.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:624) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:559) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:476) [NioEventLoop.class:4.1.9.Final]
	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:438) [NioEventLoop.class:4.1.9.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [SingleThreadEventExecutor$5.class:4.1.9.Final]
	at java.lang.Thread.run(Unknown Source) [?:1.8.0_212]
[21:04:21] [main/INFO] [FML]: Applying holder lookups
[21:04:21] [main/INFO] [FML]: Holder lookups applied
[21:04:32] [main/INFO] [minecraft/GuiConnecting]: Connecting to localhost, 25565
[21:04:32] [Netty Client IO #2/INFO] [FML]: Aborting client handshake "VANILLA"
[21:04:32] [Netty Client IO #2/INFO] [FML]: [Netty Client IO #2] Client side vanilla connection established
[21:04:45] [main/INFO] [minecraft/Minecraft]: Stopping!
[21:04:52] [main/INFO] [minecraft/SoundManager]: SoundSystem shutting down...
[21:04:52] [main/WARN] [minecraft/SoundManager]: Author: Paul Lamb, www.paulscode.com
Java HotSpot(TM) 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

edit : code edited, to use list instead of arrays, but still not work

Edited by Gess1t
Posted

Do you know Java or any other programming language?

  • Like 1

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/: 100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Posted (edited)
11 minutes ago, loordgek said:

no he does not

 

not as much java as i would need apparently for minecraft modding, know some C# for unity, and basics in python for school

Edited by Gess1t
Posted

In that case, locking.

Learn Java

  • Like 1

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

Spoiler

Logs (Most issues require logs to diagnose):

Spoiler

Please post logs using one of the following sites (Thank you Lumber Wizard for the list):

https://gist.github.com/: 100MB Requires member (Free)

https://pastebin.com/: 512KB as guest, 10MB as Pro ($$$)

https://hastebin.com/: 400KB

Do NOT use sites like Mediafire, Dropbox, OneDrive, Google Drive, or a site that has a countdown before offering downloads.

 

What to provide:

...for Crashes and Runtime issues:

Minecraft 1.14.4 and newer:

Post debug.log

Older versions:

Please update...

 

...for Installer Issues:

Post your installer log, found in the same place you ran the installer

This log will be called either installer.log or named the same as the installer but with .log on the end

Note for Windows users:

Windows hides file extensions by default so the installer may appear without the .jar extension then when the .log is added the log will appear with the .jar extension

 

Where to get it:

Mojang Launcher: When using the Mojang launcher debug.log is found in .minecraft\logs.

 

Curse/Overwolf: If you are using the Curse Launcher, their configurations break Forge's log settings, fortunately there is an easier workaround than I originally thought, this works even with Curse's installation of the Minecraft launcher as long as it is not launched THROUGH Twitch:

Spoiler
  1. Make sure you have the correct version of Forge installed (some packs are heavily dependent on one specific build of Forge)
  2. Make a launcher profile targeting this version of Forge.
  3. Set the launcher profile's GameDir property to the pack's instance folder (not the instances folder, the folder that has the pack's name on it).
  4. Now launch the pack through that profile and follow the "Mojang Launcher" instructions above.

Video:

Spoiler

 

 

 

or alternately, 

 

Fallback ("No logs are generated"):

If you don't see logs generated in the usual place, provide the launcher_log.txt from .minecraft

 

Server Not Starting:

Spoiler

If your server does not start or a command window appears and immediately goes away, run the jar manually and provide the output.

 

Reporting Illegal/Inappropriate Adfocus Ads:

Spoiler

Get a screenshot of the URL bar or copy/paste the whole URL into a thread on the General Discussion board with a description of the Ad.

Lex will need the Ad ID contained in that URL to report it to Adfocus' support team.

 

Posting your mod as a GitHub Repo:

Spoiler

When you have an issue with your mod the most helpful thing you can do when asking for help is to provide your code to those helping you. The most convenient way to do this is via GitHub or another source control hub.

When setting up a GitHub Repo it might seem easy to just upload everything, however this method has the potential for mistakes that could lead to trouble later on, it is recommended to use a Git client or to get comfortable with the Git command line. The following instructions will use the Git Command Line and as such they assume you already have it installed and that you have created a repository.

 

  1. Open a command prompt (CMD, Powershell, Terminal, etc).
  2. Navigate to the folder you extracted Forge’s MDK to (the one that had all the licenses in).
  3. Run the following commands:
    1. git init
    2. git remote add origin [Your Repository's URL]
      • In the case of GitHub it should look like: https://GitHub.com/[Your Username]/[Repo Name].git
    3. git fetch
    4. git checkout --track origin/master
    5. git stage *
    6. git commit -m "[Your commit message]"
    7. git push
  4. Navigate to GitHub and you should now see most of the files.
    • note that it is intentional that some are not synced with GitHub and this is done with the (hidden) .gitignore file that Forge’s MDK has provided (hence the strictness on which folder git init is run from)
  5. Now you can share your GitHub link with those who you are asking for help.

[Workaround line, please ignore]

 

Guest
This topic is now closed to further replies.

Announcements




  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Version 1.19 - Forge 41.0.63 I want to create a wolf entity that I can ride, so far it seems to be working, but the problem is that when I get on the wolf, I can’t control it. I then discovered that the issue is that the server doesn’t detect that I’m riding the wolf, so I’m struggling with synchronization. However, it seems to not be working properly. As I understand it, the server receives the packet but doesn’t register it correctly. I’m a bit new to Java, and I’ll try to provide all the relevant code and prints *The comments and prints are translated by chatgpt since they were originally in Spanish* Thank you very much in advance No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. No player is mounted, or the passenger is not a player. MountableWolfEntity package com.vals.valscraft.entity; import com.vals.valscraft.network.MountSyncPacket; import com.vals.valscraft.network.NetworkHandler; import net.minecraft.client.Minecraft; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeSupplier; import net.minecraft.world.entity.ai.attributes.Attributes; import net.minecraft.world.entity.animal.Wolf; import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.Entity; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.event.TickEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.network.PacketDistributor; public class MountableWolfEntity extends Wolf { private boolean hasSaddle; private static final EntityDataAccessor<Byte> DATA_ID_FLAGS = SynchedEntityData.defineId(MountableWolfEntity.class, EntityDataSerializers.BYTE); public MountableWolfEntity(EntityType<? extends Wolf> type, Level level) { super(type, level); this.hasSaddle = false; } @Override protected void defineSynchedData() { super.defineSynchedData(); this.entityData.define(DATA_ID_FLAGS, (byte)0); } public static AttributeSupplier.Builder createAttributes() { return Wolf.createAttributes() .add(Attributes.MAX_HEALTH, 20.0) .add(Attributes.MOVEMENT_SPEED, 0.3); } @Override public InteractionResult mobInteract(Player player, InteractionHand hand) { ItemStack itemstack = player.getItemInHand(hand); if (itemstack.getItem() == Items.SADDLE && !this.hasSaddle()) { if (!player.isCreative()) { itemstack.shrink(1); } this.setSaddle(true); return InteractionResult.SUCCESS; } else if (!level.isClientSide && this.hasSaddle()) { player.startRiding(this); MountSyncPacket packet = new MountSyncPacket(true); // 'true' means the player is mounted NetworkHandler.CHANNEL.sendToServer(packet); // Ensure the server handles the packet return InteractionResult.SUCCESS; } return InteractionResult.PASS; } @Override public void travel(Vec3 travelVector) { if (this.isVehicle() && this.getControllingPassenger() instanceof Player) { System.out.println("The wolf has a passenger."); System.out.println("The passenger is a player."); Player player = (Player) this.getControllingPassenger(); // Ensure the player is the controller this.setYRot(player.getYRot()); this.yRotO = this.getYRot(); this.setXRot(player.getXRot() * 0.5F); this.setRot(this.getYRot(), this.getXRot()); this.yBodyRot = this.getYRot(); this.yHeadRot = this.yBodyRot; float forward = player.zza; float strafe = player.xxa; if (forward <= 0.0F) { forward *= 0.25F; } this.flyingSpeed = this.getSpeed() * 0.1F; this.setSpeed((float) this.getAttributeValue(Attributes.MOVEMENT_SPEED) * 1.5F); this.setDeltaMovement(new Vec3(strafe, travelVector.y, forward).scale(this.getSpeed())); this.calculateEntityAnimation(this, false); } else { // The wolf does not have a passenger or the passenger is not a player System.out.println("No player is mounted, or the passenger is not a player."); super.travel(travelVector); } } public boolean hasSaddle() { return this.hasSaddle; } public void setSaddle(boolean hasSaddle) { this.hasSaddle = hasSaddle; } @Override protected void dropEquipment() { super.dropEquipment(); if (this.hasSaddle()) { this.spawnAtLocation(Items.SADDLE); this.setSaddle(false); } } @SubscribeEvent public static void onServerTick(TickEvent.ServerTickEvent event) { if (event.phase == TickEvent.Phase.START) { MinecraftServer server = net.minecraftforge.server.ServerLifecycleHooks.getCurrentServer(); if (server != null) { for (ServerPlayer player : server.getPlayerList().getPlayers()) { if (player.isPassenger() && player.getVehicle() instanceof MountableWolfEntity) { MountableWolfEntity wolf = (MountableWolfEntity) player.getVehicle(); System.out.println("Tick: " + player.getName().getString() + " is correctly mounted on " + wolf); } } } } } private boolean lastMountedState = false; @Override public void tick() { super.tick(); if (!this.level.isClientSide) { // Only on the server boolean isMounted = this.isVehicle() && this.getControllingPassenger() instanceof Player; // Only print if the state changed if (isMounted != lastMountedState) { if (isMounted) { Player player = (Player) this.getControllingPassenger(); // Verify the passenger is a player System.out.println("Server: Player " + player.getName().getString() + " is now mounted."); } else { System.out.println("Server: The wolf no longer has a passenger."); } lastMountedState = isMounted; } } } @Override public void addPassenger(Entity passenger) { super.addPassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(true)); } } } @Override public void removePassenger(Entity passenger) { super.removePassenger(passenger); if (passenger instanceof Player) { Player player = (Player) passenger; if (!this.level.isClientSide && player instanceof ServerPlayer) { // Send the packet to the server to indicate the player is no longer mounted NetworkHandler.CHANNEL.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), new MountSyncPacket(false)); } } } @Override public boolean isControlledByLocalInstance() { Entity entity = this.getControllingPassenger(); return entity instanceof Player; } @Override public void positionRider(Entity passenger) { if (this.hasPassenger(passenger)) { double xOffset = Math.cos(Math.toRadians(this.getYRot() + 90)) * 0.4; double zOffset = Math.sin(Math.toRadians(this.getYRot() + 90)) * 0.4; passenger.setPos(this.getX() + xOffset, this.getY() + this.getPassengersRidingOffset() + passenger.getMyRidingOffset(), this.getZ() + zOffset); } } } MountSyncPacket package com.vals.valscraft.network; import com.vals.valscraft.entity.MountableWolfEntity; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.player.Player; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class MountSyncPacket { private final boolean isMounted; public MountSyncPacket(boolean isMounted) { this.isMounted = isMounted; } public void encode(FriendlyByteBuf buffer) { buffer.writeBoolean(isMounted); } public static MountSyncPacket decode(FriendlyByteBuf buffer) { return new MountSyncPacket(buffer.readBoolean()); } public void handle(NetworkEvent.Context context) { context.enqueueWork(() -> { ServerPlayer player = context.getSender(); // Get the player from the context if (player != null) { // Verifies if the player has dismounted if (!isMounted) { Entity vehicle = player.getVehicle(); if (vehicle instanceof MountableWolfEntity wolf) { // Logic to remove the player as a passenger wolf.removePassenger(player); System.out.println("Server: Player " + player.getName().getString() + " is no longer mounted."); } } } }); context.setPacketHandled(true); // Marks the packet as handled } } networkHandler package com.vals.valscraft.network; import com.vals.valscraft.valscraft; import net.minecraft.resources.ResourceLocation; import net.minecraftforge.network.NetworkRegistry; import net.minecraftforge.network.simple.SimpleChannel; import net.minecraftforge.network.NetworkEvent; import java.util.function.Supplier; public class NetworkHandler { private static final String PROTOCOL_VERSION = "1"; public static final SimpleChannel CHANNEL = NetworkRegistry.newSimpleChannel( new ResourceLocation(valscraft.MODID, "main"), () -> PROTOCOL_VERSION, PROTOCOL_VERSION::equals, PROTOCOL_VERSION::equals ); public static void init() { int packetId = 0; // Register the mount synchronization packet CHANNEL.registerMessage( packetId++, MountSyncPacket.class, MountSyncPacket::encode, MountSyncPacket::decode, (msg, context) -> msg.handle(context.get()) // Get the context with context.get() ); } }  
    • Do you use features of inventory profiles next (ipnext) or is there a change without it?
    • Remove rubidium - you are already using embeddium, which is a fork of rubidium
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.