Add More JavaDoc
EnergonRelics/pipeline/head This commit looks good Details

This commit is contained in:
TheBrokenRail 2020-08-04 18:27:04 -04:00
parent 3a8fa37f12
commit 96f7dd2fce
3 changed files with 31 additions and 0 deletions

View File

@ -4,10 +4,24 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryKey;
import net.minecraft.world.World;
/**
* Block Position Including Dimension
*/
public class BlockPosWithDimension {
/**
* Position
*/
public final BlockPos pos;
/**
* Dimension
*/
public final RegistryKey<World> dimension;
/**
* Create
* @param pos Position
* @param dimension Dimension
*/
public BlockPosWithDimension(BlockPos pos, RegistryKey<World> dimension) {
this.pos = pos;
this.dimension = dimension;

View File

@ -1,5 +1,8 @@
package com.thebrokenrail.energonrelics.util;
/**
* Missing Switch Case Exception
*/
public class MissingCaseException extends RuntimeException {
public MissingCaseException(Enum<?> value) {
super(value.name());

View File

@ -4,13 +4,27 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Random;
/**
* Weighted List
* @param <T> Entry Type
*/
public class WeightedList<T> {
private final Map<T, Integer> map = new HashMap<>();
/**
* Add Entry
* @param weight Weight
* @param obj Entry
*/
public void add(int weight, T obj) {
map.put(obj, weight);
}
/**
* Pick Entry
* @param random Random
* @return Entry
*/
public T pick(Random random) {
int totalWeight = 0;
for (Map.Entry<T, Integer> entry : map.entrySet()) {