diff --git a/server/entity/effect/fire_resistance.go b/server/entity/effect/fire_resistance.go index eed5606f0..d87bd8f52 100644 --- a/server/entity/effect/fire_resistance.go +++ b/server/entity/effect/fire_resistance.go @@ -13,5 +13,5 @@ type fireResistance struct { // RGBA ... func (fireResistance) RGBA() color.RGBA { - return color.RGBA{R: 0xe4, G: 0x9a, B: 0x3a, A: 0xff} + return color.RGBA{R: 0xff, G: 0x99, B: 0x00, A: 0xff} } diff --git a/server/entity/effect/instant_damage.go b/server/entity/effect/instant_damage.go index a6e86b7de..ce64a7012 100644 --- a/server/entity/effect/instant_damage.go +++ b/server/entity/effect/instant_damage.go @@ -22,7 +22,7 @@ func (i instantDamage) Apply(e world.Entity, eff Effect) { // RGBA ... func (instantDamage) RGBA() color.RGBA { - return color.RGBA{R: 0x43, G: 0x0a, B: 0x09, A: 0xff} + return color.RGBA{R: 0xa9, G: 0x65, B: 0x6a, A: 0xff} } // InstantDamageSource is used for damage caused by an effect.instantDamage diff --git a/server/entity/effect/invisibility.go b/server/entity/effect/invisibility.go index ae528790b..b37aa1546 100644 --- a/server/entity/effect/invisibility.go +++ b/server/entity/effect/invisibility.go @@ -36,5 +36,5 @@ func (invisibility) End(e world.Entity, _ int) { // RGBA ... func (invisibility) RGBA() color.RGBA { - return color.RGBA{R: 0x7f, G: 0x83, B: 0x92, A: 0xff} + return color.RGBA{R: 0xf6, G: 0xf6, B: 0xf6, A: 0xff} } diff --git a/server/entity/effect/jump_boost.go b/server/entity/effect/jump_boost.go index 2613e4fa7..857f0983e 100644 --- a/server/entity/effect/jump_boost.go +++ b/server/entity/effect/jump_boost.go @@ -14,5 +14,5 @@ type jumpBoost struct { // RGBA ... func (jumpBoost) RGBA() color.RGBA { - return color.RGBA{R: 0x22, G: 0xff, B: 0x4c, A: 0xff} + return color.RGBA{R: 0xfd, G: 0xff, B: 0x84, A: 0xff} } diff --git a/server/entity/effect/night_vision.go b/server/entity/effect/night_vision.go index 542506b03..a9dcbead7 100644 --- a/server/entity/effect/night_vision.go +++ b/server/entity/effect/night_vision.go @@ -14,5 +14,5 @@ type nightVision struct { // RGBA ... func (nightVision) RGBA() color.RGBA { - return color.RGBA{R: 0x1f, G: 0x1f, B: 0xa1, A: 0xff} + return color.RGBA{R: 0xc2, G: 0xff, B: 0x66, A: 0xff} } diff --git a/server/entity/effect/poison.go b/server/entity/effect/poison.go index dfc765d3c..03dc764f2 100644 --- a/server/entity/effect/poison.go +++ b/server/entity/effect/poison.go @@ -25,7 +25,7 @@ func (poison) Apply(e world.Entity, eff Effect) { // RGBA ... func (poison) RGBA() color.RGBA { - return color.RGBA{R: 0x4e, G: 0x93, B: 0x31, A: 0xff} + return color.RGBA{R: 0x87, G: 0xa3, B: 0x63, A: 0xff} } // PoisonDamageSource is used for damage caused by an effect.poison or diff --git a/server/entity/effect/resistance.go b/server/entity/effect/resistance.go index e6c22a84e..131326fc4 100644 --- a/server/entity/effect/resistance.go +++ b/server/entity/effect/resistance.go @@ -26,5 +26,5 @@ func (resistance) Multiplier(e world.DamageSource, lvl int) float64 { // RGBA ... func (resistance) RGBA() color.RGBA { - return color.RGBA{R: 0x99, G: 0x45, B: 0x3a, A: 0xff} + return color.RGBA{R: 0x91, G: 0x46, B: 0xf0, A: 0xff} } diff --git a/server/entity/effect/slow_falling.go b/server/entity/effect/slow_falling.go index 24cf1963b..07f3309fb 100644 --- a/server/entity/effect/slow_falling.go +++ b/server/entity/effect/slow_falling.go @@ -14,5 +14,5 @@ type slowFalling struct { // RGBA ... func (slowFalling) RGBA() color.RGBA { - return color.RGBA{R: 0xf7, G: 0xf8, B: 0xe0, A: 0xff} + return color.RGBA{R: 0xf3, G: 0xcf, B: 0xb9, A: 0xff} } diff --git a/server/entity/effect/slowness.go b/server/entity/effect/slowness.go index 985229744..46fde23c9 100644 --- a/server/entity/effect/slowness.go +++ b/server/entity/effect/slowness.go @@ -37,5 +37,5 @@ func (slowness) End(e world.Entity, lvl int) { // RGBA ... func (slowness) RGBA() color.RGBA { - return color.RGBA{R: 0x5a, G: 0x6c, B: 0x81, A: 0xff} + return color.RGBA{R: 0x8b, G: 0xaf, B: 0xe0, A: 0xff} } diff --git a/server/entity/effect/speed.go b/server/entity/effect/speed.go index 8439a4834..3dd3122fb 100644 --- a/server/entity/effect/speed.go +++ b/server/entity/effect/speed.go @@ -31,5 +31,5 @@ func (speed) End(e world.Entity, lvl int) { // RGBA ... func (speed) RGBA() color.RGBA { - return color.RGBA{R: 0x7c, G: 0xaf, B: 0xc6, A: 0xff} + return color.RGBA{R: 0x33, G: 0xeb, B: 0xff, A: 0xff} } diff --git a/server/entity/effect/water_breathing.go b/server/entity/effect/water_breathing.go index 4ec209d60..4d0e67032 100644 --- a/server/entity/effect/water_breathing.go +++ b/server/entity/effect/water_breathing.go @@ -14,5 +14,5 @@ type waterBreathing struct { // RGBA ... func (waterBreathing) RGBA() color.RGBA { - return color.RGBA{R: 0x2e, G: 0x52, B: 0x99, A: 0xff} + return color.RGBA{R: 0x98, G: 0xda, B: 0xc0, A: 0xff} } diff --git a/server/entity/effect/wither.go b/server/entity/effect/wither.go index d6e793847..245776dab 100644 --- a/server/entity/effect/wither.go +++ b/server/entity/effect/wither.go @@ -25,7 +25,7 @@ func (wither) Apply(e world.Entity, eff Effect) { // RGBA ... func (wither) RGBA() color.RGBA { - return color.RGBA{R: 0x35, G: 0x2a, B: 0x27, A: 0xff} + return color.RGBA{R: 0x73, G: 0x61, B: 0x56, A: 0xff} } // WitherDamageSource is used for damage caused by an effect.wither applied diff --git a/server/item/book_and_quill.go b/server/item/book_and_quill.go index d7309f574..e239c3a44 100644 --- a/server/item/book_and_quill.go +++ b/server/item/book_and_quill.go @@ -116,11 +116,3 @@ func (b BookAndQuill) EncodeNBT() map[string]any { func (BookAndQuill) EncodeItem() (name string, meta int16) { return "minecraft:writable_book", 0 } - -// max ... -func max(a, b int) int { - if a > b { - return a - } - return b -} diff --git a/server/item/bottle_of_enchanting.go b/server/item/bottle_of_enchanting.go index 46f36dafc..96ca279c6 100644 --- a/server/item/bottle_of_enchanting.go +++ b/server/item/bottle_of_enchanting.go @@ -11,7 +11,7 @@ type BottleOfEnchanting struct{} // Use ... func (b BottleOfEnchanting) Use(tx *world.Tx, user User, ctx *UseContext) bool { create := tx.World().EntityRegistry().Config().BottleOfEnchanting - opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: user.Rotation().Vec3().Mul(0.7)} + opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: throwableOffset(user.Rotation()).Vec3().Mul(0.6)} tx.AddEntity(create(opts, user)) tx.PlaySound(user.Position(), sound.ItemThrow{}) diff --git a/server/item/lingering_potion.go b/server/item/lingering_potion.go index 0f0e33cc3..d83bac0cf 100644 --- a/server/item/lingering_potion.go +++ b/server/item/lingering_potion.go @@ -21,7 +21,7 @@ func (l LingeringPotion) MaxCount() int { // Use ... func (l LingeringPotion) Use(tx *world.Tx, user User, ctx *UseContext) bool { create := tx.World().EntityRegistry().Config().LingeringPotion - opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: user.Rotation().Vec3().Mul(0.5)} + opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: throwableOffset(user.Rotation()).Vec3().Mul(0.5)} tx.AddEntity(create(opts, l.Type, user)) tx.PlaySound(user.Position(), sound.ItemThrow{}) diff --git a/server/item/splash_potion.go b/server/item/splash_potion.go index 3e356ad5d..cea504280 100644 --- a/server/item/splash_potion.go +++ b/server/item/splash_potion.go @@ -1,9 +1,11 @@ package item import ( + "github.com/df-mc/dragonfly/server/block/cube" "github.com/df-mc/dragonfly/server/item/potion" "github.com/df-mc/dragonfly/server/world" "github.com/df-mc/dragonfly/server/world/sound" + "math" ) // SplashPotion is an item that grants effects when thrown. @@ -20,7 +22,7 @@ func (s SplashPotion) MaxCount() int { // Use ... func (s SplashPotion) Use(tx *world.Tx, user User, ctx *UseContext) bool { create := tx.World().EntityRegistry().Config().SplashPotion - opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: user.Rotation().Vec3().Mul(0.5)} + opts := world.EntitySpawnOpts{Position: eyePosition(user), Velocity: throwableOffset(user.Rotation()).Vec3().Mul(0.5)} tx.AddEntity(create(opts, s.Type, user)) tx.PlaySound(user.Position(), sound.ItemThrow{}) @@ -28,6 +30,19 @@ func (s SplashPotion) Use(tx *world.Tx, user User, ctx *UseContext) bool { return true } +// throwableOffset adds an upwards offset pitch to a throwable entity. +// In vanilla, items such as Splash Potions, Lingering Potions, and +// Bottle o' Enchanting are thrown at a higher angle than where the +// player is looking at. +// The added offset is an ellipse-like shape based on what the input pitch is. +func throwableOffset(r cube.Rotation) cube.Rotation { + r[1] = max(min(r[1], 89.9), -89.9) + r[1] -= math.Sqrt(math.Pow(89.9, 2)-math.Pow(r[1], 2)) * (26.5 / 89.9) + r[1] = max(min(r[1], 89.9), -89.9) + + return r +} + // EncodeItem ... func (s SplashPotion) EncodeItem() (name string, meta int16) { return "minecraft:splash_potion", int16(s.Type.Uint8())