New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Entity Update #197
Entity Update #197
Conversation
LukBukkit
commented
Feb 13, 2016
- Fixed bug when saving villagers and wolves
- Living entities have now a real death animation
- Many living entities now send a metadata package
- If its possible the metadatas of the entities, were saved in the metadata list of the entity class.
- Entities now sending their health to the player
- Entities have now a correct max health
@@ -117,6 +117,8 @@ public void setScaleForAge(boolean isAdult) { | |||
return messages; | |||
} | |||
|
|||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to nitpick, is this diff necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorrry my IDE made this. It will be removed in the next commit!
-Fixed bug when saving villagers and wolves -Living entities have now a real death animation -Many living entities now send a metadata package -If its possible the metadatas of the entities, were saved in the metadata list of the entity class. -Entities now sending their health to the player -Entities have now a correct max health
- Sorted and add * imports - Removed unused update messages
@@ -27,7 +27,7 @@ | |||
/** | |||
* Creates a new ageable monster. | |||
* @param location The location of the monster. | |||
* @param type The type of monster. | |||
* @param type The type of monster. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary spacing.
I think GlowLivingEntity should have a new constructor for max health instead of using setmaxhealthandhealth. |
The max health is now set using the constructor
|
||
@Override | ||
public List<Message> createUpdateMessage() { | ||
return super.createUpdateMessage(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that is needless
Now, I think that there should be a EntityRegistry.instance.getMaxHealth(GlowWolf.class); I would be ok if you would not like to add it in this PR, as it slightly extends the scope of the PR. Of course, we wouldn't remove the constructor with max health even with |
@mastercoms I will do this in one of my next PR's. |
public void setTamed(boolean isTamed) { | ||
metadata.setBit(MetadataIndex.WOLF_FLAGS, TameableFlags.IS_TAME, isTamed); | ||
if (tamed != isTamed) { | ||
//Change max health of wolf when he's got tamed. See MinecraftWiki for more information! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a space between // and the comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will do this tomorrow.
Looks good to me. |
|
||
for (Objective objective: getServer().getScoreboardManager().getMainScoreboard().getObjectivesByCriteria(Criterias.HEALTH)) { | ||
for (Objective objective : getServer().getScoreboardManager().getMainScoreboard().getObjectivesByCriteria(Criterias.HEALTH)) { | ||
objective.getScore(this.getName()).setScore((int) health); | ||
} | ||
|
||
if (health == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Less than or equal to. Just in case.
There is an error when spawning ocelots:
And another when saving a world with an enderman:
And another save error for ocelot:
|
After these issues are fixed, I will test reading this saved data using the vanilla Minecraft server. |
I currently save nothing, I just send these packets. So I think the Minecraft server won't has got so much too read. If you want I can implement this today too. And I don't why the enderman isn't correctly this bug appears for me sometimes, but is works sometimes too. Then I'll try To fix it this afternoon. :) |
Ah, I thought with the save error, there was something being saved. I think saving has already been done in another commit, and this extra data on the entities is confusing it. |
The cat errors are partly mine, but I didn't edit anything realting the enderman. |
I fixed the error in connection with the cat, now I try to fix the enderman error. FIXED IT |
- Cleanup ( Added spaces after comments and changed two if queries ). - Removed useless createUpdateMessage. - Fixed Ocelot bug on saving and loading. - Added EndermanStore to EntityStorage. I don't know why it wasn't there. - Fixed Wolf bug on saving and loading. Wolves aren't ozelots.
isAwake in GlowBat can be stored in metadata? like isClimbing in GlowSpder |
Sorry I forgot this.
There is an error when loading a world with entities spawned in vanilla. I believe it is because your isPowered, isVillager, and etc should first check if the tag exists, and if it does not, return 0, or whatever and if it does exist, return the value of the tag. Here is the error (there were variations of this error for SkeletonType and IsVillager, so it should only be necessary to change those 3 getters, but I will trust your judgement on whether to change all of them or not):
Also, this error was thrown when loading a player built golem from the vanilla world:
I believe it uses a byte for some reason, 1 for true, and 0 for false. |
I check now, if a tag exits, before I store it into the entity metadata. When a tag doesn't exits I store a default value into the entity class.
Ups forgot to format code. Sorry, but the errors are should fixed now :) |
Type of playerbuilt for golem is still boolean, it should be byte. |
ah, ok |
Still getting the same error as before with the iron golem:
You're using MetaData.set, which checks for the type of the value you pass in, which in this case, you are passing byte. It detects that this type is wrong, and throws an error. |
Thank you for this awesome contribution! |
okey, so now ai 😄 |
Entities branch has some awful progress on that. |