Add 1.20.70 & 1.20.60 support + Fix crafting issue (#9)

This commit is contained in:
C. Pham
2025-04-05 04:43:37 -04:00
committed by GitHub
parent 6f8d6e922d
commit bcb3e990d3
24 changed files with 12442 additions and 127 deletions

View File

@@ -12,6 +12,8 @@ const (
ID686 = 686 // v1.21.2
ID685 = 685 // v1.21.0
ID671 = 671 // v1.20.80
ID662 = 662 // v1.20.70
ID649 = 649 // v1.20.60
)
func IsProtoGTE(io protocol.IO, proto int32) bool {

View File

@@ -808,9 +808,13 @@ func (a *CraftRecipeStackRequestAction) FromLatest(y *protocol.CraftRecipeStackR
}
func (a *CraftRecipeStackRequestAction) ToLatest() *protocol.CraftRecipeStackRequestAction {
numberOfCrafts := a.NumberOfCrafts
if numberOfCrafts == 0 {
numberOfCrafts = 1
}
return &protocol.CraftRecipeStackRequestAction{
RecipeNetworkID: a.RecipeNetworkID,
NumberOfCrafts: a.NumberOfCrafts,
NumberOfCrafts: numberOfCrafts,
}
}

View File

@@ -677,7 +677,9 @@ func marshalShaped(r protocol.IO, recipe *ShapedRecipe) {
r.UUID(&recipe.UUID)
r.String(&recipe.Block)
r.Varint32(&recipe.Priority)
r.Bool(&recipe.AssumeSymmetry)
if IsProtoGTE(r, ID671) {
r.Bool(&recipe.AssumeSymmetry)
}
if IsProtoGTE(r, ID685) {
protocol.Single(r, &recipe.UnlockRequirement)
}

View File

@@ -132,5 +132,7 @@ func (x *BehaviourPackInfo) Marshal(r protocol.IO) {
r.String(&x.SubPackName)
r.String(&x.ContentIdentity)
r.Bool(&x.HasScripts)
r.Bool(&x.AddonPack)
if IsProtoGTE(r, ID712) {
r.Bool(&x.AddonPack)
}
}