Class EnergyApi
java.lang.Object
earth.terrarium.botarium.common.energy.EnergyApi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic longdistributeEnergyNearby(net.minecraft.world.level.block.entity.BlockEntity energyBlock, long amount) Automatically transfers energy from an energy block to surrounding blocksstatic longdistributeEnergyNearby(net.minecraft.world.level.block.entity.BlockEntity energyBlock, @Nullable net.minecraft.core.Direction extractDirection, long amount) Automatically transfers energy from an energy block to surrounding blocksstatic longdistributeEnergyNearby(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos energyPos, @Nullable net.minecraft.core.Direction extractDirection, long amount) Automatically transfers energy from an energy block to surrounding blocksstatic <T extends EnergyContainer>
TgetAPIEnergyContainer(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable net.minecraft.core.Direction direction) static Map<net.minecraft.world.level.block.entity.BlockEntityType<?>,BotariumEnergyBlock<?>> static Map<net.minecraft.world.level.block.Block,BotariumEnergyBlock<?>> static BotariumEnergyBlock<?>getEnergyBlock(net.minecraft.world.level.block.Block block) static BotariumEnergyBlock<?>getEnergyBlock(net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntity) static BotariumEnergyItem<?>getEnergyItem(net.minecraft.world.item.Item item) static Map<net.minecraft.world.item.Item,BotariumEnergyItem<?>> static longmoveEnergy(EnergyContainer from, EnergyContainer to, long amount, boolean simulate) Moves energy from one energy container to anotherstatic longmoveEnergy(ItemStackHolder from, ItemStackHolder to, long amount, boolean simulate) Moves energy from one energy container to anotherstatic longmoveEnergy(ItemStackHolder from, net.minecraft.world.level.block.entity.BlockEntity to, net.minecraft.core.Direction direction, long amount, boolean simulate) Moves energy from one energy container to anotherstatic longmoveEnergy(net.minecraft.world.level.block.entity.BlockEntity from, net.minecraft.core.Direction direction, ItemStackHolder to, long amount, boolean simulate) Moves energy from one energy container to anotherstatic longmoveEnergy(net.minecraft.world.level.block.entity.BlockEntity from, net.minecraft.world.level.block.entity.BlockEntity to, long amount, boolean simulate) Moves energy from one energy container to anotherstatic longmoveEnergy(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos fromPos, @Nullable net.minecraft.core.Direction fromDirection, net.minecraft.core.BlockPos toPos, @Nullable net.minecraft.core.Direction toDirection, long amount, boolean simulate) static voidregisterEnergyBlock(BotariumEnergyBlock<?> getter, Supplier<net.minecraft.world.level.block.Block>... blocks) static voidregisterEnergyBlock(Supplier<net.minecraft.world.level.block.Block> block, BotariumEnergyBlock<?> getter) static voidregisterEnergyBlockEntity(BotariumEnergyBlock<?> getter, Supplier<net.minecraft.world.level.block.entity.BlockEntityType<?>>... blocks) static voidregisterEnergyBlockEntity(Supplier<net.minecraft.world.level.block.entity.BlockEntityType<?>> block, BotariumEnergyBlock<?> getter) static voidregisterEnergyItem(BotariumEnergyItem<?> getter, Supplier<net.minecraft.world.item.Item>... items) static voidregisterEnergyItem(Supplier<net.minecraft.world.item.Item> item, BotariumEnergyItem<?> getter)
-
Constructor Details
-
EnergyApi
public EnergyApi()
-
-
Method Details
-
getBlockEntityRegistry
public static Map<net.minecraft.world.level.block.entity.BlockEntityType<?>,BotariumEnergyBlock<?>> getBlockEntityRegistry() -
getBlockRegistry
-
getItemRegistry
-
getEnergyBlock
-
getEnergyBlock
public static BotariumEnergyBlock<?> getEnergyBlock(net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntity) -
getEnergyItem
-
getAPIEnergyContainer
public static <T extends EnergyContainer> T getAPIEnergyContainer(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state, @Nullable @Nullable net.minecraft.world.level.block.entity.BlockEntity entity, @Nullable @Nullable net.minecraft.core.Direction direction) -
registerEnergyBlockEntity
public static void registerEnergyBlockEntity(Supplier<net.minecraft.world.level.block.entity.BlockEntityType<?>> block, BotariumEnergyBlock<?> getter) -
registerEnergyBlockEntity
@SafeVarargs public static void registerEnergyBlockEntity(BotariumEnergyBlock<?> getter, Supplier<net.minecraft.world.level.block.entity.BlockEntityType<?>>... blocks) -
registerEnergyBlock
public static void registerEnergyBlock(Supplier<net.minecraft.world.level.block.Block> block, BotariumEnergyBlock<?> getter) -
registerEnergyBlock
@SafeVarargs public static void registerEnergyBlock(BotariumEnergyBlock<?> getter, Supplier<net.minecraft.world.level.block.Block>... blocks) -
registerEnergyItem
public static void registerEnergyItem(Supplier<net.minecraft.world.item.Item> item, BotariumEnergyItem<?> getter) -
registerEnergyItem
@SafeVarargs public static void registerEnergyItem(BotariumEnergyItem<?> getter, Supplier<net.minecraft.world.item.Item>... items) -
distributeEnergyNearby
public static long distributeEnergyNearby(net.minecraft.world.level.block.entity.BlockEntity energyBlock, @Nullable @Nullable net.minecraft.core.Direction extractDirection, long amount) Automatically transfers energy from an energy block to surrounding blocks- Parameters:
energyBlock- A block entity that is an instance ofBotariumEnergyBlockextractDirection- The direction to extract energy from the energy blockamount- The total amount that will be distributed as equally it can be. If one block cannot receive all the energy, it will be distributed evenly to the other blocks.- Returns:
- The amount of energy that was distributed
-
distributeEnergyNearby
public static long distributeEnergyNearby(net.minecraft.world.level.block.entity.BlockEntity energyBlock, long amount) Automatically transfers energy from an energy block to surrounding blocks- Parameters:
energyBlock- A block entity that is an instance ofBotariumEnergyBlockamount- The total amount that will be distributed as equally it can be. If one block cannot receive all the energy, it will be distributed evenly to the other blocks.- Returns:
- The amount of energy that was distributed
-
distributeEnergyNearby
public static long distributeEnergyNearby(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos energyPos, @Nullable @Nullable net.minecraft.core.Direction extractDirection, long amount) Automatically transfers energy from an energy block to surrounding blocks- Parameters:
level- The level of the energy blockenergyPos- The position of the energy blockamount- The total amount that will be distributed as equally it can be. If one block cannot receive all the energy, it will be distributed evenly to the other blocks.extractDirection- The direction to extract energy from the energy block- Returns:
- The amount of energy that was distributed
-
moveEnergy
public static long moveEnergy(EnergyContainer from, EnergyContainer to, long amount, boolean simulate) Moves energy from one energy container to another- Parameters:
from- The energy container to move energy fromto- The energy container to move energy toamount- The amount of energy to move- Returns:
- The amount of energy that was moved
-
moveEnergy
public static long moveEnergy(ItemStackHolder from, ItemStackHolder to, long amount, boolean simulate) Moves energy from one energy container to another- Parameters:
from- The energy container to move energy fromto- The energy container to move energy toamount- The amount of energy to move- Returns:
- The amount of energy that was moved
-
moveEnergy
public static long moveEnergy(net.minecraft.world.level.block.entity.BlockEntity from, net.minecraft.world.level.block.entity.BlockEntity to, long amount, boolean simulate) Moves energy from one energy container to another- Parameters:
from- The energy container to move energy fromto- The energy container to move energy toamount- The amount of energy to move- Returns:
- The amount of energy that was moved
-
moveEnergy
public static long moveEnergy(net.minecraft.world.level.Level level, net.minecraft.core.BlockPos fromPos, @Nullable @Nullable net.minecraft.core.Direction fromDirection, net.minecraft.core.BlockPos toPos, @Nullable @Nullable net.minecraft.core.Direction toDirection, long amount, boolean simulate) -
moveEnergy
public static long moveEnergy(net.minecraft.world.level.block.entity.BlockEntity from, net.minecraft.core.Direction direction, ItemStackHolder to, long amount, boolean simulate) Moves energy from one energy container to another- Parameters:
from- The energy container to move energy fromto- The energy container to move energy toamount- The amount of energy to move- Returns:
- The amount of energy that was moved
-
moveEnergy
public static long moveEnergy(ItemStackHolder from, net.minecraft.world.level.block.entity.BlockEntity to, net.minecraft.core.Direction direction, long amount, boolean simulate) Moves energy from one energy container to another- Parameters:
from- The energy container to move energy fromto- The energy container to move energy toamount- The amount of energy to move- Returns:
- The amount of energy that was moved
-