-
Posts
157 -
Joined
-
Last visited
Everything posted by Torojima
-
when I hit one of my mobs the respective method public boolean attackEntityFrom(DamageSource damageSource, int tmpNaturalArmorRating) { // ... doing some stuff, mostly checking if I want to allow the damage to the entity ... boolean check = super.attackEntityFrom(damageSource, tmpNaturalArmorRating); // checking side and doing some debug printout of the current damage return check; } will be called three times ... - first on the client without any accounted damage (entities health at max) - then on the server with the health reduced by the suffered damage - last one once more on the client and again without any damage what do I have to do to get the applied damage synchronised between client and server???
-
Now I have managed to get my entities running. They spawn with the intended initial data, can be interacted with etc .... and can be mounted. But ... I can move the mounted player/entity a few blocks, then the mount and player are moving back to the original location (where the player has mounted the entity)... I have searched in the vanilla boat and pig code, but could not find anything that would indicate to address this issue ... does anybody know to fix this? Or where I could try to look for a solution?
-
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
ok, that's a relieve I think I have my spawning now fixed. Spawning on the server only, piping extra spawning data from writeSpawnData on the server to readSpawnData on the client. Entity looks good with all the correct data and behaviours after spawning and after reloading the world. Now I have to find a way to: a) force a reload of the texture, since some actions will cause a change in skins (saddle, packbags, taming ...). Right now the texture does not change even if the responsible flags have changed ... (my getTexture() checking for the respective flags and return the correct path) b) get some data and flags from the server to the client at runtime... (most prominent health, if I hit my entity, the health will change on the server, but not on the client ... I thought fields from the mc native classes, like health from EntityLiving, would be changed automatically... ) for a) I haven't got a solution now, any suggestions? for b) I do some experimenting with a PacketHandler etc ... any other suggestions? Edit: after reading a bit, I belive a) isn't a problem at all on it own, but due to the texture responsible flags changed in the server entities, but not in the client ones ... thus the client doesn't change the texture, because it still has the unchanged responsible flags ... thus I'm only trying to solve b) how to get data from the server to the client ... -
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
that would explain a hell of a lot and would also give me a bit of sanity back !!! anyway, for example here: http://www.minecraftforge.net/wiki/SMP_Coding_Guidelines at the paragraph "Entities (that aren't EntityItem)" either, that quote is a typo, or I do understand it very wrong ... -
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
now when I do the spawning world.spawnEntityInWorld(entity); of a new entity on the server side check for: Side.SERVER == FMLCommonHandler.instance().getEffectiveSide() I have an working entity I can interact with (use item on it, entity itself is running around etc...) also it will still be present when I leave the game and reload. but, when I do the spawning on the client side Side.CLIENT == FMLCommonHandler.instance().getEffectiveSide() the entity is not moving at all, does not have a collision check, nor can I use any items on it. Also as soon as I leave the game and reload it, the entity is gone... Since I've been advised (here and from numerous tutorials) to do a new entity spawning only on the client side, I must do something very wrong ... any ideas where to start searching? -
I've got a question, which is I think not solemnly connected to minecraft forge only, but I hope you guys don't mind if I post it here anyway When creating a new instance of an object derived from entityLiving aka my new mob entity, I'm using three ways of injecting data into it: fist, the initialising by the constructor itself, here I'll put all the default data. second, the readSpawnData method added via the IEntityAdditionalSpawnData interface. Here I put all the data different from the default data. third, the readEntityFromNBT method. Here I'll inject all data accumulated from past incarnations of this entity if there have been past incarnations of this entity. Now my questions are a) are there any other means of injecting data into a new entity? and b) is this the correct sequence or do I miss something?
-
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
I have read somewhere in the mcforge wiki that world.isRemote in the last mc version will always return true and that now the correct way to do things would be Side.CLIENT == FMLCommonHandler.instance().getEffectiveSide() or Side.SERVER == FMLCommonHandler.instance().getEffectiveSide() ... but back to my problem (which hopefully shortly will be solved ). Should I do everything for example in the onLivingUpdate(...) method of my mob Entity only in the case of Side.SERVER == FMLCommonHandler.instance().getEffectiveSide()? Then the server will notify the client about the outcome? I also 'found' the IEntityAdditionalSpawnData interface, with this I'm able to initialise the entities created by the simple constructor with the data otherwise only initialised correctly by the second constructor. -
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
another day, another idea I've just been reading in the SMP style guides. And there it is mentioned that "Any Inventory/Container is stored both client and serverside" ... my mobs have an inventory. could it be that's why the entity is persistently been created on both sides, even by the spawn eggs? Edit: just after writing this and hitting the post button it came to my mind this can not be the cause of all the troubles ... I have two different entity types, one has an inventory, the other has not ... and the inventory is only added in an class branch where they have already separated ... so I'm back to space 0 in finding what's causing all this ... -
[solved] Double Entity Spawning Problem ...
Torojima replied to Torojima's topic in General Discussion
I have changed my spawning method like this: so the hole shebang should only be called if the client is calling the method, correct? But still there are two entities. I have forced an error in the EntityChicobo(World world) constructor (null pointer exception by trying to invoke a method on a not initialised field) to get a call stack and I got this: so, it is indeed one entity on the server and one on the client ... since I'm not calling the spawn if it's the remote side ... I must be doing something essentially wrong in registering the entity, since the call of the entity constructor is done from a point I have no direct access to ... ... so what could be me error??? or better, is there a detailed explanation somewhere on how to register an entity with forge? Edit: btw, now that I have omited the spawn if on the server side I only can see one mob (the one just standing there is gone) but still the effect with the GUI opening twice and the debug output from the constructor printed twice is still happening ... Edit2: and one more thing ... when using the minecraft own spawnEggs to spawn an entity, I still have the double GUI, double constructor debug output effect and there I can not influence the calls to the constructors ... Thus all the more I believe it's something I do wrong in registering ... should I maybe only use the entity from the server? how can I omit the constructor call from the client? Edit3: now after some experimenting with FMLCommonHandler.instance().getEffectiveSide(), I came to the conclusion, the unwanted twin is created by the client side... funny enough... How so? As above mentioned I have two constructors, one with additional parameters needed to create one of my entities, which are set to default values when calling the simple just world parameter constructor without the additional parameters. Now the first call of a constructor is the one intended by me in my spawn method and calling the constructor with additional parameters, creating a entity as requested. The second call is done by the client side and calling the simple constructor. So the question is what method is creating the shadow entity on the client side and why? Obviously, since the same is happening when an entity is spawned with the minecraft own spawnEggs, I can not prevent this by preventing calling the spawn method if called from the server side, since I have no access to the spawnEgg methods ... I'm at a complete loss here and desperately in need of some help ... Edit4 (and last for today, I'm going to sleep ): I've prevented the spawning first at the server side, then at the client side. But both results have been incomplete. If I prevent the server side spawn, the mob is not moving at all or reacting to player interaction. If I prevent the client side spawn, I can not see the mob (but hear it and see the debug outputs, so it is present ...). Thus I presume both are needed, but have to be synchronised somehow ... which I do not know how and where ... -
I have a very strange behaviour when spawning a new Entity. Situation: I have registered a few new entities in the init method of my mod base class like this: also I am registering the entity in my client proxy. now I'm trying to spawn an entity in a world with this code (method written for debugging and put into a click listener of one of my items) the entity class has two constructors Problem: but instead of just one friendly mob in the world, there are spawning two. One behaving normally, but with the default colour, so I believe the extra entity it's created by the standard EntityChicobo(World world) constructor. The spawn entity with the "correct" colour on the other hand is only standing still without any behaviour and not clickable, thus it looks like the entity itself is not registered correctly? Does anybody have any idea why I have two entities when I call the line world.spawnEntityInWorld(ec); only once. Also the debug output right in the next line is printed only once ... right now I have no Idea what to do and how I could fix this bug (or even what I have done wrong in the first place ...) I would appreciate every good idea and/or hint you guys could give me. Edit: changed the debug spawning method, like it is atm, had copied a test I've put in before ... Edit2: and there is another strange effect. I have a GUI for my mobs to control following behaviour and set names etc ... When I open the GUI for an entity I will get two GUI's one after each other for the same mob, but with two different data sets ...
-
difference between registerModEntity and registerGlobalEntityID
Torojima replied to Torojima's topic in Modder Support
is creating the following entries in the log file looks like Millenaire has similar effects ... (I'm running some other mods too, to see if I'll have no compatibility problems ... -
difference between registerModEntity and registerGlobalEntityID
Torojima replied to Torojima's topic in Modder Support
I have now tried the version with registerGlobalEntityID first and registerModEntity second and I'm receiving again a warning about double registration. So using both might not be the correct way to do things So I'll keep the registerGlobalEntityID and remove the registerModEntity (I would like to use the eggs for testing). The registerModEntity as a few other parameters trackingRange, updateFrequency and a boolean called sendsVelocityUpdates. Which I can not set when using the other register method. Could it be: one is for registering the entity in the client side methods (with the eggs) and one for the server side methods (with the updateFrequency etc...) <- wild guessing here -
difference between registerModEntity and registerGlobalEntityID
Torojima replied to Torojima's topic in Modder Support
I had done it the wrong way around then. First registerModEntity, then registerGlobalEntityID. As a result, the spawn egg's did not show and I had a warning in the ForgeModLoader client log Thus I presume if omited, EntityRegistry.registerModEntity will be called by the EntityRegistry.registerGlobalEntityID, since right now I'm doing exactly that and I have the respective spawnEggs and can spawn my entities. But if the explicit call of both methods in the correct order are the correct way, I'll of course do it like that, first the EntityRegistry.registerGlobalEntityID, then the EntityRegistry.registerModEntity. -
I'm just wondering if I'm watching the correct for the updated forge version. As soon as forge is updated it will be posted in the "Releases" Forum here on mincraftforge.net, correct?!