-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add item DataComponent implements (part 2)
- Loading branch information
Showing
18 changed files
with
287 additions
and
73 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
) | ||
import "io" | ||
|
||
var _ DataComponent = (*CreativeSlotLock)(nil) | ||
|
||
|
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,28 +1,14 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*Damage)(nil) | ||
|
||
type Damage struct { | ||
Damage pk.VarInt | ||
pk.VarInt | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (Damage) ID() string { | ||
return "minecraft:damage" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (d *Damage) ReadFrom(r io.Reader) (n int64, err error) { | ||
return d.Damage.ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (d *Damage) WriteTo(w io.Writer) (n int64, err error) { | ||
return d.Damage.WriteTo(w) | ||
} |
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,29 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
|
||
var _ DataComponent = (*DyedColor)(nil) | ||
|
||
type DyedColor struct { | ||
RGB pk.Int | ||
ShowInTooltip pk.Boolean | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (DyedColor) ID() string { | ||
return "minecraft:dyed_color" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (d *DyedColor) ReadFrom(r io.Reader) (n int64, err error) { | ||
return pk.Tuple{&d.RGB, &d.ShowInTooltip}.ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (d *DyedColor) WriteTo(w io.Writer) (n int64, err error) { | ||
return pk.Tuple{&d.RGB, &d.ShowInTooltip}.WriteTo(w) | ||
} |
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,28 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
|
||
var _ DataComponent = (*EnchantmentGlintOverride)(nil) | ||
|
||
type EnchantmentGlintOverride struct { | ||
HasGlint pk.Boolean | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (EnchantmentGlintOverride) ID() string { | ||
return "minecraft:enchantment_glint_override" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (e *EnchantmentGlintOverride) ReadFrom(r io.Reader) (n int64, err error) { | ||
return e.HasGlint.ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (e *EnchantmentGlintOverride) WriteTo(w io.Writer) (n int64, err error) { | ||
return e.HasGlint.WriteTo(w) | ||
} |
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,22 @@ | ||
package component | ||
|
||
import "io" | ||
|
||
var _ DataComponent = (*FireResistant)(nil) | ||
|
||
type FireResistant struct{} | ||
|
||
// ID implements DataComponent. | ||
func (FireResistant) ID() string { | ||
return "minecraft:fire_resistant" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (f *FireResistant) ReadFrom(r io.Reader) (n int64, err error) { | ||
return 0, nil | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (f *FireResistant) WriteTo(w io.Writer) (n int64, err error) { | ||
return 0, nil | ||
} |
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,47 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
|
||
var _ DataComponent = (*Food)(nil) | ||
|
||
type Food struct { | ||
Nutrition pk.VarInt | ||
Saturation pk.Float | ||
CanAlwaysEat pk.Boolean | ||
EatSeconds pk.Float | ||
// TODO: using_converts_to | ||
// TODO: effects | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (Food) ID() string { | ||
return "minecraft:food" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (f *Food) ReadFrom(r io.Reader) (n int64, err error) { | ||
pk.Tuple{ | ||
&f.Nutrition, | ||
&f.Saturation, | ||
&f.CanAlwaysEat, | ||
&f.EatSeconds, | ||
// TODO | ||
}.ReadFrom(r) | ||
panic("unimplemented") | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (f *Food) WriteTo(w io.Writer) (n int64, err error) { | ||
pk.Tuple{ | ||
&f.Nutrition, | ||
&f.Saturation, | ||
&f.CanAlwaysEat, | ||
&f.EatSeconds, | ||
// TODO | ||
}.WriteTo(w) | ||
panic("unimplemented") | ||
} |
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,8 +1,6 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
) | ||
import "io" | ||
|
||
var _ DataComponent = (*HideAdditionalTooptip)(nil) | ||
|
||
|
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,8 +1,6 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
) | ||
import "io" | ||
|
||
var _ DataComponent = (*HideTooptip)(nil) | ||
|
||
|
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,22 @@ | ||
package component | ||
|
||
import "io" | ||
|
||
var _ DataComponent = (*IntangibleProjectile)(nil) | ||
|
||
type IntangibleProjectile struct{} | ||
|
||
// ID implements DataComponent. | ||
func (IntangibleProjectile) ID() string { | ||
return "minecraft:intangible_projectile" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (i *IntangibleProjectile) ReadFrom(r io.Reader) (n int64, err error) { | ||
return 0, nil | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (i *IntangibleProjectile) WriteTo(w io.Writer) (n int64, err error) { | ||
return 0, nil | ||
} |
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,15 @@ | ||
package component | ||
|
||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*MapColor)(nil) | ||
|
||
type MapColor struct { | ||
// The RGB components of the color, encoded as an integer. | ||
pk.Int | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (MapColor) ID() string { | ||
return "minecraft:map_color" | ||
} |
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,29 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
"github.com/Tnze/go-mc/nbt/dynbt" | ||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
|
||
var _ DataComponent = (*MapDecorations)(nil) | ||
|
||
type MapDecorations struct { | ||
dynbt.Value | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (MapDecorations) ID() string { | ||
return "minecraft:map_decorations" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (m *MapDecorations) ReadFrom(r io.Reader) (n int64, err error) { | ||
return pk.NBT(&m.Value).ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (m *MapDecorations) WriteTo(w io.Writer) (n int64, err error) { | ||
return pk.NBT(&m.Value).WriteTo(w) | ||
} |
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,14 @@ | ||
package component | ||
|
||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*MapID)(nil) | ||
|
||
type MapID struct { | ||
pk.VarInt | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (MapID) ID() string { | ||
return "minecraft:map_id" | ||
} |
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,28 +1,14 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*MaxDamage)(nil) | ||
|
||
type MaxDamage struct { | ||
MaxDamage pk.VarInt | ||
pk.VarInt | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (MaxDamage) ID() string { | ||
return "minecraft:max_damage" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (m *MaxDamage) ReadFrom(r io.Reader) (n int64, err error) { | ||
return m.MaxDamage.ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (m *MaxDamage) WriteTo(w io.Writer) (n int64, err error) { | ||
return m.MaxDamage.WriteTo(w) | ||
} |
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,28 +1,14 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*MaxStackSize)(nil) | ||
|
||
type MaxStackSize struct { | ||
MaxStackSize pk.VarInt | ||
pk.VarInt | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (MaxStackSize) ID() string { | ||
return "minecraft:max_stack_size" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (m *MaxStackSize) ReadFrom(r io.Reader) (n int64, err error) { | ||
return m.MaxStackSize.ReadFrom(r) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (m *MaxStackSize) WriteTo(w io.Writer) (n int64, err error) { | ||
return m.MaxStackSize.WriteTo(w) | ||
} |
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,28 +1,14 @@ | ||
package component | ||
|
||
import ( | ||
"io" | ||
|
||
pk "github.com/Tnze/go-mc/net/packet" | ||
) | ||
import pk "github.com/Tnze/go-mc/net/packet" | ||
|
||
var _ DataComponent = (*RepairCost)(nil) | ||
|
||
type RepairCost struct { | ||
Cost pk.VarInt | ||
pk.VarInt | ||
} | ||
|
||
// ID implements DataComponent. | ||
func (RepairCost) ID() string { | ||
return "minecraft:repair_cost" | ||
} | ||
|
||
// ReadFrom implements DataComponent. | ||
func (r *RepairCost) ReadFrom(reader io.Reader) (n int64, err error) { | ||
return r.Cost.ReadFrom(reader) | ||
} | ||
|
||
// WriteTo implements DataComponent. | ||
func (r *RepairCost) WriteTo(writer io.Writer) (n int64, err error) { | ||
return r.Cost.WriteTo(writer) | ||
} |
Oops, something went wrong.