Class EnergyApi

java.lang.Object
earth.terrarium.botarium.common.energy.EnergyApi

public class EnergyApi extends Object
  • Constructor Details

    • EnergyApi

      public EnergyApi()
  • Method Details

    • getBlockEntityRegistry

      public static Map<net.minecraft.world.level.block.entity.BlockEntityType<?>,BotariumEnergyBlock<?>> getBlockEntityRegistry()
    • getBlockRegistry

      public static Map<net.minecraft.world.level.block.Block,BotariumEnergyBlock<?>> getBlockRegistry()
    • getItemRegistry

      public static Map<net.minecraft.world.item.Item,BotariumEnergyItem<?>> getItemRegistry()
    • getEnergyBlock

      public static BotariumEnergyBlock<?> getEnergyBlock(net.minecraft.world.level.block.Block block)
    • getEnergyBlock

      public static BotariumEnergyBlock<?> getEnergyBlock(net.minecraft.world.level.block.entity.BlockEntityType<?> blockEntity)
    • getEnergyItem

      public static BotariumEnergyItem<?> getEnergyItem(net.minecraft.world.item.Item item)
    • 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 of BotariumEnergyBlock
      extractDirection - The direction to extract energy from the energy block
      amount - 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 of BotariumEnergyBlock
      amount - 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 block
      energyPos - The position of the energy block
      amount - 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 from
      to - The energy container to move energy to
      amount - 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 from
      to - The energy container to move energy to
      amount - 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 from
      to - The energy container to move energy to
      amount - 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 from
      to - The energy container to move energy to
      amount - 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 from
      to - The energy container to move energy to
      amount - The amount of energy to move
      Returns:
      The amount of energy that was moved