Jump to content

Recommended Posts

Posted

Hi, I'm french so sorry for my English I'll do my best, I'v done some ExtendedEntityProperties but they aren't saved when I die or leave the game. My event work 'cause I've put some System.out in different parts and it worked. There is my code:

http://pastebin.com/LaGZ5sbb http://pastebin.com/2HLcpyQ7 http://pastebin.com/tsWihcuM Ask me if you want more class. I hope you will help me! :) PS: I've already done a post on the french forum: http://www.minecraftforgefrance.fr/showthread.php?tid=2023

I'm a Potterhead.

Posted

I don't quite have time to look super-deep in your code, but for one I can tell - you are either doing very oldschool stuff, or simply learned from old tutorial.

 

Going through all you got:

- your IEEP is cool, your nbtLoad and wirte are cool.

- remove your whole joined world, and whatever else stuff (like your storage-proxy) - this is the old school I've been talking about.

 

Now what you're gonna do:

Use:

@SubscribeEvent
public void playerClone(PlayerEvent.Clone event)
{
IEEP epNew = IEEP.get(event.entityPlayer);
IEEP epOld = IEEP.get(event.original);
//copy your data
}

Above will copy IEEP data from old dead entity to new one constructed after death.

 

This is all you need, you should NEVER EVER have to call neither load or save methods in your IEEP, just make sure they work, and leave them.

 

Note: In Clone event - don't write and read, you can transfer data directly like intFromNew = intFromOld (just saying because many do that).

 

EDIT:

To just ensure you write your stuff well - you can paste it here when you're done or have problems.

1.7.10 is no longer supported by forge, you are on your own.

Posted

Thanks for your help, so I delete all my old stuff (events, stuffs in the Common Proxy ect) and i just put your code? Eclipse doesn't find the event PlayerEvent.Clone :/ May I change in PlayerEvent.PlayerRespawnEvent?

I'm a Potterhead.

Posted

net.minecraftforge.event.entity.player.PlayerEvent.Clone

 

You sure? It might have been added in 1.8. If it is the reason, there is still better workaround than what you are doing now. Just check if you didn't import FML events (there are two PlayerEvent.class)

1.7.10 is no longer supported by forge, you are on your own.

Posted

Oh yeah thanks, bad PlayerEvent.class, I've done that, it's working but not when I disconnect/reconnect :/

@SubscribeEvent

  public void playerClone(PlayerEvent.Clone event)

  {

      ExtendedEntityProps epNew = ExtendedEntityProps.get(event.entityPlayer);

      ExtendedEntityProps epOld = ExtendedEntityProps.get(event.original);

      epNew.mana = epOld.mana;

      epNew.maxMana = epOld.maxMana;

      epNew.spellLeft = epOld.spellLeft;

      epNew.spellRight = epOld.spellRight;

      epNew.spellsList = epOld.spellsList;

  }

I'm a Potterhead.

Posted

Post new code. You can try making prints in write/read methods (print whole NBT).

 

 

EDIT NOTE

For future - I've noticed you are doing side-checking in events that are only server-sided (e.g LoggedOut). Remember that not all events are sided. One more important thing is some events (tick mostly) have Phases, have that in mind.

1.7.10 is no longer supported by forge, you are on your own.

Posted

Well my code is the same as the code at the top, but I'd to put the PlayerEvent.Clone on an other class because I need both imports. The other class:

[embed=425,349]package fr.sosoh.hogsmod.common.event;

 

import net.minecraftforge.event.entity.player.PlayerEvent;

import cpw.mods.fml.common.Mod.EventHandler;

import cpw.mods.fml.common.eventhandler.SubscribeEvent;

import fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps;

 

public class EventHandlerMain {

 

  @SubscribeEvent

  public void playerClone(PlayerEvent.Clone event)

  {

      ExtendedEntityProps epNew = ExtendedEntityProps.get(event.entityPlayer);

      ExtendedEntityProps epOld = ExtendedEntityProps.get(event.original);

     

      epNew.maxMana = epOld.maxMana;

      epNew.spellLeft = epOld.spellLeft;

      epNew.spellRight = epOld.spellRight;

      epNew.spellsList = epOld.spellsList;

  }

   

}[/embed] And I've already put some system.out and it appeares that my saveNBTData is used when nothing happend:

 

[01:07:15] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:07:15] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:08:00] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:08:00] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:08:45] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:08:45] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:09:30] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

[01:09:30] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: saveNBT

 

 

Maybe I can send you my source folder ?

I'm a Potterhead.

Posted

When someone can't find the problem, the problem is most likely elsewhere. Post everything related to your IEEP in pastebin or <code>.

 

