Jump to content

if(player.inventory.armorItemInSlot) - Crash on server :(


Recommended Posts

Posted
    @Override
    public void onArmorTick(World world, EntityPlayer player, ItemStack item)
    {

        if(player.inventory.armorItemInSlot(0).getItem() == KEY31 &&
                player.inventory.armorItemInSlot(1).getItem() == KEY30 &&
                player.inventory.armorItemInSlot(2).getItem() == KEY29 &&
                player.inventory.armorItemInSlot(3).getItem() == KEY28)
        {
            player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 0, 2));
            player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 0, 2));
            player.addPotionEffect(new PotionEffect(MobEffects.STRENGTH, 0, 1));
            player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 0, 0));
        }
    }

 

Help me please, it's worked on client, but on server don't work :(  KEY31 - 28 - My armor. I want to do so that when dressing up my armor an effect would be given.

 

Err-log: 

[09:56:26] [main/INFO] [GradleStart]: Extra: []
[09:56:26] [main/INFO] [GradleStart]: Running with arguments: [--tweakClass, net.minecraftforge.fml.common.launcher.FMLServerTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]
[09:56:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[09:56:26] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[09:56:26] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker
[09:56:26] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[09:56:26] [main/INFO] [FML]: Forge Mod Loader version 14.23.4.2705 for Minecraft 1.12.2 loading
[09:56:26] [main/INFO] [FML]: Java is Java HotSpot(TM) 64-Bit Server VM, version 1.8.0_172, running on Windows 10:amd64:10.0, installed at C:\Program Files\Java\jdk1.8.0_172\jre
[09:56:26] [main/ERROR] [FML]: Apache Maven library folder was not in the format expected. Using default libraries directory.
[09:56:26] [main/ERROR] [FML]: Full: C:\Users\Nynxx\.gradle\caches\modules-2\files-2.1\org.apache.maven\maven-artifact\3.5.3\7dc72b6d6d8a6dced3d294ed54c2cc3515ade9f4\maven-artifact-3.5.3.jar
[09:56:26] [main/ERROR] [FML]: Trimmed: c:/users/nynxx/.gradle/caches/modules-2/files-2.1/org.apache.maven/maven-artifact/3.5.3/
[09:56:27] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation
[09:56:27] [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
[09:56:27] [main/INFO] [FML]: Ignoring missing certificate for coremod FMLForgePlugin (net.minecraftforge.classloading.FMLForgePlugin), we are in deobf and it's a forge core plugin
[09:56:27] [main/INFO] [FML]: Searching C:\Users\Nynxx\Desktop\mnxprojects\mnxemeralds\run\.\mods for mods
[09:56:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker
[09:56:27] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin
[09:56:27] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin
[09:56:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[09:56:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[09:56:27] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[09:56:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[09:56:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[09:56:27] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[09:56:28] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing
[09:56:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[09:56:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[09:56:28] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker
[09:56:29] [main/INFO] [GradleStart]: Remapping AccessTransformer rules...
[09:56:29] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[09:56:29] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[09:56:29] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[09:56:34] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting minecraft server version 1.12.2
[09:56:34] [Server thread/INFO] [FML]: MinecraftForge v14.23.4.2705 Initialized
[09:56:34] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[09:56:34] [Server thread/INFO] [FML]: Replaced 1036 ore ingredients
[09:56:34] [Server thread/INFO] [FML]: Searching C:\Users\Nynxx\Desktop\mnxprojects\mnxemeralds\run\.\mods for mods
[09:56:35] [Server thread/INFO] [FML]: Forge Mod Loader has identified 6 mods to load
[09:56:35] [Server thread/WARN] [FML]: Missing English translation for FML: assets/fml/lang/en_us.lang
[09:56:36] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, mnxemeralds, jei] at CLIENT
[09:56:36] [Server thread/INFO] [FML]: Attempting connection with missing mods [minecraft, mcp, FML, forge, mnxemeralds, jei] at SERVER
[09:56:37] [Server thread/INFO] [FML]: Processing ObjectHolder annotations
[09:56:37] [Server thread/INFO] [FML]: Found 1168 ObjectHolder annotations
[09:56:37] [Server thread/INFO] [FML]: Identifying ItemStackHolder annotations
[09:56:37] [Server thread/INFO] [FML]: Found 0 ItemStackHolder annotations
[09:56:37] [Server thread/INFO] [FML]: Configured a dormant chunk cache size of 0
[09:56:37] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json
[09:56:37] [Server thread/INFO] [mnxemeralds]: mnxemeralds mod starting preInitialization event.
[09:56:37] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:37] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:37] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:37] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:37] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:37] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:37] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:37] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:37] [Server thread/INFO] [FML]: Injecting itemstacks
[09:56:37] [Server thread/INFO] [FML]: Itemstack injection complete
[09:56:37] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Loading properties
[09:56:37] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Default game type: SURVIVAL
[09:56:37] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Generating keypair
[09:56:38] [Forge Version Check/INFO] [forge.VersionCheck]: [forge] Found status: UP_TO_DATE Target: null
[09:56:38] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Starting Minecraft server on *:25567
[09:56:38] [Server thread/INFO] [net.minecraft.network.NetworkSystem]: Using default channel type
[09:56:38] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: **** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!
[09:56:38] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: The server will make no attempt to authenticate usernames. Beware.
[09:56:38] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.
[09:56:38] [Server thread/WARN] [net.minecraft.server.dedicated.DedicatedServer]: To change this, set "online-mode" to "true" in the server.properties file.
[09:56:39] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:39] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:39] [Server thread/INFO] [mnxemeralds]: mnxemeralds mod starting Initialization event.
[09:56:39] [Server thread/INFO] [FML]: Injecting itemstacks
[09:56:39] [Server thread/INFO] [FML]: Itemstack injection complete
[09:56:39] [Server thread/INFO] [FML]: Forge Mod Loader has successfully loaded 6 mods
[09:56:39] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Preparing level "world"
[09:56:39] [Server thread/INFO] [FML]: Injecting existing registry data into this server instance
[09:56:39] [Server thread/INFO] [FML]: Applying holder lookups
[09:56:39] [Server thread/INFO] [FML]: Holder lookups applied
[09:56:40] [Server thread/INFO] [FML]: Loading dimension 0 (world) (net.minecraft.server.dedicated.DedicatedServer@11e70303)
[09:56:41] [Server thread/INFO] [net.minecraft.advancements.AdvancementList]: Loaded 488 advancements
[09:56:41] [Server thread/INFO] [FML]: Loading dimension 1 (world) (net.minecraft.server.dedicated.DedicatedServer@11e70303)
[09:56:41] [Server thread/INFO] [FML]: Loading dimension -1 (world) (net.minecraft.server.dedicated.DedicatedServer@11e70303)
[09:56:41] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing start region for level 0
[09:56:42] [Server thread/INFO] [net.minecraft.server.MinecraftServer]: Preparing spawn area: 1%
[09:56:43] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: Done (4,110s)! For help, type "help" or "?"
[09:56:44] [Server thread/INFO] [FML]: Unloading dimension -1
[09:56:44] [Server thread/INFO] [FML]: Unloading dimension 1
[09:59:16] [Netty Server IO #2/INFO] [FML]: Client protocol version 2
[09:59:16] [Netty Server IO #2/INFO] [FML]: Client attempting to join with 6 mods : [email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
[09:59:16] [Server thread/INFO] [FML]: [Server thread] Server side modded connection established
[09:59:16] [Server thread/INFO] [net.minecraft.server.management.PlayerList]: MairwunNx[/127.0.0.1:56519] logged in with entity id 374 at (-60.82462950596044, 86.0, 253.69999998807907)
[09:59:16] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: §eMairwunNx§r§e joined the game§r
[09:59:16] [Server thread/WARN] [net.minecraft.network.NetworkSystem]: Failed to handle packet for /127.0.0.1:56519
net.minecraft.util.ReportedException: Ticking player
	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:500) ~[EntityPlayerMP.class:?]
	at net.minecraft.network.NetHandlerPlayServer.update(NetHandlerPlayServer.java:185) ~[NetHandlerPlayServer.class:?]
	at net.minecraftforge.fml.common.network.handshake.NetworkDispatcher$1.update(NetworkDispatcher.java:212) ~[NetworkDispatcher$1.class:?]
	at net.minecraft.network.NetworkManager.processReceivedPackets(NetworkManager.java:307) ~[NetworkManager.class:?]
	at net.minecraft.network.NetworkSystem.networkTick(NetworkSystem.java:197) [NetworkSystem.class:?]
	at net.minecraft.server.MinecraftServer.updateTimeLightAndEntities(MinecraftServer.java:865) [MinecraftServer.class:?]
	at net.minecraft.server.dedicated.DedicatedServer.updateTimeLightAndEntities(DedicatedServer.java:414) [DedicatedServer.class:?]
	at net.minecraft.server.MinecraftServer.tick(MinecraftServer.java:743) [MinecraftServer.class:?]
	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:592) [MinecraftServer.class:?]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
