Skip to content

Commit

Permalink
Implement 1.19.80 support (df-mc#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC authored May 3, 2023
1 parent 19eef88 commit 58e4d78
Showing 11 changed files with 19 additions and 42 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
@@ -7,12 +7,12 @@ require (
github.com/cespare/xxhash v1.1.0
github.com/df-mc/atomic v1.10.0
github.com/df-mc/goleveldb v1.1.9
github.com/df-mc/worldupgrader v1.0.3
github.com/df-mc/worldupgrader v1.0.6
github.com/go-gl/mathgl v1.0.0
github.com/google/uuid v1.3.0
github.com/pelletier/go-toml v1.9.5
github.com/rogpeppe/go-internal v1.9.0
github.com/sandertv/gophertunnel v1.28.2
github.com/sandertv/gophertunnel v1.29.0
github.com/sirupsen/logrus v1.9.0
go.uber.org/atomic v1.10.0
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
@@ -34,5 +34,4 @@ require (
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
)
13 changes: 6 additions & 7 deletions go.sum
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ github.com/df-mc/atomic v1.10.0 h1:0ZuxBKwR/hxcFGorKiHIp+hY7hgY+XBTzhCYD2NqSEg=
github.com/df-mc/atomic v1.10.0/go.mod h1:Gw9rf+rPIbydMjA329Jn4yjd/O2c/qusw3iNp4tFGSc=
github.com/df-mc/goleveldb v1.1.9 h1:ihdosZyy5jkQKrxucTQmN90jq/2lUwQnJZjIYIC/9YU=
github.com/df-mc/goleveldb v1.1.9/go.mod h1:+NHCup03Sci5q84APIA21z3iPZCuk6m6ABtg4nANCSk=
github.com/df-mc/worldupgrader v1.0.3 h1:3nbthy6vfSNQZdqHBR+E5Fh3mCeWmCwLtqrYDiPUG5I=
github.com/df-mc/worldupgrader v1.0.3/go.mod h1:6ybkJ/BV9b0XkcPzcLmvgT9Nv/xgBXdDQTmRhu7b8zQ=
github.com/df-mc/worldupgrader v1.0.6 h1:ZWsgitb2ebwdyAgynTso0JAKHrc7wNz8D4AldrhEayE=
github.com/df-mc/worldupgrader v1.0.6/go.mod h1:tsSOLTRm9mpG7VHvYpAjjZrkRHWmSbKZAm9bOLNnlDk=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/go-gl/mathgl v1.0.0 h1:t9DznWJlXxxjeeKLIdovCOVJQk/GzDEL7h/h+Ro2B68=
github.com/go-gl/mathgl v1.0.0/go.mod h1:yhpkQzEiH9yPyxDUGzkmgScbaBVlhC06qodikEM0ZwQ=
@@ -48,15 +48,15 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/sandertv/go-raknet v1.12.0 h1:olUzZlIJyX/pgj/mrsLCZYjKLNDsYiWdvQ4NIm3z0DA=
github.com/sandertv/go-raknet v1.12.0/go.mod h1:Gx+WgZBMQ0V2UoouGoJ8Wj6CDrMBQ4SB2F/ggpl5/+Y=
github.com/sandertv/gophertunnel v1.28.2 h1:VVxnN6W3u89ONbusiEnblFjVGHkWvae1t2nBP8hObeo=
github.com/sandertv/gophertunnel v1.28.2/go.mod h1:ekREo7U9TPHh86kbuPMaWA93NMyWsfVvP/iNT3XhAb8=
github.com/sandertv/gophertunnel v1.29.0 h1:P9pOrt1dVfrrDmyw/sUZ1kKWGHWPm7sI+hl2TEtefrE=
github.com/sandertv/gophertunnel v1.29.0/go.mod h1:ekREo7U9TPHh86kbuPMaWA93NMyWsfVvP/iNT3XhAb8=
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/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ=
go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0=
@@ -121,5 +121,4 @@ gopkg.in/yaml.v2 v2.2.1/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=
8 changes: 0 additions & 8 deletions server/block/log.go
Original file line number Diff line number Diff line change
@@ -72,10 +72,6 @@ func (l Log) Strip() (world.Block, bool) {
func (l Log) EncodeItem() (name string, meta int16) {
if !l.Stripped {
switch l.Wood {
case OakWood(), SpruceWood(), BirchWood(), JungleWood():
return "minecraft:log", int16(l.Wood.Uint8())
case AcaciaWood(), DarkOakWood():
return "minecraft:log2", int16(l.Wood.Uint8()) - 4
case CrimsonWood(), WarpedWood():
return "minecraft:" + l.Wood.String() + "_stem", 0
default:
@@ -94,10 +90,6 @@ func (l Log) EncodeItem() (name string, meta int16) {
func (l Log) EncodeBlock() (name string, properties map[string]any) {
if !l.Stripped {
switch l.Wood {
case OakWood(), SpruceWood(), BirchWood(), JungleWood():
return "minecraft:log", map[string]any{"pillar_axis": l.Axis.String(), "old_log_type": l.Wood.String()}
case AcaciaWood(), DarkOakWood():
return "minecraft:log2", map[string]any{"pillar_axis": l.Axis.String(), "new_log_type": l.Wood.String()}
case CrimsonWood(), WarpedWood():
return "minecraft:" + l.Wood.String() + "_stem", map[string]any{"pillar_axis": l.Axis.String()}
default:
14 changes: 2 additions & 12 deletions server/block/wood_fence.go
Original file line number Diff line number Diff line change
@@ -45,12 +45,7 @@ func (WoodFence) FuelInfo() item.FuelInfo {

// EncodeBlock ...
func (w WoodFence) EncodeBlock() (name string, properties map[string]any) {
switch w.Wood {
case OakWood(), SpruceWood(), BirchWood(), JungleWood(), AcaciaWood(), DarkOakWood():
return "minecraft:fence", map[string]any{"wood_type": w.Wood.String()}
default:
return "minecraft:" + w.Wood.String() + "_fence", nil
}
return "minecraft:" + w.Wood.String() + "_fence", nil
}

// Model ...
@@ -60,12 +55,7 @@ func (w WoodFence) Model() world.BlockModel {

// EncodeItem ...
func (w WoodFence) EncodeItem() (name string, meta int16) {
switch w.Wood {
case OakWood(), SpruceWood(), BirchWood(), JungleWood(), AcaciaWood(), DarkOakWood():
return "minecraft:fence", int16(w.Wood.Uint8())
default:
return "minecraft:" + w.Wood.String() + "_fence", 0
}
return "minecraft:" + w.Wood.String() + "_fence", 0
}

// allFence ...
16 changes: 6 additions & 10 deletions server/item/creative/creative.go
Original file line number Diff line number Diff line change
@@ -32,14 +32,10 @@ var (

// creativeItemEntry holds data of a creative item as present in the creative inventory.
type creativeItemEntry struct {
Name string `nbt:"name"`
Meta int16 `nbt:"meta"`
NBT map[string]any `nbt:"nbt,omitempty"`
Block struct {
Name string `nbt:"name"`
Properties map[string]any `nbt:"states"`
Version int32 `nbt:"version"`
} `nbt:"block,omitempty"`
Name string `nbt:"name"`
Meta int16 `nbt:"meta"`
NBT map[string]any `nbt:"nbt,omitempty"`
BlockProperties map[string]any `nbt:"block_properties,omitempty"`
}

// init initialises the creative items, registering all creative items that have also been registered as
@@ -54,11 +50,11 @@ func init() {
it world.Item
ok bool
)
if data.Block.Version > 0 {
if len(data.BlockProperties) > 0 {
// Item with a block, try parsing the block, then try asserting that to an item. Blocks no longer
// have their metadata sent, but we still need to get that metadata in order to be able to register
// different block states as different items.
if b, ok := world.BlockByName(data.Block.Name, data.Block.Properties); ok {
if b, ok := world.BlockByName(data.Name, data.BlockProperties); ok {
if it, ok = b.(world.Item); !ok {
continue
}
Binary file modified server/item/creative/creative_items.nbt
Binary file not shown.
4 changes: 2 additions & 2 deletions server/item/recipe/recipe.go
Original file line number Diff line number Diff line change
@@ -41,9 +41,9 @@ type Smithing struct {
// NewSmithing creates a new smithing recipe and returns it. The recipe can only be crafted on the block passed in the
// parameters. If the block given a crafting table, the recipe can also be crafted in the 2x2 crafting grid in the
// player's inventory.
func NewSmithing(base, addition, output item.Stack, block string) Smithing {
func NewSmithing(base, addition, template, output item.Stack, block string) Smithing {
return Smithing{recipe: recipe{
input: []item.Stack{base, addition},
input: []item.Stack{base, addition, template},
output: []item.Stack{output},
block: block,
}}
Binary file modified server/item/recipe/smithing_data.nbt
Binary file not shown.
1 change: 1 addition & 0 deletions server/session/player.go
Original file line number Diff line number Diff line change
@@ -125,6 +125,7 @@ func (s *Session) sendRecipes() {
RecipeID: uuid.New().String(),
Base: input[0],
Addition: input[1],
Template: input[2],
Result: output[0],
Block: i.Block(),
RecipeNetworkID: networkID,
Binary file modified server/world/block_states.nbt
Binary file not shown.
Binary file modified server/world/item_runtime_ids.nbt
Binary file not shown.

0 comments on commit 58e4d78

Please sign in to comment.