public interface IApiHandler
RockBottomAPI.getApiHandler().| Modifier and Type | Method | Description |
|---|---|---|
java.util.List<ItemInstance> |
construct(AbstractEntityPlayer player,
Inventory inputInventory,
Inventory outputInventory,
IRecipe recipe,
int amount,
java.util.List<IUseInfo> inputs,
java.util.function.Function<java.util.List<ItemInstance>,java.util.List<ItemInstance>> outputGetter,
float skillReward) |
This is a utility method that you can call for custom construction of
items via the compendium, if you, for example, create a custom, more
complex,
IRecipe class, or if you create a machine that should
automatically construct something. |
java.util.logging.Logger |
createLogger(java.lang.String name) |
Creates a
Logger with the specified name that will output to the
main logger and also written to the log file. |
int |
getColorByLight(int light,
TileLayer layer) |
Gets a color in the world based on a light value between 0 and
Constants.MAX_LIGHT. |
int[] |
interpolateLight(IWorld world,
int x,
int y) |
Interpolates the light at a position in the world.
|
int[] |
interpolateWorldColor(int[] interpolatedLight,
TileLayer layer) |
Interpolates the four colors of the corners of a position in the world
based on the
TileLayer and the interpolated light from interpolateLight(IWorld, int, int). |
INoiseGen |
makeSimplexNoise(long seed) |
Returns a new
INoiseGen of the Simplex Noise kind based on the
specified seed. |
DataPart |
readDataPart(com.google.gson.JsonElement element) |
|
void |
readDataSet(com.google.gson.JsonObject main,
AbstractDataSet set) |
Reads a data set directly from a json object head, throwing an exception
if something fails.
|
void |
readDataSet(AbstractDataSet set,
java.io.File file,
boolean asJson) |
Reads a data set from the given file either as binary or as a json and
stores the data in the set.
|
void |
readDataSet(java.io.DataInput stream,
AbstractDataSet set) |
Reads a data set directly from a data input of any kind, throwing an
exception if something fails.
|
void |
writeDataSet(com.google.gson.JsonObject main,
AbstractDataSet set) |
Writes a data set directly to a json object head, throwing an exception
if something fails.
|
void |
writeDataSet(AbstractDataSet set,
java.io.File file,
boolean asJson) |
Writes a data set to the given file either as binary or as a json
|
void |
writeDataSet(java.io.DataOutput stream,
AbstractDataSet set) |
Writes a data set directly to a data output of any kind, throwing an
exception if something fails.
|
void writeDataSet(AbstractDataSet set, java.io.File file, boolean asJson)
set - The data set to write to filefile - The file to write toasJson - Wether it should be stored as jsonvoid readDataSet(AbstractDataSet set, java.io.File file, boolean asJson)
set - The set to store the data infile - The file to read fromasJson - Wether or not it should be stored as jsonvoid writeDataSet(java.io.DataOutput stream,
AbstractDataSet set)
throws java.lang.Exception
stream - The output to write toset - The set to write to the outputjava.lang.Exception - if writing fails for some reasonvoid readDataSet(java.io.DataInput stream,
AbstractDataSet set)
throws java.lang.Exception
stream - The input to read fromset - The set to save the input injava.lang.Exception - if reading fails for some reasonvoid writeDataSet(com.google.gson.JsonObject main,
AbstractDataSet set)
throws java.lang.Exception
main - The json object to write toset - The set to writejava.lang.Exception - if writing fails for some reasonvoid readDataSet(com.google.gson.JsonObject main,
AbstractDataSet set)
throws java.lang.Exception
main - The json object to read fromset - The set to save the input injava.lang.Exception - if reading fails for some reasonDataPart readDataPart(com.google.gson.JsonElement element) throws java.lang.Exception
java.lang.Exceptionint[] interpolateLight(IWorld world, int x, int y)
world - The worldx - The x coordinatey - The y coordinateint[] interpolateWorldColor(int[] interpolatedLight,
TileLayer layer)
TileLayer and the interpolated light from interpolateLight(IWorld, int, int).interpolatedLight - The interpolated lightlayer - The layerjava.util.List<ItemInstance> construct(AbstractEntityPlayer player, Inventory inputInventory, Inventory outputInventory, IRecipe recipe, int amount, java.util.List<IUseInfo> inputs, java.util.function.Function<java.util.List<ItemInstance>,java.util.List<ItemInstance>> outputGetter, float skillReward)
IRecipe class, or if you create a machine that should
automatically construct something.player - The player doing this construction. Can be null if
the construction is automated. Note that the skill
reward is not used then.inputInventory - The inventory that the construction takes items
fromoutputInventory - The inventory that the output items go intorecipe - The recipe to be constructedamount - The amount of times this recipe should be
constructedinputs - The items that are input into the recipeoutputGetter - A function that is called to get the outputs of
the recipe based on the inputs that were actually
taken from the inventoryskillReward - The amount of skill points you get for
constructing this recipeint getColorByLight(int light,
TileLayer layer)
Constants.MAX_LIGHT.light - The lightlayer - The layerINoiseGen makeSimplexNoise(long seed)
INoiseGen of the Simplex Noise kind based on the
specified seed.seed - The seedjava.util.logging.Logger createLogger(java.lang.String name)
Logger with the specified name that will output to the
main logger and also written to the log file.name - The name