-
Notifications
You must be signed in to change notification settings - Fork 144
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
Nether portals and mechanics #426
Open
JustTalDevelops
wants to merge
33
commits into
master
Choose a base branch
from
feature/nether-portals
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
646907e
Initial implementation of nether portals (WIP)
JustTalDevelops 78f1ade
block/portal.go: Simply portal deactivation on neighbour change.
JustTalDevelops f777865
player/player.go: Make Travel exported.
JustTalDevelops 694f4c2
world/world.go: Moved Place checks to the PlaceBlock function.
JustTalDevelops 5b72308
block/portal.go: Fix destroying a frame not destroying all frames.
JustTalDevelops d6e58bd
player/player.go: Default the portal timeout to true.
JustTalDevelops 50b9b73
player/player.go: Don't request a new transfer during a transfer if t…
JustTalDevelops bed9456
block/portal.go: Destroy portals when water flows into a frame.
JustTalDevelops 5577268
portal/scan.go: Allow portals that don't specify requirements to be m…
JustTalDevelops 656a992
portal/scan.go: Fix completion check.
JustTalDevelops 69c1c07
player/player.go: Ensure the position is only translated if the sourc…
JustTalDevelops 8711c67
portal/scan.go: Simplify logic.
JustTalDevelops 38c3928
Revert "portal/scan.go: Simplify logic."
JustTalDevelops fc2cf59
Fix multi-axis scan logic
JustTalDevelops ade7b4d
Detect portal collision using their block models
JustTalDevelops cdc901c
player/player.go: Fix typo.
JustTalDevelops 95bc01e
portal/nether.go: Fixed intersecting portals.
JustTalDevelops 7a76d60
model/portal.go: Fix missing zero before decimal point.
JustTalDevelops eedec39
Allow fire blocks to be overridden by portal ignition
JustTalDevelops fca683d
Implement TravelComputers for other entities that can travel through …
JustTalDevelops 8538faf
entity/travel.go: Slightly increase AABB growth.
JustTalDevelops 51f7e36
Use the *world.World provided in Tick.
JustTalDevelops 4431fa3
entity/travel.go: Only grow AABB after the BlocksAround call
JustTalDevelops 479d6b6
Merge remote-tracking branch 'origin/master' into feature/nether-portals
JustTalDevelops d8d8f3a
block/portal.go: Fix typo.
JustTalDevelops b45deae
Remove world.Entity as an Instantaneous parameter
JustTalDevelops b431bd7
Undo unnecessary ordering
JustTalDevelops 3bb09b0
entity/travel.go: Update Traveller doc.
JustTalDevelops 611f4aa
Use an interface to detect a portal collision
JustTalDevelops 8223c9c
Merge branch 'master' into feature/nether-portals
JustTalDevelops 5e3b773
portal/nether.go: Various fixes.
JustTalDevelops 0295a6f
Merge branch 'master' into feature/nether-portals
JustTalDevelops cfc74d7
entity/travel.go: Various improvements.
JustTalDevelops File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package model | ||
|
||
import ( | ||
"github.com/df-mc/dragonfly/server/block/cube" | ||
"github.com/df-mc/dragonfly/server/entity/physics" | ||
"github.com/df-mc/dragonfly/server/world" | ||
"github.com/go-gl/mathgl/mgl64" | ||
) | ||
|
||
// Portal is a model used by portal blocks. | ||
type Portal struct { | ||
// Axis is the axis which the portal faces. | ||
Axis cube.Axis | ||
} | ||
|
||
// AABB ... | ||
func (p Portal) AABB(cube.Pos, *world.World) []physics.AABB { | ||
min, max := mgl64.Vec3{0, 0, 0.375}, mgl64.Vec3{1, 1, 0.25} | ||
if p.Axis == cube.Z { | ||
min[0], min[2], max[0], max[2] = 0.375, 0, 0.25, 1 | ||
} | ||
return []physics.AABB{physics.NewAABB(min, max)} | ||
} | ||
|
||
// FaceSolid ... | ||
func (Portal) FaceSolid(cube.Pos, cube.Face, *world.World) bool { | ||
return false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package block | ||
|
||
import ( | ||
"github.com/df-mc/dragonfly/server/block/cube" | ||
"github.com/df-mc/dragonfly/server/block/model" | ||
"github.com/df-mc/dragonfly/server/world" | ||
"github.com/df-mc/dragonfly/server/world/portal" | ||
) | ||
|
||
// Portal is the translucent part of the nether portal that teleports the player to and from the Nether. | ||
type Portal struct { | ||
transparent | ||
|
||
// Axis is the axis which the portal faces. | ||
Axis cube.Axis | ||
} | ||
|
||
// Model ... | ||
func (p Portal) Model() world.BlockModel { | ||
return model.Portal{Axis: p.Axis} | ||
} | ||
|
||
// EncodeBlock ... | ||
func (p Portal) EncodeBlock() (string, map[string]interface{}) { | ||
return "minecraft:portal", map[string]interface{}{"portal_axis": p.Axis.String()} | ||
} | ||
|
||
// HasLiquidDrops ... | ||
func (p Portal) HasLiquidDrops() bool { | ||
return false | ||
} | ||
|
||
// NeighbourUpdateTick ... | ||
func (p Portal) NeighbourUpdateTick(pos, _ cube.Pos, w *world.World) { | ||
if n, ok := portal.NetherPortalFromPos(w, pos); ok && (!n.Framed() || !n.Activated()) { | ||
n.Deactivate() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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'm not sure if this should return a non-empty AABB. Once we implement suffocation I imagine it'll use the AABB of the block to decide if an entity should suffocate, but this wouldn't work properly with that.
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.
Hmm, this would cause issues with the logic to check if the player is intersecting with a portal block though, no?
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.
Yes, it would. We might need to put the AABB for that somewhere else. Blocks like water have a zero AABB as well at the moment.
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.
Maybe models should have a function to tell whether the block is "solid" or not.
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.
Any idea if/how I should change this? I am a bit stuck here.
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.
@Sandertv
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.
Is this still a big issue, given suffocation is now implemented? Although I do think a function to tell if blocks are solid or not would be helpful, especially for MovementComputer-based entities.