43 lines
1.9 KiB
Go
43 lines
1.9 KiB
Go
package legacypacket
|
|
|
|
import (
|
|
"github.com/akmalfairuz/legacy-version/legacyver/proto"
|
|
"github.com/sandertv/gophertunnel/minecraft/protocol"
|
|
"github.com/sandertv/gophertunnel/minecraft/protocol/packet"
|
|
)
|
|
|
|
// CraftingData is sent by the server to let the client know all crafting data that the server maintains. This
|
|
// includes shapeless crafting, crafting table recipes, furnace recipes etc. Each crafting station's recipes
|
|
// are included in it.
|
|
type CraftingData struct {
|
|
// Recipes is a list of all recipes available on the server. It includes among others shapeless, shaped
|
|
// and furnace recipes. The client will only be able to craft these recipes.
|
|
Recipes []proto.Recipe
|
|
// PotionRecipes is a list of all potion mixing recipes which may be used in the brewing stand.
|
|
PotionRecipes []protocol.PotionRecipe
|
|
// PotionContainerChangeRecipes is a list of all recipes to convert a potion from one type to another,
|
|
// such as from a drinkable potion to a splash potion, or from a splash potion to a lingering potion.
|
|
PotionContainerChangeRecipes []protocol.PotionContainerChangeRecipe
|
|
// MaterialReducers is a list of all material reducers which is used in education edition chemistry.
|
|
MaterialReducers []protocol.MaterialReducer
|
|
// ClearRecipes indicates if all recipes currently active on the client should be cleaned. Doing this
|
|
// means that the client will have no recipes active by itself: Any CraftingData packets previously sent
|
|
// will also be discarded, and only the recipes in this CraftingData packet will be used.
|
|
ClearRecipes bool
|
|
}
|
|
|
|
// ID ...
|
|
func (*CraftingData) ID() uint32 {
|
|
return packet.IDCraftingData
|
|
}
|
|
|
|
func (pk *CraftingData) Marshal(io protocol.IO) {
|
|
protocol.FuncSlice(io, &pk.Recipes, func(p *proto.Recipe) {
|
|
proto.IORecipe(io, p)
|
|
})
|
|
protocol.Slice(io, &pk.PotionRecipes)
|
|
protocol.Slice(io, &pk.PotionContainerChangeRecipes)
|
|
protocol.FuncSlice(io, &pk.MaterialReducers, io.MaterialReducer)
|
|
io.Bool(&pk.ClearRecipes)
|
|
}
|