Files
mc/server/entity/register.go
T
TarnaWijaya 73fa11c6e3 Update menyelesaikan #1
1. **Survival Mode** – Pemain otomatis masuk .
2. **Village Generation** – Rumah desa (cobblestone, papan kayu, jendela, pintu) & pohon oak dibuat prosedural di .
3. **Ore & Terrain** – Semua ore vanilla (Coal–Emerald) dengan varian deepslate muncul sesuai kedalaman; bukit/gunung dibentuk via noise trigonometri.
4. **Mob Spawner** – Spawner periodik (babi, sapi, domba, zombie, skeleton) di sekitar pemain, cap maksimal 25 mob aktif.
5. **Struktur Baru** – Rumah kayu & cobblestone, aman dari batas chunk.
6. **Vegetasi** – Rumput, pakis, dan bunga dandelion otomatis di permukaan.
7. **Spawn Point** – Pemain baru spawn acak namun dekat pemain aktif lain.
8. **Cave Generation** – 3D noise carver untuk terowongan goa.
9. **Item Cleanup** – Auto-bersih item drop tiap 15 menit, notifikasi peringatan 5 menit sebelumnya.
10. **Auto Optimization** –  +  dijalankan tiap sesi cleanup untuk jaga performa server.
2026-07-12 04:04:55 +07:00

69 lines
2.2 KiB
Go

package entity
import (
"github.com/df-mc/dragonfly/server/item"
"github.com/df-mc/dragonfly/server/item/enchantment"
"github.com/df-mc/dragonfly/server/item/potion"
"github.com/df-mc/dragonfly/server/world"
)
// DefaultRegistry is a world.EntityRegistry that registers all default entities
// implemented by Dragonfly.
var DefaultRegistry = conf.New([]world.EntityType{
AreaEffectCloudType,
ArrowType,
BottleOfEnchantingType,
EggType,
EnderPearlType,
ExperienceOrbType,
FallingBlockType,
FireworkType,
ItemType,
LightningType,
LingeringPotionType,
SnowballType,
SplashPotionType,
TNTType,
TextType,
PigType,
CowType,
SheepType,
ZombieType,
SkeletonType,
})
var conf = world.EntityRegistryConfig{
TNT: NewTNT,
Egg: NewEgg,
Snowball: NewSnowball,
BottleOfEnchanting: NewBottleOfEnchanting,
EnderPearl: NewEnderPearl,
FallingBlock: NewFallingBlock,
Lightning: NewLightning,
Firework: func(opts world.EntitySpawnOpts, firework world.Item, owner world.Entity, sidewaysVelocityMultiplier, upwardsAcceleration float64, attached bool) *world.EntityHandle {
return newFirework(opts, firework.(item.Firework), owner, sidewaysVelocityMultiplier, upwardsAcceleration, attached)
},
Item: func(opts world.EntitySpawnOpts, it any) *world.EntityHandle {
return NewItem(opts, it.(item.Stack))
},
LingeringPotion: func(opts world.EntitySpawnOpts, t any, owner world.Entity) *world.EntityHandle {
return NewLingeringPotion(opts, t.(potion.Potion), owner)
},
SplashPotion: func(opts world.EntitySpawnOpts, t any, owner world.Entity) *world.EntityHandle {
return NewSplashPotion(opts, t.(potion.Potion), owner)
},
Arrow: func(opts world.EntitySpawnOpts, arrow world.ArrowSpawnConfig) *world.EntityHandle {
tip := arrow.Tip.(potion.Potion)
conf := arrowConf
conf.Damage, conf.Potion, conf.Owner = arrow.Damage, tip, arrow.Owner.H()
conf.KnockBackForceAddend = float64(arrow.PunchLevel) * enchantment.Punch.KnockBackMultiplier()
conf.DisablePickup = arrow.DisablePickup
if arrow.ObtainArrowOnPickup {
conf.PickupItem = item.NewStack(item.Arrow{Tip: tip}, 1)
}
conf.Critical = arrow.Critical
conf.PiercingLevel = arrow.PiercingLevel
return opts.New(ArrowType, conf)
},
}