Caused by: java.lang.NoSuchMethodError: net.minecraft.entity.player.InventoryPlayer.armorItemInSlot(I)Lnet/minecraft/item/ItemStack;
	at com.mairwunnx.mnxemeralds.armor.emeraldsuperarmor.onArmorTick(emeraldsuperarmor.java:33) ~[emeraldsuperarmor.class:?]
	at net.minecraft.entity.player.InventoryPlayer.decrementAnimations(InventoryPlayer.java:413) ~[InventoryPlayer.class:?]
	at net.minecraft.entity.player.EntityPlayer.onLivingUpdate(EntityPlayer.java:575) ~[EntityPlayer.class:?]
	at net.minecraft.entity.EntityLivingBase.onUpdate(EntityLivingBase.java:2396) ~[EntityLivingBase.class:?]
	at net.minecraft.entity.player.EntityPlayer.onUpdate(EntityPlayer.java:272) ~[EntityPlayer.class:?]
	at net.minecraft.entity.player.EntityPlayerMP.onUpdateEntity(EntityPlayerMP.java:423) ~[EntityPlayerMP.class:?]
	... 9 more
[09:59:17] [Server thread/INFO] [net.minecraft.network.NetHandlerPlayServer]: MairwunNx lost connection: Internal server error
[09:59:17] [Server thread/INFO] [net.minecraft.server.dedicated.DedicatedServer]: §eMairwunNx§r§e left the game§r

 

Posted (edited)
2 hours ago, V0idWa1k3r said:

InventoryPlayer#armorItemInSlot is client-side only. Use EntityPlayer#getItemStackFromSlot

image.png.e4f2b61a4616d9415837ef61e3f22348.png

 

Thx, but i not understand, why this show err? 

 

I also tried CHEST, LEGS and other.

Edited by MairwunNx
add info.
Posted (edited)
19 minutes ago, MairwunNx said:

i not understand, why this show err? 

Do you know java? Your IDE clearly tells you that this methods requires an EntityEquipmentSlot as a parameter, not an integer.

Edited by V0idWa1k3r
  • Thanks 1
Posted
6 minutes ago, V0idWa1k3r said:

Вы знаете java? В вашей среде IDE четко указано, что для этого метода требуется EntityEquipmentSlot как параметр, а не целое число.

thx dude! I newbie in Java, i junior on C# :) I solved problem

 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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