Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upNether Portal Jumping & Creation Code #2162
Conversation
referenced
this pull request
May 29, 2015
worktycho
reviewed
May 29, 2015
madmaxoft
reviewed
May 29, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
madmaxoft
May 29, 2015
Member
Please try to use the same coding style. We use a space after all commas, and a space around pointer and reference declarations (cWorld * a_World etc.) There's too many of these to report each one. Unfortunately the basic stylechecking script cannot detect these reliably, so you'll need to do it by hand.
|
Please try to use the same coding style. We use a space after all commas, and a space around pointer and reference declarations ( |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Okay, I'll go back through as I move it to a new file. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
May 30, 2015
Contributor
Okay, I think I got it compliant with the coding convention in bad47a8, except maybe local variable names, I don't know what the convention is for those. I didn't see any commas without spaces, though, so I'm probably looking at the wrong commas?
|
Okay, I think I got it compliant with the coding convention in bad47a8, except maybe local variable names, I don't know what the convention is for those. I didn't see any commas without spaces, though, so I'm probably looking at the wrong commas? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
May 30, 2015
Contributor
What's the preferred way to convert between Vector types, e.g. from Vector3i to a Vector3d?
|
What's the preferred way to convert between Vector types, e.g. from Vector3i to a Vector3d? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
madmaxoft
May 31, 2015
Member
I don't think there's any preference. There's a simple copy-constructor provided within the vector template, and for converting to a Vector3i there's also the Floor() function defined on the class (Ceil() is missing right now, but could be added with minimal effort).
|
I don't think there's any preference. There's a simple copy-constructor provided within the vector template, and for converting to a |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Okay. I think I've fixed the convention errors. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
Jun 6, 2015
Contributor
Alright, I just refactored m_Dir to use a Direction type which is either X or Y (I considered NORTH_SOUTH and EAST_WEST, but that didn't seem to map to the code as well).
|
Alright, I just refactored m_Dir to use a Direction type which is either X or Y (I considered NORTH_SOUTH and EAST_WEST, but that didn't seem to map to the code as well). |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
madmaxoft
Jun 8, 2015
Member
Is there any chance you could get this rebased onto current master and squashed into a single commit?
|
Is there any chance you could get this rebased onto current master and squashed into a single commit? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Sure thing. Done. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
I think this is merge-worthy. Opinions? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 9, 2015
Member
Apart from the question I have about the m_IsWorldChangeScheduled initialization it looks really good.
|
Apart from the question I have about the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ghost
commented
Jun 9, 2015
|
Please add yourself to the contributors file. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Looks like it's ready for merge |
added a commit
that referenced
this pull request
Jun 10, 2015
madmaxoft
merged commit d436a71
into
cuberite:master
Jun 10, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
After almost a month I finally updated my MCServer and tried this, and I noticed that when teleporting to an portal I get teleported 1 block next to it. That probably isn't intended right? You're supposed to teleport in another portal.
EDIT:
I also noticed that if I create a portal on the top of the nether, go through it, and then go back in the portal I get teleported to the top of the nether. Vanilla doesn't allow this to happen.
|
After almost a month I finally updated my MCServer and tried this, and I noticed that when teleporting to an portal I get teleported 1 block next to it. That probably isn't intended right? You're supposed to teleport in another portal. EDIT: |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sphinxc0re
Jun 13, 2015
Contributor
Also, you get teleported instantly but I think this is another issue
|
Also, you get teleported instantly but I think this is another issue |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
That's only in creative gamemode right? Because in vanilla you also get teleported instantly in creative mode.
|
That's only in creative gamemode right? Because in vanilla you also get teleported instantly in creative mode. |
NiLSPACE
reviewed
Jun 13, 2015
| m_World->GetChunkBlockTypes(a_ChunkX, a_ChunkZ, blocks); | ||
| // Iterate through all of the blocks in the chunk | ||
| for (unsigned int i = 0; i < cChunkDef::NumBlocks; i++) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
Looking at this again, shouldn't this be i += 2 as suggested by @madmaxoft here? It would speed up the search for a nether portal by quite allot since it wouldn't have to check every block in the chunk.
NiLSPACE
Jun 13, 2015
Member
Looking at this again, shouldn't this be i += 2 as suggested by @madmaxoft here? It would speed up the search for a nether portal by quite allot since it wouldn't have to check every block in the chunk.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
Jun 13, 2015
Contributor
Because of the way the chunks are stored (XZY?), doing i+2 here would result in a pattern that skips every other row. Note that it's iterating from 0 to NumBlocks, not 0 to 16 each axis - this results in a speedup in not having to call CoordinateToIndex.
lkolbly
Jun 13, 2015
Contributor
Because of the way the chunks are stored (XZY?), doing i+2 here would result in a pattern that skips every other row. Note that it's iterating from 0 to NumBlocks, not 0 to 16 each axis - this results in a speedup in not having to call CoordinateToIndex.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
madmaxoft
Jun 13, 2015
Member
It would have been possible to have two loops, the inner one iterating over the 256 blocks in a single Y slice, and the outer one iterating over Y slices, skipping 2 slices out of each 3:
for (unsigned y = 0; y < cChunkDef::Height; y += 3)
{
unsigned BaseY = cChunkDef::Width * cChunkDef::Width * y;
for (unsigned i = 0; i < 256; i++)
{
// Check block at index [BaseY + i]
}
}
madmaxoft
Jun 13, 2015
Member
It would have been possible to have two loops, the inner one iterating over the 256 blocks in a single Y slice, and the outer one iterating over Y slices, skipping 2 slices out of each 3:
for (unsigned y = 0; y < cChunkDef::Height; y += 3)
{
unsigned BaseY = cChunkDef::Width * cChunkDef::Width * y;
for (unsigned i = 0; i < 256; i++)
{
// Check block at index [BaseY + i]
}
}
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ghost
Jun 13, 2015
I tested this, I can not get back to the world from the nether trough the portal. Used the FAQ for creating a nether world.
ghost
commented
Jun 13, 2015
|
I tested this, I can not get back to the world from the nether trough the portal. Used the FAQ for creating a nether world. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
That's probably because you haven't configured the world linking in the world.ini. The FAQ only describes how you can generate such a world.
|
That's probably because you haven't configured the world linking in the world.ini. The FAQ only describes how you can generate such a world. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
sphinxc0re
Jun 13, 2015
Contributor
Yes, this is a problem. You have to stand right in the portal to teleport. in vanilla you only need partial contact with the portal.
Also, you are getting damage for travelling to the nether
|
Yes, this is a problem. You have to stand right in the portal to teleport. in vanilla you only need partial contact with the portal. Also, you are getting damage for travelling to the nether |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
tigerw
Jun 13, 2015
Member
Yes, this is a problem. You have to stand right in the portal to teleport. in vanilla you only need partial contact with the portal.
This is to do with lack of bounding box detection in MCS at the present.
This is to do with lack of bounding box detection in MCS at the present. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
Jun 13, 2015
Contributor
... and I noticed that when teleporting to an portal I get teleported 1 block next to it.
That was intended, but can be changed easily.
That was intended, but can be changed easily. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
I think it should be changed, because I got teleported in the portal frame once. It could also be possible to be teleported inside a wall if the portal is next to it.
|
I think it should be changed, because I got teleported in the portal frame once. It could also be possible to be teleported inside a wall if the portal is next to it. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
Jun 13, 2015
Contributor
I'm not sure you can since it places the portal in a 3x4x5 empty space, so there's always air on either side of the portal. But I can change it anyway.
|
I'm not sure you can since it places the portal in a 3x4x5 empty space, so there's always air on either side of the portal. But I can change it anyway. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
NiLSPACE
Jun 13, 2015
Member
But if I build a portal against a wall then there isn't an empty space around it. ^^
|
But if I build a portal against a wall then there isn't an empty space around it. ^^ |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lkolbly
Jun 13, 2015
Contributor
Oh, that's true. I hadn't thought about manually created portals. I will change that & the Y limit and make a PR after #2237 is closed. Having multiple forks is so much effort.
|
Oh, that's true. I hadn't thought about manually created portals. I will change that & the Y limit and make a PR after #2237 is closed. Having multiple forks is so much effort. |
lkolbly commentedMay 29, 2015
Per #1856, this code implements a portal scanner which finds and creates nether portals when entities move between the overworld and the nether.
It also changes dae9e57#diff-97bcf8a96a22aec81982926aa1462363R298 because StringToInteger returns true if the conversion was successful. I think.