Extra Data Book Info


Prerequisites

A ZAWABaseLand extended animal

Tutorial

This tutorial will be showing you how to add extra animal info to the data book.
In your animal class add the following code.


@Override
public DataItem getIconList() {
	List s = new ArrayList();
	
	return new DataItem(s);
}
                        

What this code does is tell the data book to create a new list of data to show in the book.
Now that we have this code we are able to start actually adding in things to display in the book.

ZAWA has a list of pre-defined icons to show listed below is code for adding them all to the animal


@Override
public DataItem getIconList() {
	List s = new ArrayList();
	s.add(new StatusDigging());
	s.add(new StatusCarrying());
	s.add(new StatusClimbing());
	s.add(new StatusEggLaying());
	s.add(new StatusJumping());
	s.add(new StatusStealing());
	s.add(new StatusSunSeeking());
	s.add(new StatusSwimming());
	s.add(new StatusVenomous());
	return new DataItem(s);
}
                        

While using the ZAWA pre-defined info is nice there is still the option to add our own custom info, we can do this one of two ways.

Option 1 is to add the custom directly in the getIconList method as shown below.


@Override
public DataItem getIconList() {
	List s = new ArrayList();
    s.add(new StringedItem(stack, info));
	return new DataItem(s);
}
                        

The stack is where we can either have an itemstack or a resource location to display our icon, the second variable info is where we can define the info when hovered over the icon.

The second option would be to create a new class all together extending the StringedItem class from ZAWA and creating a new version of it like we did with the ZAWA default status icons. This method should be used if you plan on calling the same status type multiple times for example if all your animals fly.

Back to tutorials