Nbt saving is almost "random", it happens when you stop game, every some time (in ticks) and few other ocasions (loggionOut).

 

EDIT

(print whole NBT).

Literally, you can print NBTTag, see what you get.

1.7.10 is no longer supported by forge, you are on your own.

Posted

There is what I've got:

[14:14:38] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: save{spellRight:"",Mana:0.0d,spellLeft:"",Spells:[0:"Accio",1:"Repulso",2:"Protego",],MaxMana:1000.0d,}

[14:14:38] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: save{spellRight:"",Mana:0.0d,spellLeft:"",Spells:[0:"Accio",1:"Repulso",2:"Protego",],MaxMana:1000.0d,}

[14:14:38] [server thread/INFO]: Saving worlds

[14:14:38] [server thread/INFO]: Saving chunks for level 'Nouveau monde'/Overworld

[14:14:38] [server thread/INFO]: Saving chunks for level 'Nouveau monde'/Nether

[14:14:38] [server thread/INFO]: Saving chunks for level 'Nouveau monde'/The End

[14:14:38] [server thread/INFO] [FML]: Unloading dimension 0

[14:14:38] [server thread/INFO] [FML]: Unloading dimension -1

[14:14:38] [server thread/INFO] [FML]: Unloading dimension 1

[14:14:38] [server thread/INFO] [FML]: Applying holder lookups

[14:14:38] [server thread/INFO] [FML]: Holder lookups applied

[14:15:08] [server thread/INFO]: Starting integrated minecraft server version 1.7.10

[14:15:08] [server thread/INFO]: Generating keypair

[14:15:08] [server thread/INFO] [FML]: Injecting existing block and item data into this server instance

[14:15:08] [server thread/INFO] [FML]: Applying holder lookups

[14:15:08] [server thread/INFO] [FML]: Holder lookups applied

[14:15:08] [server thread/INFO] [FML]: Loading dimension 0 (Nouveau monde) (net.minecraft.server.integrated.IntegratedServer@4a85f46d)

[14:15:08] [server thread/INFO] [FML]: Loading dimension 1 (Nouveau monde) (net.minecraft.server.integrated.IntegratedServer@4a85f46d)

[14:15:09] [server thread/INFO] [FML]: Loading dimension -1 (Nouveau monde) (net.minecraft.server.integrated.IntegratedServer@4a85f46d)

[14:15:09] [server thread/INFO]: Preparing start region for level 0

[14:15:10] [server thread/INFO]: Preparing spawn area: 96%

[14:15:10] [server thread/INFO]: Changing view distance to 8, from 10

[14:15:10] [Netty Client IO #1/INFO] [FML]: Server protocol version 1

[14:15:10] [Netty IO #3/INFO] [FML]: Client protocol version 1

[14:15:10] [Netty IO #3/INFO] [FML]: Client attempting to join with 4 mods : [email protected],[email protected],[email protected],[email protected]

[14:15:10] [Netty IO #3/INFO] [FML]: Attempting connection with missing mods [] at CLIENT

[14:15:10] [Netty Client IO #1/INFO] [FML]: Attempting connection with missing mods [] at SERVER

[14:15:10] [server thread/INFO] [FML]: [server thread] Server side modded connection established

[14:15:10] [Client thread/INFO] [FML]: [Client thread] Client side modded connection established

[14:15:11] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:loadNBTData:94]: load{spellRight:"",Mana:0.0d,spellLeft:"",Spells:[0:"Accio",1:"Repulso",2:"Protego",],MaxMana:1000.0d,}

[14:15:11] [server thread/INFO]: sosoh[local:E:7def91e3] logged in with entity id 190710 at (289.5, 4.0, 244.5)

[14:15:11] [server thread/INFO]: sosoh joined the game

[14:15:12] [server thread/INFO]: Saving and pausing game...

[14:15:12] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: save{spellRight:"",Mana:0.0d,spellLeft:"",Spells:[],MaxMana:1000.0d,}

[14:15:12] [server thread/INFO] [sTDOUT]: [fr.sosoh.hogsmod.common.entity.props.ExtendedEntityProps:saveNBTData:79]: save{spellRight:"",Mana:0.0d,spellLeft:"",Spells:[],MaxMana:1000.0d,}

I'm a Potterhead.

Posted

OH MY GOD. (note - previous shit I wrote was totally wrong):

 

NBTTagList list = compound.getTagList("Spells", Constants.NBT.TAG_STRING);

 

compound != properties

 

This is like 3rd same mistake I see this week. How could I miss it :P

1.7.10 is no longer supported by forge, you are on your own.

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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