public interface IApiHandler
RockBottomAPI.getApiHandler().| Modifier and Type | Method and Description |
|---|---|
boolean |
collectItems(IInventory inventory,
java.util.List<IUseInfo> inputs,
boolean simulate,
java.util.List<ItemInstance> out)
Searches the inventory for items as IUseInfo specified in the given parameters.
|
java.util.List<ItemInstance> |
construct(AbstractPlayerEntity player,
IInventory inputInventory,
IInventory outputInventory,
PlayerCompendiumRecipe recipe,
TileEntity machine,
int amount,
java.util.List<ItemInstance> availableInputs,
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,
ICompendiumRecipe 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. |
void |
defaultConstruct(AbstractPlayerEntity player,
PlayerCompendiumRecipe recipe,
TileEntity machine)
Similar to
construct(AbstractPlayerEntity, IInventory, IInventory, PlayerCompendiumRecipe, TileEntity, int, List, float)
but safe to use on both client and server side (client side sends packet to server). |
int |
generateBasicHeight(IWorld world,
TileLayer layer,
int x,
INoiseGen noiseGen,
int minHeight,
int maxHeight,
int maxMountainHeight) |
void |
generateBiomeGen(IWorld world,
IChunk chunk,
BiomeGen gen,
java.util.Map<Biome,INoiseGen> biomeNoiseGens) |
Biome |
getBiome(IWorld world,
int x,
int y,
int height,
java.util.Map<BiomeLevel,java.lang.Integer> totalWeights,
com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel,
java.util.Random biomeRandom,
int blobSize,
long[] layerSeeds,
INoiseGen levelHeightNoise,
int levelTransition,
int biomeTransition) |
int |
getColorByLight(int light,
TileLayer layer)
Gets a color in the world based on a light value between 0 and
Constants.MAX_LIGHT. |
java.util.List<BoundingBox> |
getDefaultPlatformBounds(IWorld world,
int x,
int y,
TileLayer layer,
double tileWidth,
double tileHeight,
TileState state,
MovableWorldObject object,
BoundingBox objectBox) |
BiomeLevel |
getSmoothedLevelForPos(IWorld world,
int x,
int y,
int height,
int levelTransition,
com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel,
INoiseGen levelHeightNoise) |
boolean |
hasItems(IInventory inventory,
java.util.List<IUseInfo> checklist,
int count,
java.util.List<ItemInstance> outInputs,
java.util.Map<java.lang.Integer,java.lang.Integer> outSlotsToDeduct)
Checks to see if the given input inventory has enough of the given items in the checklist list.
|
void |
initBiomeGen(IWorld world,
int seedScramble,
int blobSize,
long[] layerSeeds,
com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel,
java.util.Map<BiomeLevel,java.lang.Integer> totalWeights,
BiomeGen gen) |
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. |
void |
openExtendedPlayerInventory(AbstractPlayerEntity player,
IInventory inventory,
int containerWidth,
java.util.function.Consumer<IInventory> onClosed,
ItemContainer.ISlotCallback slotCallback)
Opens the player inventory with an additional inventory on the top.
|
void |
openPlayerInventory(AbstractPlayerEntity player)
Opens the players inventory the same as pressing
Settings.KEY_INVENTORY. |
DataPart |
readDataPart(com.google.gson.JsonElement element) |
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 |
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 |
renderPlayer(AbstractPlayerEntity player,
IGameInstance game,
IAssetManager manager,
IRenderer g,
IPlayerDesign design,
float x,
float y,
float scale,
int row,
int light) |
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(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)
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<BoundingBox> getDefaultPlatformBounds(IWorld world, int x, int y, TileLayer layer, double tileWidth, double tileHeight, TileState state, MovableWorldObject object, BoundingBox objectBox)
boolean collectItems(IInventory inventory, java.util.List<IUseInfo> inputs, boolean simulate, java.util.List<ItemInstance> out)
inventory - The inventory to searchinputs - The list of item infos to findsimulate - Whether to simulate the process. False will remove the items found from inventory IF it has found all inputs.out - The list to be provided which will store the ItemInstances found.boolean hasItems(IInventory inventory, java.util.List<IUseInfo> checklist, int count, java.util.List<ItemInstance> outInputs, java.util.Map<java.lang.Integer,java.lang.Integer> outSlotsToDeduct)
inventory - The input inventory.checklist - The item checklist.count - The amount of times each item of the checklist needs to appear.outInputs - The output list of item instances found in the inventory. Can be null.outSlotsToDeduct - The output map of slot ids to amount of items to deduct from that slot. Can be null.void defaultConstruct(AbstractPlayerEntity player, PlayerCompendiumRecipe recipe, TileEntity machine)
construct(AbstractPlayerEntity, IInventory, IInventory, PlayerCompendiumRecipe, TileEntity, int, List, float)
but safe to use on both client and server side (client side sends packet to server).player - The player doing this construction. Can be null if
the construction is automated. Note that the skill
reward is not used then.recipe - The recipe to constructmachine - The tile entity doing the craftingjava.util.List<ItemInstance> construct(AbstractPlayerEntity player, IInventory inputInventory, IInventory outputInventory, PlayerCompendiumRecipe recipe, TileEntity machine, int amount, java.util.List<ItemInstance> availableInputs, float skillReward)
ICompendiumRecipe 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 constructedmachine - The machineamount - The amount of times this recipe should be
constructedavailableInputs - The actual ItemInstances used in the construction of the recipe.
Can be null if the inputs should be calculated by the method.skillReward - The amount of skill points you get for
constructing this recipedefaultConstruct(AbstractPlayerEntity, PlayerCompendiumRecipe, TileEntity)int 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 namevoid renderPlayer(AbstractPlayerEntity player, IGameInstance game, IAssetManager manager, IRenderer g, IPlayerDesign design, float x, float y, float scale, int row, int light)
int generateBasicHeight(IWorld world, TileLayer layer, int x, INoiseGen noiseGen, int minHeight, int maxHeight, int maxMountainHeight)
void initBiomeGen(IWorld world, int seedScramble, int blobSize, long[] layerSeeds, com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel, java.util.Map<BiomeLevel,java.lang.Integer> totalWeights, BiomeGen gen)
void generateBiomeGen(IWorld world, IChunk chunk, BiomeGen gen, java.util.Map<Biome,INoiseGen> biomeNoiseGens)
Biome getBiome(IWorld world, int x, int y, int height, java.util.Map<BiomeLevel,java.lang.Integer> totalWeights, com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel, java.util.Random biomeRandom, int blobSize, long[] layerSeeds, INoiseGen levelHeightNoise, int levelTransition, int biomeTransition)
BiomeLevel getSmoothedLevelForPos(IWorld world, int x, int y, int height, int levelTransition, com.google.common.collect.ListMultimap<BiomeLevel,Biome> biomesPerLevel, INoiseGen levelHeightNoise)
void openPlayerInventory(AbstractPlayerEntity player)
Settings.KEY_INVENTORY.player - The player to open the inventory for.void openExtendedPlayerInventory(AbstractPlayerEntity player, IInventory inventory, int containerWidth, java.util.function.Consumer<IInventory> onClosed, ItemContainer.ISlotCallback slotCallback)
player - The player opening the container.inventory - The extra inventory.containerWidth - The amount of slots horizontally before wrapping to next line.onClosed - The action to take when the container is closed.