Simplib

Mods
395 Downloads Last Updated: May 3, 2016 Game Version: 1.7.10

Simplib is a new and simple way for you to be able to start making mods! It takes some of the most used pieces of code and simplifies them, making it easier for experienced or even people new to mod development!

 

Features

 

This version of Simplib has a simple way to be able to register items and blocks! Taking a long winded process and shortening it down into an incredibly simple one.

 

Setting Up

 

Adding the Library (Eclipse)

To be able to get started with Simplib with Eclipse, you should already have:

  • A workspace set up with your mod project installed.
  • Java 1.7 or above.

First of all right click on your project.

Select Properties

Click Java Build Path and add External Jars

Select the simplib-core-1.0.jar file

In the development environment, you need to use CodeChickenCore

Download CodeChickenCore

Place the downloaded file into your eclipse/mods folder inside your workspace

You are done!

 

Using in your code

 

The first thing that should done is you need to add a required-after dependency in your @Mod, it should like like this:

@Mod(modid="DemoMod", name="DemoMod", dependencies="required-after:simplib-core")

 Blocks

 

When defining a block in your code, you can use SimplibBlock which is a class built in to make it easier in setting up the class. The block can be defined like this:

SimplibBlock yourBlockName = new yourBlockName();

In the block class you create, you can also extend SimplibBlock like this:

public class yourBlockName extends SimplibBlock

 The constructor of the class needs an input of a Material which is done in the super method:

super(Material.<material>);

 As well as the base class, there are methods which can be used to be able to register the block simply. The first method you can use is:

BlockRegister.registerBlock(new GameRegistry(), yourBlockName, "yourBlockName");

 

yourBlockName is the same block which you defined in the earlier steps.

The final string is the name you want your block to be recognized by (not the display name).

 The next method also adds in a creative tab too, the use of this is:

BlockRegister.registerBlock(new GameRegistry(), yourBlockName, "yourBlockName", tabTest);

 

yourBlockName is the same block which you defined in the earlier steps.

The final string is the name you want your block to be recognized by (not the display name).

tabTest is a Creative Tab defined earlier in the class

 Items

 

The same techniques have been implemented for Items too. You can define an item using a pre-made class in the Simplib library. The item can be defined by:

SimplibItem yourItemName = new yourItemName();

 You can also extend the item class by the SimplibItem class like this:

public class yourItemName extends SimplibItem

 The constructor of the class does not need any special needs so the class can be used straight away.

 

Like the block, there are 2 methods which can be used to register the items, the first of these are:

ItemRegister.registerItem(new GameRegistry(), yourItemName, "yourItemName");

 

yourItemName is the same item which you defined in the earlier steps.

The final string is the name you want your item to be recognized by (not the display name).

 The second of the 2 methods, also adds in a quick way to put your item in a creative tab, the use of this is:

ItemRegister.registerItem(new GameRegistry(), yourItemName, "yourItemName");

 

yourItemName is the same item which you defined in the earlier steps.

The final string is the name you want your item to be recognized by (not the display name).

tabTest is a Creative Tab defined earlier in the class

 Food

 

In version 1.1 of Simplib, a system for adding in food items was implemented. This first variable declaration will be for an item without potion effects:

SimplibFood testFood = new TestFood(10, 0.5F, false);

 

The 10 in the declaration is the amount of hunger that it will restore, each of the 10 sections requires 2 in this value. This will replace 5.

The 0.5f is the modifier which decides how quick the players become hungry again. The higher this is, the slower you will get hungry.

The false in this is what decides if a wolf can have this type of food to be happy.

This next type of declaration will explain how you can add potion effects to your food item when it is eaten:

SimplibFood testFood = new TestFood(10, 0.5F, false, new PotionEffect(Potion.regeneration.id, 200, 1));

 

The 10 in the declaration is the amount of hunger that it will restore, each of the 10 sections requires 2 in this value. This will replace 5.

The 0.5f is the modifier which decides how quick the players become hungry again. The higher this is, the slower you will get hungry.

The false in this is what decides if a wolf can have this type of food to be happy.

The final section of the method is a way to define a PotionEffect. This particular effect gives you regeneration for 10 seconds.

 The food items can be registered in the same way as standard items using Simplib. Using the ItemRegister class.

 

Planned Features

 

There are a lot of features currently planned for Simplib:

  • Ability to add new liquids and liquid storage
  • Dimensions and portals
  • Biomes
  • Mobs (Passive and Hostile)

Comments

Posts Quoted: