Skip to content
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

Implemented redstone #739

Draft
wants to merge 94 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
5718d14
block: Start of a redstone implementation
TwistedAsylumMC Jul 28, 2022
a0f3b30
main.go: Use entity.DirectionVector()
TwistedAsylumMC Jul 28, 2022
1885828
Merge branch 'master' into feature/redstone
TwistedAsylumMC Jul 29, 2022
0261190
block/redstone_dust.go: Various improvements.
JustTalDevelops Jul 30, 2022
9d95a78
block/redstone_dust.go: Allow any side on the Y axis.
JustTalDevelops Jul 30, 2022
f0d95ec
block/redstone_dust.go: Removed redundant check.
JustTalDevelops Jul 30, 2022
ab2ac47
block/redstone_dust.go: Various improvements.
JustTalDevelops Jul 30, 2022
2858c6b
Merge branch 'master' into feature/redstone
JustTalDevelops Jan 16, 2023
1aee785
block/redstone_dust.go: Fix disabled emitters check.
JustTalDevelops Jan 16, 2023
9004e99
block/redstone.go: Started implementation of non-locational redstone …
JustTalDevelops Jan 17, 2023
bfa7190
block/redstone_wire.go: Various fixes.
JustTalDevelops Jan 17, 2023
62c6840
block/redstone_wire.go: Avoid unnecessary block updates.
JustTalDevelops Jan 17, 2023
d1f2c6a
block/redstone_lamp.go: type lol
JustTalDevelops Jan 17, 2023
e480b61
block/redstone_wire.go: Also update surrounding redstone on break.
JustTalDevelops Jan 17, 2023
8357d63
block/redstone_wire.go: And on place!
JustTalDevelops Jan 17, 2023
5f33b8a
block: Documented redstone related components.
JustTalDevelops Jan 17, 2023
849ecb0
block/redstone_torch.go: broken redstone torch implementation lol
JustTalDevelops Jan 18, 2023
2d8f704
block/redstone_torch.go: dont invert facing
JustTalDevelops Jan 18, 2023
eb00f59
block/redstone_torch.go: power output kinda fixed?
JustTalDevelops Jan 18, 2023
3bc6524
block/redstone_torch.go: i think it works (mostly)
JustTalDevelops Jan 18, 2023
93a369b
block/redstone_torch.go: Add a TODO for burnout.
JustTalDevelops Jan 18, 2023
6a670c0
block/redstone_repeater.go: repeaters... kinda
JustTalDevelops Jan 19, 2023
0d2643f
block/redstone_repeater.go: oops
JustTalDevelops Jan 19, 2023
3bac09d
block/redstone_repeater.go: oops v3
JustTalDevelops Jan 19, 2023
d1e18f2
block/redstone.go: ok it actually works !!
JustTalDevelops Jan 19, 2023
88ad785
block/redstone.go: Use the correct update order + pass correct face i…
JustTalDevelops Jan 19, 2023
89decae
block/redstone_wire.go: Implement RedstoneUpdater.
JustTalDevelops Jan 19, 2023
e85fc68
block: Various improvements to redstone, also implemented nonfunction…
JustTalDevelops Jan 20, 2023
f163f7a
block: removed unused var
DaPigGuy Jan 20, 2023
b41f4d5
main.go: Run a pprof HTTP server.
JustTalDevelops Jan 20, 2023
72c3562
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Jan 20, 2023
eb8bdfa
block/redstone_repeater.go: somewhat fix jittering?
JustTalDevelops Jan 20, 2023
c039fd2
block/redstone.go: i think this is it?
JustTalDevelops Jan 20, 2023
44e1793
block/redstone.go: revert tests
JustTalDevelops Jan 20, 2023
acaf073
block/redstone.go: reee
JustTalDevelops Jan 20, 2023
d21b424
world/world.go: Use an orderedmap for scheduled updates.
JustTalDevelops Jan 21, 2023
6e443d0
world/tick.go: Undo ordered scheduled block updates + incrementally r…
JustTalDevelops Jan 21, 2023
7e2a060
block/redstone_repeater.go: Fix repeater clocks!
JustTalDevelops Jan 21, 2023
770895c
block/lever.go: implement basic lever block
DaPigGuy Jan 21, 2023
b187fea
block/redstone_repeater.go: fixed block placement on delay changing
DaPigGuy Jan 21, 2023
88d2d24
block/tnt.go: ignite on redstone power
DaPigGuy Jan 21, 2023
3686f0a
block/tnt.go: ignite on place if redstone powered
DaPigGuy Jan 21, 2023
c3eb15c
block: uhhh pistons
JustTalDevelops Jan 31, 2023
08797ba
block/piston_resolver.go: piston resolvers kill me
JustTalDevelops Feb 1, 2023
42dde29
block/piston.go: pushing somewhat
JustTalDevelops Feb 1, 2023
d6c3189
block/piston.go: pulling but it's still really broken lmao
JustTalDevelops Feb 1, 2023
6721636
block/lever.go: fixes
DaPigGuy Feb 1, 2023
58c1480
block/piston.go: reee
JustTalDevelops Feb 1, 2023
0eba580
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Feb 1, 2023
c555828
block/piston.go: Various fixes to pushing and pulling.
JustTalDevelops Feb 1, 2023
61a40ba
block/piston_resolver.go: fix sorting!
JustTalDevelops Feb 1, 2023
f4f0f97
block: Update neighbouring redstone on dependent break.
JustTalDevelops Feb 2, 2023
791dc22
world/world.go: Account for transparent blocks.
JustTalDevelops Feb 2, 2023
7a7cd24
block/redstone_wire.go: Various fixes!
JustTalDevelops Feb 2, 2023
b29f602
block/piston.go: Trigger redstone update on placement.
JustTalDevelops Feb 2, 2023
6ce58b4
block/piston.go: Extending and retracting sounds.
JustTalDevelops Feb 2, 2023
3b97acd
block/lever.go: Sounds!
JustTalDevelops Feb 2, 2023
8dce816
block/piston_resolver.go: Various fixes.
JustTalDevelops Feb 2, 2023
152ddc0
Merge branch 'master' into feature/redstone
JustTalDevelops Feb 2, 2023
3c2f65f
block/button.go: more redstone inputs!
DaPigGuy Feb 2, 2023
f81006f
block/button_type.go: don't export wood type
DaPigGuy Feb 2, 2023
b6f1d0b
block/button.go: add sounds
DaPigGuy Feb 2, 2023
2dcfaec
block: Made repeaters and beacons waterloggable.
JustTalDevelops Feb 2, 2023
d1d2a16
block/jukebox.go: output redstone power with disc inserted
DaPigGuy Feb 2, 2023
a0d764f
block: Made pistons waterloggable.
JustTalDevelops Feb 2, 2023
99433a5
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Feb 2, 2023
517046d
block/jukebox.go: update redstone power on break
DaPigGuy Feb 2, 2023
87779b6
block/observer.go: implement observers
DaPigGuy Feb 2, 2023
47a32f6
block/observer.go: "fix" Y-axis facing observer placement
DaPigGuy Feb 2, 2023
4311b8e
block: Added slime.
JustTalDevelops Feb 2, 2023
ddff350
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Feb 2, 2023
89e9cfb
block/redstone.go: prevent CI failure
DaPigGuy Feb 2, 2023
1d0043f
world/world.go: Pass block state to ScheduleBlockUpdate.
JustTalDevelops Feb 3, 2023
feee4f0
block/piston_resolver.go: Glazed terracotta can't be pulled.
JustTalDevelops Feb 3, 2023
5306c25
world: Remove commented code.
JustTalDevelops Feb 3, 2023
5991930
block/redstone.go: Implemented a RedstoneBlocking interface.
JustTalDevelops Feb 3, 2023
a960f80
block/redstone.go: Implemented a PistonUpdater interface.
JustTalDevelops Feb 3, 2023
9dd470d
world/world.go: Reverted scheduled update changes.
JustTalDevelops Feb 3, 2023
9905a68
block: Implemented droppers.
JustTalDevelops Feb 4, 2023
4c08c32
block/dropper.go: Simplified logic.
JustTalDevelops Feb 4, 2023
f6e1612
block/dropper.go: Various fixes.
JustTalDevelops Feb 4, 2023
8c4c7c2
Merge branch 'master' into feature/redstone
JustTalDevelops Feb 4, 2023
6eae8f7
go.mod, go.sum: Updated dependencies.
JustTalDevelops Feb 4, 2023
786d38c
block/jukebox.go: cleanup
DaPigGuy Feb 4, 2023
0ad69b3
block/dropper.go: Revert changes.
JustTalDevelops Feb 4, 2023
6d88883
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Feb 4, 2023
2186d15
block: Implemented (non-functional, for now) hoppers.
JustTalDevelops Feb 4, 2023
f373a25
Merge branch 'master' into feature/redstone
JustTalDevelops Feb 5, 2023
95a1254
block/dropper.go: Dispense particles.
JustTalDevelops Feb 5, 2023
86b7414
Merge remote-tracking branch 'origin/feature/redstone' into feature/r…
JustTalDevelops Feb 5, 2023
37448db
block/hopper.go: Item extraction.
JustTalDevelops Feb 5, 2023
a5274d9
block/hopper.go: Abstracted custom extractables into their own interf…
JustTalDevelops Feb 5, 2023
05c4c09
block/hopper.go: Item entity extraction.
JustTalDevelops Feb 5, 2023
a2ac369
block/hopper.go: Waterlogging.
JustTalDevelops Feb 5, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/blockhash/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,8 @@ func (b *hashBuilder) ftype(structName, s string, expr ast.Expr, directives map[
return "uint64(" + s + ")", 8
case "Block":
return s + ".Hash()", 16
case "ButtonType":
return "uint64(" + s + ".Uint8())", 6
case "Attachment":
if _, ok := directives["facing_only"]; ok {
log.Println("Found directive: 'facing_only'")
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ require (
github.com/google/uuid v1.3.0
github.com/pelletier/go-toml v1.9.4
github.com/rogpeppe/go-internal v1.3.0
github.com/sandertv/gophertunnel v1.26.0
github.com/sirupsen/logrus v1.8.1
github.com/sandertv/gophertunnel v1.26.1
github.com/sirupsen/logrus v1.9.0
go.uber.org/atomic v1.9.0
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75
golang.org/x/text v0.3.7
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9
golang.org/x/text v0.6.0
)

require (
Expand All @@ -24,15 +24,14 @@ require (
github.com/klauspost/compress v1.15.1 // indirect
github.com/muhammadmuzzammil1998/jsonc v1.0.0 // indirect
github.com/sandertv/go-raknet v1.12.0 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/stretchr/testify v1.8.1 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a // indirect
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 // indirect
golang.org/x/image v0.3.0 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5 // indirect
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f // indirect
golang.org/x/sys v0.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
39 changes: 36 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,29 @@ github.com/sandertv/go-raknet v1.12.0 h1:olUzZlIJyX/pgj/mrsLCZYjKLNDsYiWdvQ4NIm3
github.com/sandertv/go-raknet v1.12.0/go.mod h1:Gx+WgZBMQ0V2UoouGoJ8Wj6CDrMBQ4SB2F/ggpl5/+Y=
github.com/sandertv/gophertunnel v1.26.0 h1:6wCDkCh6j6t8wh0G+3U4X1KNVJtrmlj7yI58LuCh720=
github.com/sandertv/gophertunnel v1.26.0/go.mod h1:dYFetA6r62huhc1EgR9p8VFAFtKOuGgVE/iXf5CzZ4o=
github.com/sandertv/gophertunnel v1.26.1 h1:5RAxqb++D5mMN2aZyuLZSFHvMKF0l77zvTsKSg+BS1M=
github.com/sandertv/gophertunnel v1.26.1/go.mod h1:dYFetA6r62huhc1EgR9p8VFAFtKOuGgVE/iXf5CzZ4o=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72 h1:qLC7fQah7D6K1B0ujays3HV9gkFtllcxhzImRR7ArPQ=
github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
Expand All @@ -174,6 +184,7 @@ golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand All @@ -188,11 +199,15 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75 h1:x03zeu7B2B11ySp+daztnwM5oBJ/8wGUSqrwcw9L0RA=
golang.org/x/exp v0.0.0-20220713135740-79cabaa25d75/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9 h1:frX3nT9RkKybPnjyI+yvZh6ZucTZatCCEm9D47sZ2zo=
golang.org/x/exp v0.0.0-20230203172020-98cc5a0785f9/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190321063152-3fc05d484e9f/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a h1:LnH9RNcpPv5Kzi15lXg42lYMPUf0x8CuPv1YnvBWZAg=
golang.org/x/image v0.0.0-20220321031419-a8550c1d254a/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.3.0 h1:HTDXbdK9bjfSWkPzDJIw89W8CAtfFGduujWs33NLLsg=
golang.org/x/image v0.3.0/go.mod h1:fXd9211C/0VTlYuAcOhW8dY/RtEJqODXOWBDpmYBf+A=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand All @@ -211,6 +226,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB
golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
Expand Down Expand Up @@ -238,9 +254,13 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2 h1:6mzvA99KwZxbOrxww4EvWVQUnN1+xEu9tafK5ZxkYeA=
golang.org/x/net v0.0.0-20220418201149-a630d4f3e7a2/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand All @@ -256,6 +276,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -283,10 +304,17 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f h1:rlezHXNlxYWvBCzNses9Dlc7nGFaNMJeqLolcmQSSZY=
golang.org/x/sys v0.0.0-20220330033206-e17cdc41300f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -296,6 +324,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -339,6 +369,7 @@ golang.org/x/tools v0.0.0-20200618134242-20370b0cb4b2/go.mod h1:EkVYQZoAsY45+roY
golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -422,6 +453,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
Expand All @@ -436,8 +469,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
Expand Down
14 changes: 13 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,23 @@ package main
import (
"fmt"
"github.com/df-mc/dragonfly/server"
"github.com/df-mc/dragonfly/server/player"
"github.com/df-mc/dragonfly/server/player/chat"
"github.com/pelletier/go-toml"
"github.com/sirupsen/logrus"
"net/http"
_ "net/http/pprof"
"os"
)

func main() {
go func() {
err := http.ListenAndServe(":6060", nil)
if err != nil {
panic(err)
}
}()

log := logrus.New()
log.Formatter = &logrus.TextFormatter{ForceColors: true}
log.Level = logrus.DebugLevel
Expand All @@ -25,7 +35,9 @@ func main() {
srv.CloseOnProgramEnd()

srv.Listen()
for srv.Accept(nil) {
for srv.Accept(func(p *player.Player) {
p.ShowCoordinates()
}) {
}
}

Expand Down
5 changes: 5 additions & 0 deletions server/block/banner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ func (Banner) MaxCount() int {
return 16
}

// PistonBreakable ...
func (Banner) PistonBreakable() bool {
return true
}

// BreakInfo ...
func (b Banner) BreakInfo() BreakInfo {
return newBreakInfo(1, alwaysHarvestable, axeEffective, oneOf(b))
Expand Down
2 changes: 1 addition & 1 deletion server/block/barrel.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ func (b Barrel) UseOnBlock(pos cube.Pos, face cube.Face, _ mgl64.Vec3, w *world.
}
//noinspection GoAssignmentToReceiver
b = NewBarrel()
b.Facing = calculateFace(user, pos)
b.Facing = calculateAnySidedFace(user, pos, true)

place(w, pos, b, user, ctx)
return placed(ctx)
Expand Down
5 changes: 5 additions & 0 deletions server/block/barrier.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ func (Barrier) SideClosed(cube.Pos, cube.Pos, *world.World) bool {
return false
}

// PistonImmovable ...
func (Barrier) PistonImmovable() bool {
return true
}

// EncodeItem ...
func (Barrier) EncodeItem() (name string, meta int16) {
return "minecraft:barrier", 0
Expand Down
7 changes: 6 additions & 1 deletion server/block/beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (b Beacon) EncodeNBT() map[string]any {
}

// SideClosed ...
func (b Beacon) SideClosed(cube.Pos, cube.Pos, *world.World) bool {
func (Beacon) SideClosed(cube.Pos, cube.Pos, *world.World) bool {
return false
}

Expand All @@ -84,6 +84,11 @@ func (Beacon) LightEmissionLevel() uint8 {
return 15
}

// PistonImmovable ...
func (Beacon) PistonImmovable() bool {
return true
}

// Level returns an integer 0-4 which defines the current pyramid level of the beacon.
func (b Beacon) Level() int {
return b.level
Expand Down
5 changes: 5 additions & 0 deletions server/block/bedrock.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ func (Bedrock) EncodeItem() (name string, meta int16) {
return "minecraft:bedrock", 0
}

// PistonImmovable ...
func (Bedrock) PistonImmovable() bool {
return true
}

// EncodeBlock ...
func (b Bedrock) EncodeBlock() (name string, properties map[string]any) {
//noinspection SpellCheckingInspection
Expand Down
11 changes: 9 additions & 2 deletions server/block/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ type Frictional interface {
Friction() float64
}

func calculateFace(user item.User, placePos cube.Pos) cube.Face {
// unknownFace is a face that is used for certain block items. This should not be exposed in the API.
var unknownFace = cube.Face(len(cube.Faces()))

func calculateAnySidedFace(user item.User, placePos cube.Pos, swapHorizontal bool) cube.Face {
userPos := user.Position()
pos := cube.PosFromVec3(userPos)
if abs(pos[0]-placePos[0]) < 2 && abs(pos[2]-placePos[2]) < 2 {
Expand All @@ -95,7 +98,11 @@ func calculateFace(user item.User, placePos cube.Pos) cube.Face {
return cube.FaceDown
}
}
return user.Rotation().Direction().Opposite().Face()
face := user.Rotation().Direction().Face()
if swapHorizontal {
face = face.Opposite()
}
return face
}

func abs(x int) int {
Expand Down
Loading