func (b *blockPistonHead) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0, 0, 0, 1.0, 1.0, 4.0/16.0), vmath.NewAABB(6.0/16.0, 6.0/16.0, 4.0/16.0, 10.0/16.0, 10.0/16.0, 1.0), } if !b.Short { b.bounds[1].Max[2] += 4.0 / 16.0 } for i := range b.bounds { switch b.Facing { case direction.North: case direction.South: b.bounds[i] = b.bounds[i].RotateY(-math.Pi, 0.5, 0.5, 0.5) case direction.West: b.bounds[i] = b.bounds[i].RotateY(-math.Pi*1.5, 0.5, 0.5, 0.5) case direction.East: b.bounds[i] = b.bounds[i].RotateY(-math.Pi*0.5, 0.5, 0.5, 0.5) case direction.Up: b.bounds[i] = b.bounds[i].RotateX(-math.Pi*1.5, 0.5, 0.5, 0.5) case direction.Down: b.bounds[i] = b.bounds[i].RotateX(-math.Pi*0.5, 0.5, 0.5, 0.5) } } } return b.bounds }
func (b *blockFloorSign) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(-0.5, -4/16.0, -0.5/16.0, 0.5, 4/16.0, 0.5/16.0), vmath.NewAABB(7.5/16.0, 0, 7.5/16.0, 8.5/16.0, 9/16.0, 8.5/16.0), } b.bounds[0] = b.bounds[0].Shift(0.5, 0.5+5/16.0, 0.5) b.bounds[0] = b.bounds[0].RotateY((-float32(b.Rotation)/16)*math.Pi*2+math.Pi, 0.5, 0.5, 0.5) } return b.bounds }
func (b *baseBlock) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0, 0, 0, 1.0, 1.0, 1.0), } } return b.bounds }
func (b *blockRedstone) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0, 0, 0, 1.0, 1/64.0, 1.0), } } return b.bounds }
func (b *blockFarmland) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0.0, 0.0, 0.0, 1.0, 15.0/16.0, 1.0), } } return b.bounds }
func (b *blockRail) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0, 0, 0, 1.0, 1.0/16.0, 1.0), } } return b.bounds }
func (b *blockSnowLayer) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0.0, 0.0, 0.0, 1.0, (1.0/8.0)*float32(b.Layers), 1.0), } } return b.bounds }
func renderBuffer(ch *ChunkBuffer, po position, fr direction.Type, delta float64) { if ch == nil { return } rQueue.Append(renderRequest{ch, po, fr}) slidy := slidyChunks.Value() for !rQueue.Empty() { req := rQueue.Take() if req.chunk.renderedOn == frameID { continue } req.chunk.renderedOn = frameID aabb := vmath.NewAABB( -float32((req.pos.X<<4)+16), -float32((req.pos.Y<<4)+16), float32((req.pos.Z<<4)), -float32((req.pos.X<<4)), -float32((req.pos.Y<<4)), float32((req.pos.Z<<4)+16), ).Grow(1, 1, 1) if !frustum.IsAABBInside(aabb) { continue } renderOrder = append(renderOrder, req.chunk) req.chunk.Rendered = true if slidy { dx := req.pos.X - int(Camera.X)>>4 dz := req.pos.Z - int(Camera.Z)>>4 if req.chunk.progress < 1 && dx*dx+dz*dz > 6*6 { req.chunk.progress += delta * 0.015 } else { req.chunk.progress = 1 } } else { req.chunk.progress = 1 } if req.chunk.count != 0 && req.chunk.buffer.IsValid() { shaderChunk.Offset.Int3(req.chunk.X, req.chunk.Y*4096-req.chunk.Y*int(4096*(1-req.chunk.progress)), req.chunk.Z) req.chunk.array.Bind() gl.DrawElements(gl.Triangles, req.chunk.count, elementBufferType, 0) } for _, dir := range direction.Values { c := req.chunk.neighborChunks[dir] if dir != req.from && c != nil && c.renderedOn != frameID && (req.from == direction.Invalid || (req.chunk.IsVisible(req.from, dir) && validDirs[dir])) { ox, oy, oz := dir.Offset() pos := position{req.pos.X + ox, req.pos.Y + oy, req.pos.Z + oz} rQueue.Append(renderRequest{c, pos, dir.Opposite()}) } } } }
func (b *blockSlab) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(0, 0, 0, 1.0, 0.5, 1.0), } if b.Half == slabTop { b.bounds[0] = b.bounds[0].Shift(0, 0.5, 0.0) } } return b.bounds }
func (b *blockPortal) CollisionBounds() []vmath.AABB { if b.bounds == nil { b.bounds = []vmath.AABB{ vmath.NewAABB(6/16.0, 0, 0, 10/16.0, 1.0, 1.0), } if b.Axis == axisX { b.bounds[0] = b.bounds[0].RotateY(math.Pi/2, 0.5, 0.5, 0.5) } } return b.bounds }
func (b *blockStainedGlassPane) CollisionBounds() []vmath.AABB { if b.bounds == nil { all := !b.North && !b.South && !b.West && !b.East aa := vmath.NewAABB(0, 0, 7.0/16.0, 1.0, 1.0, 9.0/16.0) bb := vmath.NewAABB(7.0/16.0, 0, 0, 9.0/16.0, 1.0, 1.0) if !b.North && !all { bb.Min[2] = 7.0 / 16.0 } if !b.South && !all { bb.Max[2] = 9.0 / 16.0 } if !b.West && !all { aa.Min[0] = 7.0 / 16.0 } if !b.East && !all { aa.Max[0] = 9.0 / 16.0 } b.bounds = []vmath.AABB{aa, bb} } return b.bounds }
func newSheep() Entity { type sheep struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } s := &sheep{ debugComponent: debugComponent{232, 232, 232}, } s.NetworkID = 91 s.bounds = vmath.NewAABB(-0.45, 0, -0.45, 0.9, 1.3, 0.9) return s }
func newPig() Entity { type pig struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } p := &pig{ debugComponent: debugComponent{252, 0, 194}, } p.NetworkID = 90 p.bounds = vmath.NewAABB(-0.45, 0, -0.45, 0.9, 0.9, 0.9) return p }
func newChicken() Entity { type chicken struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } c := &chicken{ debugComponent: debugComponent{217, 217, 217}, } c.NetworkID = 93 c.bounds = vmath.NewAABB(-0.2, 0, -0.2, 0.4, 0.7, 0.4) return c }
func newCow() Entity { type cow struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } c := &cow{ debugComponent: debugComponent{125, 52, 0}, } c.NetworkID = 92 c.bounds = vmath.NewAABB(-0.45, 0, -0.45, 0.9, 1.3, 0.9) return c }
func newWolf() Entity { type wolf struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } w := &wolf{ debugComponent: debugComponent{148, 148, 148}, } w.NetworkID = 95 w.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 0.8, 0.6) return w }
func newSquid() Entity { type squid struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } s := &squid{ debugComponent: debugComponent{84, 39, 245}, } s.NetworkID = 94 s.bounds = vmath.NewAABB(-0.475, 0, -0.475, 0.95, 0.95, 0.95) return s }
func newZombie() Entity { type zombie struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } z := &zombie{ debugComponent: debugComponent{17, 114, 156}, } z.NetworkID = 54 z.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 1.8, 0.6) return z }
func newIronGolem() Entity { type ironGolem struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } i := &ironGolem{ debugComponent: debugComponent{125, 125, 125}, } i.NetworkID = 99 i.bounds = vmath.NewAABB(-0.7, 0, -0.7, 1.4, 2.9, 1.4) return i }
func newVillager() Entity { type villager struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } v := &villager{ debugComponent: debugComponent{212, 183, 142}, } v.NetworkID = 120 v.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 1.8, 0.6) return v }
func newSpider() Entity { type spider struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } s := &spider{ debugComponent: debugComponent{59, 7, 7}, } s.NetworkID = 52 s.bounds = vmath.NewAABB(-0.7, 0, -0.7, 1.4, 0.9, 1.4) return s }
func newGuardian() Entity { type guardian struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } g := &guardian{ debugComponent: debugComponent{69, 47, 71}, } g.NetworkID = 68 g.bounds = vmath.NewAABB(-0.425, 0, -0.425, 0.85, 0.85, 0.85) return g }
func newSnowman() Entity { type snowman struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } s := &snowman{ debugComponent: debugComponent{225, 225, 255}, } s.NetworkID = 97 s.bounds = vmath.NewAABB(-0.35, 0, -0.35, 0.7, 1.9, 0.7) return s }
func newSkeleton() Entity { type skeleton struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } s := &skeleton{ debugComponent: debugComponent{255, 255, 255}, } s.NetworkID = 51 s.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 1.8, 0.6) return s }
func newCreeper() Entity { type creeper struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } c := &creeper{ debugComponent: debugComponent{16, 117, 55}, } c.NetworkID = 50 c.bounds = vmath.NewAABB(-0.2, 0, -0.2, 0.4, 1.5, 0.4) return c }
func newMooshroom() Entity { type mooshroom struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } m := &mooshroom{ debugComponent: debugComponent{145, 41, 0}, } m.NetworkID = 96 m.bounds = vmath.NewAABB(-0.45, 0, -0.45, 0.9, 1.3, 0.9) return m }
func newHorse() Entity { type horse struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } h := &horse{ debugComponent: debugComponent{191, 156, 0}, } h.NetworkID = 100 h.bounds = vmath.NewAABB(-0.7, 0, -0.7, 1.4, 1.6, 1.4) return h }
func newOcelot() Entity { type ocelot struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } o := &ocelot{ debugComponent: debugComponent{242, 222, 0}, } o.NetworkID = 98 o.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 0.8, 0.6) return o }
func newRabbit() Entity { type rabbit struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } r := &rabbit{ debugComponent: debugComponent{181, 123, 42}, } r.NetworkID = 101 r.bounds = vmath.NewAABB(-0.3, 0, -0.3, 0.6, 0.7, 0.6) return r }
func newEndermite() Entity { type endermite struct { networkComponent positionComponent rotationComponent targetRotationComponent targetPositionComponent sizeComponent debugComponent } e := &endermite{ debugComponent: debugComponent{69, 47, 71}, } e.NetworkID = 67 e.bounds = vmath.NewAABB(-0.2, 0, -0.2, 0.4, 0.3, 0.4) return e }