-
Notifications
You must be signed in to change notification settings - Fork 147
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
Smithing templates + Table and Armour Trims #861
Merged
+575
−14
Merged
Changes from 9 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ed35a72
implement smithing templates and working smithing tables
xNatsuri 580c65d
implement fully functional armour trims
xNatsuri b3718f7
Merge branch 'df-mc:master' into armor-trims
xNatsuri 993722c
not sure how this happened
xNatsuri 69ee288
item/recipe: Support smithing trims
TwistedAsylumMC 29f42b5
requested changes
xNatsuri 36fa025
update gophertunnel to 1.36.1
xNatsuri e526d73
fix build errors
xNatsuri f90879d
oops
xNatsuri f7d3636
changes
xNatsuri 6e14eb4
fixes crash (still does not make smithing recipes work)
xNatsuri 13932df
requested changes
xNatsuri 7c52121
Merge remote-tracking branch 'origin/master' into armor-trims
xNatsuri 1432933
merge conflict
xNatsuri 0383f85
Merge branch 'df-mc:master' into armor-trims
xNatsuri c3e9e96
dragonfly/server: Fix smithing trims and recipes
TwistedAsylumMC 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package item | ||
|
||
import "github.com/sandertv/gophertunnel/minecraft/text" | ||
|
||
// AmethystShard is a crystalline mineral obtained from mining a fully grown amethyst cluster. | ||
type AmethystShard struct{} | ||
|
||
// EncodeItem ... | ||
func (AmethystShard) EncodeItem() (name string, meta int16) { | ||
return "minecraft:amethyst_shard", 0 | ||
} | ||
|
||
// TrimMaterial ... | ||
func (AmethystShard) TrimMaterial() string { | ||
return "amethyst" | ||
} | ||
|
||
// MaterialColour ... | ||
func (AmethystShard) MaterialColour() string { | ||
return text.Amethyst | ||
} |
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,58 @@ | ||
package item | ||
|
||
import "github.com/df-mc/dragonfly/server/world" | ||
|
||
type ArmourTrim struct { | ||
Template ArmourSmithingTemplate | ||
Material ArmourTrimMaterial | ||
} | ||
|
||
type ArmourTrimMaterial interface { | ||
// TrimMaterial returns the material name used for reading and writing trim data. | ||
TrimMaterial() string | ||
// MaterialColour returns the color code used for internal text formatting. Use text.Colourf for proper formatting. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Change "color" to "colour", can probably remove the |
||
MaterialColour() string | ||
} | ||
|
||
// ArmourTrimMaterialFromString returns a TrimMaterial from a string. | ||
func ArmourTrimMaterialFromString(name string) ArmourTrimMaterial { | ||
switch name { | ||
case "amethyst": | ||
return AmethystShard{} | ||
case "copper": | ||
return CopperIngot{} | ||
case "diamond": | ||
return Diamond{} | ||
case "emerald": | ||
return Emerald{} | ||
case "gold": | ||
return GoldIngot{} | ||
case "iron": | ||
return IronIngot{} | ||
case "lapis": | ||
return LapisLazuli{} | ||
case "netherite": | ||
return NetheriteIngot{} | ||
case "quartz": | ||
return NetherQuartz{} | ||
} | ||
|
||
//TODO: add redstone material once pr is merged | ||
|
||
panic("should not happen") | ||
} | ||
|
||
// ArmourTrimMaterials returns all the items that can be trim materials. | ||
func ArmourTrimMaterials() []world.Item { | ||
return []world.Item{ | ||
AmethystShard{}, | ||
CopperIngot{}, | ||
Diamond{}, | ||
Emerald{}, | ||
GoldIngot{}, | ||
IronIngot{}, | ||
LapisLazuli{}, | ||
NetheriteIngot{}, | ||
NetherQuartz{}, | ||
} | ||
} |
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package item | ||
|
||
import "github.com/sandertv/gophertunnel/minecraft/text" | ||
|
||
// CopperIngot is a metal ingot melted from copper ore. | ||
type CopperIngot struct{} | ||
|
||
// EncodeItem ... | ||
func (c CopperIngot) EncodeItem() (name string, meta int16) { | ||
return "minecraft:copper_ingot", 0 | ||
} | ||
|
||
// TrimMaterial ... | ||
func (CopperIngot) TrimMaterial() string { | ||
return "copper" | ||
} | ||
|
||
// MaterialColour ... | ||
func (CopperIngot) MaterialColour() string { | ||
return text.Copper | ||
} |
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
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
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package item | ||
|
||
import "github.com/sandertv/gophertunnel/minecraft/text" | ||
|
||
// LapisLazuli is a mineral used for enchanting and decoration. | ||
type LapisLazuli struct{} | ||
|
||
// EncodeItem ... | ||
func (LapisLazuli) EncodeItem() (name string, meta int16) { | ||
return "minecraft:lapis_lazuli", 0 | ||
} | ||
|
||
// TrimMaterial ... | ||
func (LapisLazuli) TrimMaterial() string { | ||
return "lapis" | ||
} | ||
|
||
// MaterialColour ... | ||
func (LapisLazuli) MaterialColour() string { | ||
return text.Lapis | ||
} |
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 |
---|---|---|
@@ -1,9 +1,21 @@ | ||
package item | ||
|
||
import "github.com/sandertv/gophertunnel/minecraft/text" | ||
|
||
// NetherQuartz is a smooth, white mineral found in the Nether. | ||
type NetherQuartz struct{} | ||
|
||
// EncodeItem ... | ||
func (NetherQuartz) EncodeItem() (name string, meta int16) { | ||
return "minecraft:quartz", 0 | ||
} | ||
|
||
// TrimMaterial ... | ||
func (NetherQuartz) TrimMaterial() string { | ||
return "quartz" | ||
} | ||
|
||
// MaterialColour ... | ||
func (NetherQuartz) MaterialColour() string { | ||
return text.Quartz | ||
} |
Oops, something went wrong.
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.
writes the ...?