101e9e4ce6
Completed enough of the implementation and integration to compile DD. Some portions of the code are only for testing and will be removed later. The configuration for default dungeons is hardcoded - we can parse config files once we're certain that dungeon chains work. At the moment, dungeons generate but it doesn't seem like the rules we set are being followed properly. Renamed OptimizedRule to DungeonChainRule, and renamed the old DungeonChainRule to DungeonChainRuleDefinition, to match the role of each class better. Added some hax to DungeonGenerator to get packs integrated - the implementation will be much cleaner once the new save format is done.
31 lines
799 B
Java
31 lines
799 B
Java
package StevenDimDoors.mod_pocketDim.util;
|
|
|
|
import net.minecraft.util.WeightedRandomItem;
|
|
|
|
/*.
|
|
* Implements a simple generic item for using net.minecraft.util.WeightedRandom with objects of type T.
|
|
*
|
|
* This is generally useful for cases in which we already extend an existing class, which prevents us from also
|
|
* extending WeightedRandomItem or cases in which we would have to break compatibility with previous serialized
|
|
* instances to add support for WeightedRandomItem.
|
|
*/
|
|
public class WeightedContainer<T> extends WeightedRandomItem {
|
|
|
|
private T data;
|
|
|
|
public WeightedContainer(T data, int weight)
|
|
{
|
|
super(weight);
|
|
this.data = data;
|
|
}
|
|
|
|
public T getData()
|
|
{
|
|
return data;
|
|
}
|
|
|
|
public WeightedContainer<T> clone()
|
|
{
|
|
return new WeightedContainer<T>(data, itemWeight);
|
|
}
|
|
}
|