|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
package com.thebrokenrail.energonrelics.block.entity.forcefield.laser;
|
|
|
|
|
package com.thebrokenrail.energonrelics.registry.laser;
|
|
|
|
|
|
|
|
|
|
import com.thebrokenrail.energonrelics.EnergonRelics;
|
|
|
|
|
import com.thebrokenrail.energonrelics.config.HardcodedConfig;
|
|
|
|
@ -13,10 +13,19 @@ import java.util.Map;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Industrial Laser Registry
|
|
|
|
|
*/
|
|
|
|
|
public class IndustrialLaserRegistry {
|
|
|
|
|
private static final Map<Block, Function<Random, ItemStack>> map = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
private static void add(Block ore, Item ingot, Block storage) {
|
|
|
|
|
/**
|
|
|
|
|
* Add To Registry
|
|
|
|
|
* @param ore Ore Block
|
|
|
|
|
* @param ingot Ingot Item
|
|
|
|
|
* @param storage Storage Block
|
|
|
|
|
*/
|
|
|
|
|
public static void add(Block ore, Item ingot, Block storage) {
|
|
|
|
|
map.put(ore, random -> {
|
|
|
|
|
int min = HardcodedConfig.INDUSTRIAL_LASER_MIN_INGOTS_FROM_ORE;
|
|
|
|
|
int max = HardcodedConfig.INDUSTRIAL_LASER_MAX_INGOTS_FROM_ORE;
|
|
|
|
@ -28,11 +37,22 @@ public class IndustrialLaserRegistry {
|
|
|
|
|
map.put(storage, random -> new ItemStack(ingot, HardcodedConfig.INDUSTRIAL_LASER_INGOTS_FROM_STORAGE));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static boolean has(Block block) {
|
|
|
|
|
/**
|
|
|
|
|
* Check If Registry Contains Block
|
|
|
|
|
* @param block Block
|
|
|
|
|
* @return If Registry Contains Block
|
|
|
|
|
*/
|
|
|
|
|
public static boolean has(Block block) {
|
|
|
|
|
return map.containsKey(block);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static ItemStack get(Block block, Random random) {
|
|
|
|
|
/**
|
|
|
|
|
* Get From Registry
|
|
|
|
|
* @param block Block
|
|
|
|
|
* @param random Random
|
|
|
|
|
* @return Output Item(s)
|
|
|
|
|
*/
|
|
|
|
|
public static ItemStack get(Block block, Random random) {
|
|
|
|
|
return map.get(block).apply(random);
|
|
|
|
|
}
|
|
|
|
|
|