entity – Entities

The entity module contains entity classes.

class bravo.entity.Chest(*args, **kwargs)[source]

Bases: bravo.entity.Tile

A tile that holds items.

class bravo.entity.Chuck(**kwargs)[source]

Bases: bravo.entity.Mob

A cross between a duck and a chicken.

Create a mob.

This method calls super().

class bravo.entity.Cow(**kwargs)[source]

Bases: bravo.entity.Mob

Large, four-legged milk containers.

Create a mob.

This method calls super().

class bravo.entity.Creeper(aura=False, **kwargs)[source]

Bases: bravo.entity.Mob

A creeper.

Create a creeper.

This method calls super()

class bravo.entity.Entity(location=None, eid=0, **kwargs)[source]

Bases: object

Class representing an entity.

Entities are simply dynamic in-game objects. Plain entities are not very interesting.

Create an entity.

This method calls super().

class bravo.entity.Furnace(*args, **kwargs)[source]

Bases: bravo.entity.Tile

A tile that converts items to other items, using specific items as fuel.

burn(ticks)[source]

The main furnace loop.

Parameters:ticks (int) – number of furnace iterations to perform
can_craft()[source]

Determine whether this furnace is capable of outputting items.

Note that this is independent of whether the furnace is fueled.

Returns:bool
changed(factory, coords)[source]

Called from outside by event handler to inform the tile that the content was changed. If the furnace meet the requirements the method starts burn process. The burn stops the looping call when it’s out of fuel or no need to burn more.

We get furnace coords from outer side as the tile does not know about own chunk. If self.chunk is implemented the parameter can be removed and self.coords will be:

>>> self.coords = self.chunk.x, self.x, self.chunk.z, self.z, self.y
Parameters:
  • factory (BravoFactory) – The factory
  • coords (tuple) – (bigx, smallx, bigz, smallz, y) - coords of this furnace
has_fuel()[source]

Determine whether this furnace is fueled.

Returns:bool
class bravo.entity.Ghast(**kwargs)[source]

Bases: bravo.entity.Mob

A very melancholy ghost.

Create a mob.

This method calls super().

class bravo.entity.GiantZombie(**kwargs)[source]

Bases: bravo.entity.Mob

Like a regular zombie, but far larger.

Create a mob.

This method calls super().

class bravo.entity.Mob(**kwargs)[source]

Bases: bravo.entity.Entity

A creature.

Create a mob.

This method calls super().

name = 'Mob'

The name of this mob.

Names are used to identify mobs during serialization, just like for all other entities.

This mob might not be serialized if this name is not overriden.

run()[source]

Start this mob’s update loop.

save_to_packet()[source]

Create a “mob” packet representing this entity.

update()[source]

Update this mob’s location with respect to a factory.

update_metadata()[source]

Overrideable hook for general metadata updates.

This method is necessary because metadata generally only needs to be updated prior to certain events, not necessarily in response to external events.

This hook will always be called prior to saving this mob’s data for serialization or wire transfer.

class bravo.entity.MobSpawner(x, y, z)[source]

Bases: bravo.entity.Tile

A tile that spawns mobs.

class bravo.entity.Music(x, y, z)[source]

Bases: bravo.entity.Tile

A tile which produces a pitch when whacked.

class bravo.entity.Painting(face='+x', motive='', **kwargs)[source]

Bases: bravo.entity.Entity

A painting on a wall.

Create a painting.

This method calls super().

save_to_packet()[source]

Create a “painting” packet representing this entity.

class bravo.entity.Pickup(item=(0, 0), quantity=1, **kwargs)[source]

Bases: bravo.entity.Entity

Class representing a dropped block or item.

For historical and sanity reasons, this class is called Pickup, even though its entity name is “Item.”

Create a pickup.

This method calls super().

save_to_packet()[source]

Create a “pickup” packet representing this entity.

class bravo.entity.Pig(saddle=False, **kwargs)[source]

Bases: bravo.entity.Mob

A provider of bacon and piggyback rides.

Create a pig.

This method calls super().

class bravo.entity.Player(username='', **kwargs)[source]

Bases: bravo.entity.Entity

A player entity.

Create a player.

This method calls super().

save_equipment_to_packet()[source]

Creates packets that include the equipment of the player. Equipment is the item the player holds and all 4 armor parts.

save_to_packet()[source]

Create a “player” packet representing this entity.

class bravo.entity.Sheep(sheared=False, color=0, **kwargs)[source]

Bases: bravo.entity.Mob

A woolly mob.

Create a sheep.

This method calls super().

class bravo.entity.Sign(*args, **kwargs)[source]

Bases: bravo.entity.Tile

A tile that stores text.

class bravo.entity.Skeleton(**kwargs)[source]

Bases: bravo.entity.Mob

An archer skeleton.

Create a mob.

This method calls super().

class bravo.entity.Slime(size=1, **kwargs)[source]

Bases: bravo.entity.Mob

A gelatinous blob.

Create a slime.

This method calls super().

class bravo.entity.Spider(**kwargs)[source]

Bases: bravo.entity.Mob

A spider.

Create a mob.

This method calls super().

class bravo.entity.Squid(**kwargs)[source]

Bases: bravo.entity.Mob

An aquatic source of ink.

Create a mob.

This method calls super().

class bravo.entity.Tile(x, y, z)[source]

Bases: object

An entity that is also a block.

Or, perhaps more correctly, a block that is also an entity.

class bravo.entity.Wolf(owner=None, angry=False, sitting=False, **kwargs)[source]

Bases: bravo.entity.Mob

A wolf.

Create a wolf.

This method calls super().

class bravo.entity.Zombie(**kwargs)[source]

Bases: bravo.entity.Mob

A zombie.

Create a mob.

This method calls super().

class bravo.entity.ZombiePigman(**kwargs)[source]

Bases: bravo.entity.Mob

A zombie pigman.

Create a mob.

This method calls super().