Files
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

54 lines
1.6 KiB
Go

package entity
import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/world"
)
// MobType is a world.EntityType implementation for generic mobs.
type MobType struct {
Name string
Width, Height float64
}
// Open converts a world.EntityHandle to an Ent.
func (t MobType) Open(tx *world.Tx, handle *world.EntityHandle, data *world.EntityData) world.Entity {
return &Ent{tx: tx, handle: handle, data: data}
}
// DecodeNBT decodes NBT data for the mob entity.
func (t MobType) DecodeNBT(m map[string]any, data *world.EntityData) {
data.Data = PassiveBehaviourConfig{
Gravity: 0.08,
Drag: 0.02,
}.New()
}
// EncodeNBT encodes NBT data for the mob entity.
func (t MobType) EncodeNBT(data *world.EntityData) map[string]any {
return nil
}
// EncodeEntity returns the Minecraft entity ID.
func (t MobType) EncodeEntity() string {
return t.Name
}
// BBox returns the bounding box of the mob entity.
func (t MobType) BBox(world.Entity) cube.BBox {
return cube.Box(-t.Width/2, 0, -t.Width/2, t.Width/2, t.Height, t.Width/2)
}
var (
// PigType is the EntityType for a pig.
PigType = MobType{Name: "minecraft:pig", Width: 0.9, Height: 0.9}
// CowType is the EntityType for a cow.
CowType = MobType{Name: "minecraft:cow", Width: 0.9, Height: 1.4}
// SheepType is the EntityType for a sheep.
SheepType = MobType{Name: "minecraft:sheep", Width: 0.9, Height: 1.3}
// ZombieType is the EntityType for a zombie.
ZombieType = MobType{Name: "minecraft:zombie", Width: 0.6, Height: 1.9}
// SkeletonType is the EntityType for a skeleton.
SkeletonType = MobType{Name: "minecraft:skeleton", Width: 0.6, Height: 1.9}
)