Datapack driven limbo decay!
This commit is contained in:
parent
f2bba1a227
commit
809c686618
58 changed files with 1235 additions and 143 deletions
|
@ -9,6 +9,7 @@ import org.dimdev.dimdoors.criteria.ModCriteria;
|
||||||
import org.dimdev.dimdoors.item.ModItems;
|
import org.dimdev.dimdoors.item.ModItems;
|
||||||
|
|
||||||
import net.minecraft.Bootstrap;
|
import net.minecraft.Bootstrap;
|
||||||
|
import net.minecraft.SharedConstants;
|
||||||
import net.minecraft.data.DataGenerator;
|
import net.minecraft.data.DataGenerator;
|
||||||
|
|
||||||
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
import net.fabricmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||||
|
@ -24,6 +25,7 @@ public class DatagenInitializer implements PreLaunchEntrypoint {
|
||||||
@Override
|
@Override
|
||||||
public void onPreLaunch() {
|
public void onPreLaunch() {
|
||||||
try {
|
try {
|
||||||
|
SharedConstants.createGameVersion();
|
||||||
Bootstrap.initialize();
|
Bootstrap.initialize();
|
||||||
DimensionalDoorsInitializer.registerRegistries();
|
DimensionalDoorsInitializer.registerRegistries();
|
||||||
ModBlocks.init();
|
ModBlocks.init();
|
||||||
|
@ -35,6 +37,7 @@ public class DatagenInitializer implements PreLaunchEntrypoint {
|
||||||
dataGenerator.install(new LootTableProvider(dataGenerator));
|
dataGenerator.install(new LootTableProvider(dataGenerator));
|
||||||
dataGenerator.install(RECIPE_CONSUMER = new RecipeConsumer(dataGenerator));
|
dataGenerator.install(RECIPE_CONSUMER = new RecipeConsumer(dataGenerator));
|
||||||
dataGenerator.install(LOOT_TABLE_CONSUMER = new LootTableConsumer(dataGenerator));
|
dataGenerator.install(LOOT_TABLE_CONSUMER = new LootTableConsumer(dataGenerator));
|
||||||
|
dataGenerator.install(new LimboDecayProvider(dataGenerator));
|
||||||
dataGenerator.run();
|
dataGenerator.run();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
@ -0,0 +1,188 @@
|
||||||
|
package org.dimdev.dimdoors.datagen;
|
||||||
|
|
||||||
|
import static net.minecraft.block.Blocks.ACACIA_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.ACACIA_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.ACACIA_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.ANDESITE;
|
||||||
|
import static net.minecraft.block.Blocks.BIRCH_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.BIRCH_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.BIRCH_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.BLACKSTONE;
|
||||||
|
import static net.minecraft.block.Blocks.COAL_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.COAL_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.COBBLESTONE;
|
||||||
|
import static net.minecraft.block.Blocks.CRACKED_STONE_BRICKS;
|
||||||
|
import static net.minecraft.block.Blocks.DARK_OAK_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.DARK_OAK_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.DARK_OAK_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.DIORITE;
|
||||||
|
import static net.minecraft.block.Blocks.DIRT;
|
||||||
|
import static net.minecraft.block.Blocks.DIRT_PATH;
|
||||||
|
import static net.minecraft.block.Blocks.EMERALD_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.EMERALD_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.END_STONE;
|
||||||
|
import static net.minecraft.block.Blocks.END_STONE_BRICKS;
|
||||||
|
import static net.minecraft.block.Blocks.FARMLAND;
|
||||||
|
import static net.minecraft.block.Blocks.GLASS;
|
||||||
|
import static net.minecraft.block.Blocks.GOLD_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.GOLD_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.GRANITE;
|
||||||
|
import static net.minecraft.block.Blocks.GRASS_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.GRAVEL;
|
||||||
|
import static net.minecraft.block.Blocks.IRON_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.IRON_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.JUNGLE_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.JUNGLE_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.JUNGLE_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.LAPIS_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.LAPIS_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.OAK_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.OAK_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.OAK_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.PODZOL;
|
||||||
|
import static net.minecraft.block.Blocks.POLISHED_ANDESITE;
|
||||||
|
import static net.minecraft.block.Blocks.POLISHED_BLACKSTONE;
|
||||||
|
import static net.minecraft.block.Blocks.POLISHED_DIORITE;
|
||||||
|
import static net.minecraft.block.Blocks.POLISHED_GRANITE;
|
||||||
|
import static net.minecraft.block.Blocks.REDSTONE_BLOCK;
|
||||||
|
import static net.minecraft.block.Blocks.REDSTONE_ORE;
|
||||||
|
import static net.minecraft.block.Blocks.SAND;
|
||||||
|
import static net.minecraft.block.Blocks.SANDSTONE;
|
||||||
|
import static net.minecraft.block.Blocks.SPRUCE_LOG;
|
||||||
|
import static net.minecraft.block.Blocks.SPRUCE_PLANKS;
|
||||||
|
import static net.minecraft.block.Blocks.SPRUCE_WOOD;
|
||||||
|
import static net.minecraft.block.Blocks.STONE;
|
||||||
|
import static net.minecraft.block.Blocks.STONE_BRICKS;
|
||||||
|
import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPattern;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPredicate;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayProcessor;
|
||||||
|
import org.dimdev.dimdoors.world.decay.predicates.SimpleDecayPredicate;
|
||||||
|
import org.dimdev.dimdoors.world.decay.processors.SimpleDecayProcesor;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.data.DataCache;
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
|
import net.minecraft.data.DataProvider;
|
||||||
|
import net.minecraft.loot.LootManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class LimboDecayProvider implements DataProvider {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
private static final Gson GSON = (new GsonBuilder()).setPrettyPrinting().disableHtmlEscaping().create();
|
||||||
|
|
||||||
|
private final DataGenerator generator;
|
||||||
|
|
||||||
|
public LimboDecayProvider(DataGenerator generator) {
|
||||||
|
this.generator = generator;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(DataCache cache) throws IOException {
|
||||||
|
Path path = this.generator.getOutput();
|
||||||
|
|
||||||
|
BiConsumer<Identifier, JsonObject> consumer = (identifier, json) -> {
|
||||||
|
Path outputPath = getOutput(path, identifier);
|
||||||
|
|
||||||
|
try {
|
||||||
|
DataProvider.writeToPath(GSON, cache, json, outputPath);
|
||||||
|
} catch (IOException var6) {
|
||||||
|
LOGGER.error("Couldn't save decay pattern {}", outputPath, var6);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
createSimplePattern(new Identifier("dimdoors:stone"), STONE, COBBLESTONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:cobblestone"), COBBLESTONE, END_STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:gravel"), GRAVEL, SAND).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:sand"), SAND, UNRAVELLED_FABRIC).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:glass"), GLASS, SAND).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:grass_block"), GRASS_BLOCK, DIRT).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:dirt"), DIRT, SAND).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:redstone_block"), REDSTONE_BLOCK, REDSTONE_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:redstone_ore"), REDSTONE_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:emerald_block"), EMERALD_BLOCK, EMERALD_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:emerald_ore"), EMERALD_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:coal_block"), COAL_BLOCK, COAL_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:coal_ore"), COAL_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:iron_block"), IRON_BLOCK, IRON_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:iron_ore"), IRON_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:lapis_block"), LAPIS_BLOCK, LAPIS_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:lapis_ore"), LAPIS_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:gold_block"), GOLD_BLOCK, GOLD_ORE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:gold_ore"), GOLD_ORE, STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:sandstone"), SANDSTONE, SAND).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:end_stone_bricks"), END_STONE_BRICKS, END_STONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:dirt_path"), DIRT_PATH, DIRT).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:polished_granite"), POLISHED_GRANITE, GRANITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:polished_andesite"), POLISHED_ANDESITE, ANDESITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:andesite"), ANDESITE, DIORITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:polished_diorite"), POLISHED_DIORITE, DIORITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:granite"), GRANITE, DIORITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:diorite"), DIORITE, COBBLESTONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:polished_blackstone"), POLISHED_BLACKSTONE, BLACKSTONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:blackstone"), BLACKSTONE, COBBLESTONE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:podzol"), PODZOL, DIRT).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:farmland"), FARMLAND, DIRT).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:stone_bricks"), STONE_BRICKS, CRACKED_STONE_BRICKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:cracked_stone_bricks"), CRACKED_STONE_BRICKS, DIORITE).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:end_stone"), END_STONE, SAND).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:oak_log"), OAK_LOG, OAK_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:birch_log"), BIRCH_LOG, BIRCH_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:spruce_log"), SPRUCE_LOG, SPRUCE_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:jungle_log"), JUNGLE_LOG, JUNGLE_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:acacia_log"), ACACIA_LOG, ACACIA_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:dark_oak_log"), DARK_OAK_LOG, DARK_OAK_PLANKS).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:oak_wood"), OAK_WOOD, OAK_LOG).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:birch_wood"), BIRCH_WOOD, BIRCH_LOG).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:spruce_wood"), SPRUCE_WOOD, SPRUCE_LOG).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:jungle_wood"), JUNGLE_WOOD, JUNGLE_LOG).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:acacia_wood"), ACACIA_WOOD, ACACIA_LOG).run(consumer);
|
||||||
|
createSimplePattern(new Identifier("dimdoors:dark_oak_wood"), DARK_OAK_WOOD, DARK_OAK_LOG).run(consumer);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Limbo Decay";
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Path getOutput(Path rootOutput, Identifier lootTableId) {
|
||||||
|
return rootOutput.resolve("data/" + lootTableId.getNamespace() + "/decay_patterns/" + lootTableId.getPath() + ".json");
|
||||||
|
}
|
||||||
|
|
||||||
|
public DecayPatternData createSimplePattern(Identifier id, Block before, Block after) {
|
||||||
|
return new DecayPatternData(id, SimpleDecayPredicate.builder().block(before).create(), SimpleDecayProcesor.builder().block(after).entropy(1).create());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class DecayPatternData {
|
||||||
|
private Identifier id;
|
||||||
|
private DecayPredicate predicate;
|
||||||
|
private DecayProcessor processor;
|
||||||
|
|
||||||
|
public DecayPatternData(Identifier id, DecayPredicate predicate, DecayProcessor processor) {
|
||||||
|
this.id = id;
|
||||||
|
this.predicate = predicate;
|
||||||
|
this.processor = processor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run(BiConsumer<Identifier, JsonObject> consumer) {
|
||||||
|
JsonObject object = new JsonObject();
|
||||||
|
object.add("predicate", predicate.toJson(new JsonObject()));
|
||||||
|
object.add("processor", processor.toJson(new JsonObject()));
|
||||||
|
|
||||||
|
consumer.accept(id, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,9 +5,6 @@ import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import net.minecraft.enchantment.Enchantment;
|
|
||||||
import net.minecraft.enchantment.EnchantmentTarget;
|
|
||||||
import net.minecraft.entity.EquipmentSlot;
|
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
|
||||||
import me.shedaniel.autoconfig.AutoConfig;
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
|
@ -44,8 +41,11 @@ import org.dimdev.dimdoors.pockets.virtual.ImplementedVirtualPocket;
|
||||||
import org.dimdev.dimdoors.rift.targets.Targets;
|
import org.dimdev.dimdoors.rift.targets.Targets;
|
||||||
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
||||||
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
import org.dimdev.dimdoors.sound.ModSoundEvents;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayLoader;
|
||||||
import org.dimdev.dimdoors.world.ModBiomes;
|
import org.dimdev.dimdoors.world.ModBiomes;
|
||||||
import org.dimdev.dimdoors.world.ModDimensions;
|
import org.dimdev.dimdoors.world.ModDimensions;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPredicate;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayProcessor;
|
||||||
import org.dimdev.dimdoors.world.feature.ModFeatures;
|
import org.dimdev.dimdoors.world.feature.ModFeatures;
|
||||||
import org.dimdev.dimdoors.world.pocket.type.AbstractPocket;
|
import org.dimdev.dimdoors.world.pocket.type.AbstractPocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon;
|
import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon;
|
||||||
|
@ -139,6 +139,7 @@ public class DimensionalDoorsInitializer implements ModInitializer {
|
||||||
dimensionalDoorBlockRegistrar = new DimensionalDoorBlockRegistrar(Registry.BLOCK, dimensionalDoorItemRegistrar);
|
dimensionalDoorBlockRegistrar = new DimensionalDoorBlockRegistrar(Registry.BLOCK, dimensionalDoorItemRegistrar);
|
||||||
|
|
||||||
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(PocketLoader.getInstance());
|
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(PocketLoader.getInstance());
|
||||||
|
ResourceManagerHelper.get(ResourceType.SERVER_DATA).registerReloadListener(DecayLoader.getInstance());
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("dimdoors", "default"), dimDoorsMod, CONFIG_MANAGER.get().getPocketsConfig().defaultPocketsResourcePackActivationType.asResourcePackActivationType());
|
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("dimdoors", "default"), dimDoorsMod, CONFIG_MANAGER.get().getPocketsConfig().defaultPocketsResourcePackActivationType.asResourcePackActivationType());
|
||||||
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("dimdoors", "classic"), dimDoorsMod, CONFIG_MANAGER.get().getPocketsConfig().classicPocketsResourcePackActivationType.asResourcePackActivationType());
|
ResourceManagerHelper.registerBuiltinResourcePack(new Identifier("dimdoors", "classic"), dimDoorsMod, CONFIG_MANAGER.get().getPocketsConfig().classicPocketsResourcePackActivationType.asResourcePackActivationType());
|
||||||
|
|
||||||
|
@ -155,6 +156,8 @@ public class DimensionalDoorsInitializer implements ModInitializer {
|
||||||
AbstractPocket.AbstractPocketType.register();
|
AbstractPocket.AbstractPocketType.register();
|
||||||
PocketAddon.PocketAddonType.register();
|
PocketAddon.PocketAddonType.register();
|
||||||
Condition.ConditionType.register();
|
Condition.ConditionType.register();
|
||||||
|
DecayPredicate.DecayPredicateType.register();
|
||||||
|
DecayProcessor.DecayProcessorType.register();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerListeners() {
|
private void registerListeners() {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import org.dimdev.dimdoors.pockets.generator.PocketGenerator;
|
||||||
import org.dimdev.dimdoors.pockets.modifier.Modifier;
|
import org.dimdev.dimdoors.pockets.modifier.Modifier;
|
||||||
import org.dimdev.dimdoors.pockets.virtual.ImplementedVirtualPocket;
|
import org.dimdev.dimdoors.pockets.virtual.ImplementedVirtualPocket;
|
||||||
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
import org.dimdev.dimdoors.rift.targets.VirtualTarget;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPredicate;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayProcessor;
|
||||||
import org.dimdev.dimdoors.world.pocket.type.AbstractPocket;
|
import org.dimdev.dimdoors.world.pocket.type.AbstractPocket;
|
||||||
import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon;
|
import org.dimdev.dimdoors.world.pocket.type.addon.PocketAddon;
|
||||||
|
|
||||||
|
@ -34,4 +36,10 @@ public interface DimensionalDoorsApi {
|
||||||
}
|
}
|
||||||
|
|
||||||
default void postInitialize() {}
|
default void postInitialize() {}
|
||||||
|
|
||||||
|
default void registerDecayProcessors(Registry<DecayProcessor.DecayProcessorType<? extends DecayProcessor>> registry) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void registerDecayPredicates(Registry<DecayPredicate.DecayPredicateType<? extends DecayPredicate>> registry) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,77 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.dimdev.dimdoors.api.util.Path;
|
||||||
|
import org.dimdev.dimdoors.api.util.SimpleTree;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||||
|
|
||||||
|
public class DecayLoader implements SimpleSynchronousResourceReloadListener {
|
||||||
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
|
private static final Gson GSON = new GsonBuilder().setLenient().setPrettyPrinting().create();
|
||||||
|
private static final DecayLoader INSTANCE = new DecayLoader();
|
||||||
|
private SimpleTree<String, DecayPattern> patterns = new SimpleTree<>(String.class);
|
||||||
|
|
||||||
|
private DecayLoader() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DecayLoader getInstance() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reload(ResourceManager manager) {
|
||||||
|
patterns.clear();
|
||||||
|
CompletableFuture<SimpleTree<String, DecayPattern>> futurePatternMap = loadResourcePathFromJsonToTree(manager, "decay_patterns", this::loadPattern);
|
||||||
|
patterns = futurePatternMap.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
private DecayPattern loadPattern(JsonObject object) {
|
||||||
|
return DecayPattern.deserialize(object);
|
||||||
|
}
|
||||||
|
|
||||||
|
private <T> CompletableFuture<SimpleTree<String, T>> loadResourcePathFromJsonToTree(ResourceManager manager, String startingPath, Function<JsonObject, T> reader) {
|
||||||
|
int sub = startingPath.endsWith("/") ? 0 : 1;
|
||||||
|
|
||||||
|
Collection<Identifier> ids = manager.findResources(startingPath, str -> str.endsWith(".json"));
|
||||||
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
|
SimpleTree<String, T> tree = new SimpleTree<>(String.class);
|
||||||
|
tree.putAll(ids.parallelStream().unordered().collect(Collectors.toConcurrentMap(
|
||||||
|
id -> Path.stringPath(id.getNamespace() + ":" + id.getPath().substring(0, id.getPath().lastIndexOf(".")).substring(startingPath.length() + sub)),
|
||||||
|
id -> {
|
||||||
|
try {
|
||||||
|
JsonElement json = GSON.fromJson(new InputStreamReader(manager.getResource(id).getInputStream()), JsonElement.class);
|
||||||
|
return reader.apply(json.getAsJsonObject());
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Error loading resource: " + id);
|
||||||
|
}
|
||||||
|
})));
|
||||||
|
return tree;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public @NotNull Collection<DecayPattern> getPatterns() {
|
||||||
|
return patterns.values();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Identifier getFabricId() {
|
||||||
|
return new Identifier("dimdoors", "decay_pattern");
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,69 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.dimdev.dimdoors.world.decay.predicates.SimpleDecayPredicate;
|
||||||
|
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.Event;
|
||||||
|
import net.fabricmc.fabric.api.event.EventFactory;
|
||||||
|
|
||||||
|
public class DecayPattern {
|
||||||
|
public static final Event<EntropyEvent> ENTROPY_EVENT = EventFactory.createArrayBacked(EntropyEvent.class, (world, pos, entorpy) -> { System.out.println("Entorpy value of " + entorpy + " at " + pos + " in " + world.getRegistryKey().getValue()); }, entropyEvents -> (world, pos, entorpy) -> {
|
||||||
|
for (EntropyEvent event : entropyEvents) event.entropy(world, pos, entorpy);
|
||||||
|
});
|
||||||
|
|
||||||
|
private DecayPredicate predicate;
|
||||||
|
private DecayProcessor processor;
|
||||||
|
|
||||||
|
public DecayPattern() {}
|
||||||
|
|
||||||
|
public DecayPattern(DecayPredicate predicate, DecayProcessor processor) {
|
||||||
|
this.predicate = predicate;
|
||||||
|
this.processor = processor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DecayPattern deserialize(JsonObject nbt) {
|
||||||
|
DecayPredicate predicate = DecayPredicate.deserialize(nbt.getAsJsonObject("predicate"));
|
||||||
|
DecayProcessor processor = DecayProcessor.deserialize(nbt.getAsJsonObject("processor"));
|
||||||
|
return DecayPattern.builder().predicate(predicate).processor(processor).create();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean run(World world, BlockPos pos) {
|
||||||
|
if(predicate.test(world, pos)) {
|
||||||
|
ENTROPY_EVENT.invoker().entropy(world, pos, processor.process(world, pos));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DecayPattern.Builder builder() {
|
||||||
|
return new DecayPattern.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private DecayPredicate predicate = DecayPredicate.DUMMY;
|
||||||
|
private DecayProcessor processor = DecayProcessor.DUMMY;
|
||||||
|
|
||||||
|
public Builder predicate(DecayPredicate predicate) {
|
||||||
|
this.predicate = predicate;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder processor(DecayProcessor processor) {
|
||||||
|
this.processor = processor;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DecayPattern create() {
|
||||||
|
return new DecayPattern(predicate, processor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private interface EntropyEvent {
|
||||||
|
void entropy(World world, BlockPos pos, int entorpy);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,96 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.mojang.serialization.Lifecycle;
|
||||||
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
|
import org.dimdev.dimdoors.world.decay.predicates.SimpleDecayPredicate;
|
||||||
|
import org.dimdev.dimdoors.world.decay.processors.SimpleDecayProcesor;
|
||||||
|
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
import net.minecraft.util.registry.SimpleRegistry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
|
||||||
|
|
||||||
|
public interface DecayPredicate {
|
||||||
|
Registry<DecayPredicateType<? extends DecayPredicate>> REGISTRY = FabricRegistryBuilder.from(new SimpleRegistry<DecayPredicateType<? extends DecayPredicate>>(RegistryKey.ofRegistry(new Identifier("dimdoors", "decay_predicate_type")), Lifecycle.stable())).buildAndRegister();
|
||||||
|
|
||||||
|
DecayPredicate DUMMY = new DecayPredicate() {
|
||||||
|
private static final String ID = "none";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayPredicate fromJson(JsonObject json) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayPredicateType<? extends DecayPredicate> getType() {
|
||||||
|
return DecayPredicateType.NONE_PREDICATE_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(World world, BlockPos pos) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
static DecayPredicate deserialize(JsonObject nbt) {
|
||||||
|
Identifier id = Identifier.tryParse(nbt.get("type").getAsString());
|
||||||
|
return REGISTRY.getOrEmpty(id).orElse(DecayPredicateType.NONE_PREDICATE_TYPE).fromJson(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JsonObject serialize(DecayPredicate modifier) {
|
||||||
|
return modifier.toJson(new JsonObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DecayPredicate fromJson(JsonObject json);
|
||||||
|
|
||||||
|
default JsonObject toJson(JsonObject json) {
|
||||||
|
return this.getType().toJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
DecayPredicate.DecayPredicateType<? extends DecayPredicate> getType();
|
||||||
|
|
||||||
|
String getKey();
|
||||||
|
|
||||||
|
boolean test(World world, BlockPos pos);
|
||||||
|
|
||||||
|
interface DecayPredicateType<T extends DecayPredicate> {
|
||||||
|
DecayPredicateType<DecayPredicate> NONE_PREDICATE_TYPE = register(new Identifier("dimdoors", "none"), () -> DUMMY);
|
||||||
|
DecayPredicateType<SimpleDecayPredicate> SIMPLE_PREDICATE_TYPE = register(new Identifier("dimdoors", SimpleDecayProcesor.KEY), SimpleDecayPredicate::new);
|
||||||
|
|
||||||
|
DecayPredicate fromJson(JsonObject nbt);
|
||||||
|
|
||||||
|
JsonObject toJson(JsonObject nbt);
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
DimensionalDoorsInitializer.apiSubscribers.forEach(d -> d.registerDecayPredicates(REGISTRY));
|
||||||
|
}
|
||||||
|
|
||||||
|
static <U extends DecayPredicate> DecayPredicateType<U> register(Identifier id, Supplier<U> factory) {
|
||||||
|
return Registry.register(REGISTRY, id, new DecayPredicateType<U>() {
|
||||||
|
@Override
|
||||||
|
public DecayPredicate fromJson(JsonObject json) {
|
||||||
|
return factory.get().fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonObject toJson(JsonObject json) {
|
||||||
|
json.addProperty("type", id.toString());
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,107 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay;
|
||||||
|
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.mojang.serialization.Lifecycle;
|
||||||
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
|
import org.dimdev.dimdoors.ModConfig;
|
||||||
|
import org.dimdev.dimdoors.pockets.PocketGenerationContext;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.AbsoluteRiftBlockEntityModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.DimensionalDoorModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.OffsetModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.PocketEntranceModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.RelativeReferenceModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.RiftDataModifier;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.RiftManager;
|
||||||
|
import org.dimdev.dimdoors.pockets.modifier.ShellModifier;
|
||||||
|
import org.dimdev.dimdoors.world.decay.processors.SimpleDecayProcesor;
|
||||||
|
import org.dimdev.dimdoors.world.pocket.type.Pocket;
|
||||||
|
|
||||||
|
import net.minecraft.nbt.NbtCompound;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.util.registry.RegistryKey;
|
||||||
|
import net.minecraft.util.registry.SimpleRegistry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import net.fabricmc.fabric.api.event.registry.FabricRegistryBuilder;
|
||||||
|
|
||||||
|
public interface DecayProcessor {
|
||||||
|
Registry<DecayProcessor.DecayProcessorType<? extends DecayProcessor>> REGISTRY = FabricRegistryBuilder.from(new SimpleRegistry<DecayProcessor.DecayProcessorType<? extends DecayProcessor>>(RegistryKey.ofRegistry(new Identifier("dimdoors", "decay_processor_type")), Lifecycle.stable())).buildAndRegister();
|
||||||
|
|
||||||
|
DecayProcessor DUMMY = new DecayProcessor() {
|
||||||
|
@Override
|
||||||
|
public DecayProcessor fromJson(JsonObject json) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayProcessorType<? extends DecayProcessor> getType() {
|
||||||
|
return DecayProcessor.DecayProcessorType.NONE_PROCESSOR_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int process(World world, BlockPos pos) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String ID = "none";
|
||||||
|
};
|
||||||
|
|
||||||
|
static DecayProcessor deserialize(JsonObject nbt) {
|
||||||
|
Identifier id = Identifier.tryParse(nbt.get("type").getAsString());
|
||||||
|
return REGISTRY.getOrEmpty(id).orElse(DecayProcessorType.NONE_PROCESSOR_TYPE).fromJson(nbt);
|
||||||
|
}
|
||||||
|
|
||||||
|
static JsonObject serialize(DecayProcessor modifier) {
|
||||||
|
return modifier.toJson(new JsonObject());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
DecayProcessor fromJson(JsonObject json);
|
||||||
|
|
||||||
|
default JsonObject toJson(JsonObject json) {
|
||||||
|
return this.getType().toJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
DecayProcessor.DecayProcessorType<? extends DecayProcessor> getType();
|
||||||
|
|
||||||
|
String getKey();
|
||||||
|
|
||||||
|
int process(World world, BlockPos pos);
|
||||||
|
|
||||||
|
interface DecayProcessorType<T extends DecayProcessor> {
|
||||||
|
DecayProcessorType<SimpleDecayProcesor> SIMPLE_PROCESSOR_TYPE = register(new Identifier("dimdoors", SimpleDecayProcesor.KEY), SimpleDecayProcesor::new);
|
||||||
|
DecayProcessorType<DecayProcessor> NONE_PROCESSOR_TYPE = register(new Identifier("dimdoors", "none"), () -> DUMMY);
|
||||||
|
|
||||||
|
DecayProcessor fromJson(JsonObject nbt);
|
||||||
|
|
||||||
|
JsonObject toJson(JsonObject nbt);
|
||||||
|
|
||||||
|
static void register() {
|
||||||
|
DimensionalDoorsInitializer.apiSubscribers.forEach(d -> d.registerDecayProcessors(REGISTRY));
|
||||||
|
}
|
||||||
|
|
||||||
|
static <U extends DecayProcessor> DecayProcessorType<U> register(Identifier id, Supplier<U> factory) {
|
||||||
|
return Registry.register(REGISTRY, id, new DecayProcessorType<U>() {
|
||||||
|
@Override
|
||||||
|
public DecayProcessor fromJson(JsonObject json) {
|
||||||
|
return factory.get().fromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonObject toJson(JsonObject json) {
|
||||||
|
json.addProperty("type", id.toString());
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,71 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay.predicates;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPredicate;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SimpleDecayPredicate implements DecayPredicate {
|
||||||
|
public static final String KEY = "simple";
|
||||||
|
|
||||||
|
private Block block;
|
||||||
|
|
||||||
|
public SimpleDecayPredicate() {}
|
||||||
|
|
||||||
|
private SimpleDecayPredicate(Block block) {
|
||||||
|
this.block = block;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayPredicate fromJson(JsonObject json) {
|
||||||
|
block = Registry.BLOCK.get(Identifier.tryParse(json.get("block").getAsString()));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonObject toJson(JsonObject json) {
|
||||||
|
DecayPredicate.super.toJson(json);
|
||||||
|
json.addProperty("block", Registry.BLOCK.getId(block).toString());
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayPredicateType<? extends DecayPredicate> getType() {
|
||||||
|
return DecayPredicateType.SIMPLE_PREDICATE_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean test(World world, BlockPos pos) {
|
||||||
|
BlockState state = world.getBlockState(pos);
|
||||||
|
|
||||||
|
return state.getBlock() == block;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private Block block = Blocks.AIR;
|
||||||
|
|
||||||
|
public Builder block(Block block) {
|
||||||
|
this.block = block;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleDecayPredicate create() {
|
||||||
|
return new SimpleDecayPredicate(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
package org.dimdev.dimdoors.world.decay.processors;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayProcessor;
|
||||||
|
import org.dimdev.dimdoors.world.decay.predicates.SimpleDecayPredicate;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
|
import net.minecraft.block.Blocks;
|
||||||
|
import net.minecraft.util.Identifier;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
import net.minecraft.util.registry.Registry;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
public class SimpleDecayProcesor implements DecayProcessor {
|
||||||
|
public static final String KEY = "simple";
|
||||||
|
|
||||||
|
private Block block;
|
||||||
|
|
||||||
|
private int entropy;
|
||||||
|
|
||||||
|
public SimpleDecayProcesor() {}
|
||||||
|
|
||||||
|
private SimpleDecayProcesor(Block block, int entropy) {
|
||||||
|
this.block = block;
|
||||||
|
this.entropy = entropy;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayProcessor fromJson(JsonObject json) {
|
||||||
|
block = Registry.BLOCK.get(Identifier.tryParse(json.get("block").getAsString()));
|
||||||
|
entropy = json.get("entropy").getAsInt();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public JsonObject toJson(JsonObject json) {
|
||||||
|
DecayProcessor.super.toJson(json);
|
||||||
|
json.addProperty("block", Registry.BLOCK.getId(block).toString());
|
||||||
|
json.addProperty("entropy", entropy);
|
||||||
|
return json;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DecayProcessorType<? extends DecayProcessor> getType() {
|
||||||
|
return DecayProcessorType.SIMPLE_PROCESSOR_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getKey() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int process(World world, BlockPos pos) {
|
||||||
|
world.setBlockState(pos, block.getDefaultState());
|
||||||
|
return entropy;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static SimpleDecayProcesor.Builder builder() {
|
||||||
|
return new SimpleDecayProcesor.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Builder {
|
||||||
|
private Block block = Blocks.AIR;
|
||||||
|
private int entropy;
|
||||||
|
|
||||||
|
public SimpleDecayProcesor.Builder block(Block block) {
|
||||||
|
this.block = block;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleDecayProcesor.Builder entropy(int entropy) {
|
||||||
|
this.entropy = entropy;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SimpleDecayProcesor create() {
|
||||||
|
return new SimpleDecayProcesor(block, entropy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -17,15 +18,18 @@ import com.google.gson.JsonObject;
|
||||||
import com.mojang.serialization.Codec;
|
import com.mojang.serialization.Codec;
|
||||||
import com.mojang.serialization.JsonOps;
|
import com.mojang.serialization.JsonOps;
|
||||||
import com.mojang.serialization.codecs.UnboundedMapCodec;
|
import com.mojang.serialization.codecs.UnboundedMapCodec;
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import net.fabricmc.fabric.api.resource.SimpleSynchronousResourceReloadListener;
|
||||||
|
|
||||||
|
import net.minecraft.resource.ResourceManager;
|
||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
import org.dimdev.dimdoors.DimensionalDoorsInitializer;
|
||||||
import org.dimdev.dimdoors.block.door.data.DoorData;
|
import org.dimdev.dimdoors.world.decay.DecayLoader;
|
||||||
|
import org.dimdev.dimdoors.world.decay.DecayPattern;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
|
||||||
import net.minecraft.block.BlockWithEntity;
|
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
|
@ -34,7 +38,6 @@ import net.minecraft.world.World;
|
||||||
import static net.minecraft.block.Blocks.ACACIA_LOG;
|
import static net.minecraft.block.Blocks.ACACIA_LOG;
|
||||||
import static net.minecraft.block.Blocks.ACACIA_PLANKS;
|
import static net.minecraft.block.Blocks.ACACIA_PLANKS;
|
||||||
import static net.minecraft.block.Blocks.ACACIA_WOOD;
|
import static net.minecraft.block.Blocks.ACACIA_WOOD;
|
||||||
import static net.minecraft.block.Blocks.AIR;
|
|
||||||
import static net.minecraft.block.Blocks.ANDESITE;
|
import static net.minecraft.block.Blocks.ANDESITE;
|
||||||
import static net.minecraft.block.Blocks.BIRCH_LOG;
|
import static net.minecraft.block.Blocks.BIRCH_LOG;
|
||||||
import static net.minecraft.block.Blocks.BIRCH_PLANKS;
|
import static net.minecraft.block.Blocks.BIRCH_PLANKS;
|
||||||
|
@ -85,10 +88,6 @@ import static net.minecraft.block.Blocks.SPRUCE_PLANKS;
|
||||||
import static net.minecraft.block.Blocks.SPRUCE_WOOD;
|
import static net.minecraft.block.Blocks.SPRUCE_WOOD;
|
||||||
import static net.minecraft.block.Blocks.STONE;
|
import static net.minecraft.block.Blocks.STONE;
|
||||||
import static net.minecraft.block.Blocks.STONE_BRICKS;
|
import static net.minecraft.block.Blocks.STONE_BRICKS;
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.DETACHED_RIFT;
|
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.ETERNAL_FLUID;
|
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.GOLD_DOOR;
|
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.QUARTZ_DOOR;
|
|
||||||
import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -97,55 +96,8 @@ import static org.dimdev.dimdoors.block.ModBlocks.UNRAVELLED_FABRIC;
|
||||||
*/
|
*/
|
||||||
public final class LimboDecay {
|
public final class LimboDecay {
|
||||||
private static final Logger LOGGER = LogManager.getLogger();
|
private static final Logger LOGGER = LogManager.getLogger();
|
||||||
private static final UnboundedMapCodec<Block, Block> CODEC = Codec.unboundedMap(Identifier.CODEC.xmap(Registry.BLOCK::get, Registry.BLOCK::getId), Registry.BLOCK);
|
|
||||||
private static final Consumer<String> STDERR = System.err::println;
|
|
||||||
private static final Map<Block, Block> DECAY_SEQUENCE = new HashMap<>();
|
|
||||||
private static final Map<Block, Block> DEFAULT_VALUES;
|
|
||||||
private static final Gson GSON = new GsonBuilder().setLenient().setPrettyPrinting().create();
|
|
||||||
private static final Path CONFIG_PATH = DimensionalDoorsInitializer.getConfigRoot().resolve("limbo_decay.json");
|
|
||||||
|
|
||||||
public static void init() {
|
|
||||||
try {
|
|
||||||
JsonObject configObject = null;
|
|
||||||
if (Files.isDirectory(CONFIG_PATH)) {
|
|
||||||
Files.delete(CONFIG_PATH);
|
|
||||||
}
|
|
||||||
if (!Files.exists(CONFIG_PATH)) {
|
|
||||||
Files.createFile(CONFIG_PATH);
|
|
||||||
JsonObject jsonObject = CODEC.encodeStart(JsonOps.INSTANCE, DEFAULT_VALUES).getOrThrow(false, STDERR).getAsJsonObject();
|
|
||||||
configObject = jsonObject;
|
|
||||||
String json = GSON.toJson(jsonObject);
|
|
||||||
Files.write(CONFIG_PATH, json.getBytes());
|
|
||||||
DECAY_SEQUENCE.clear();
|
|
||||||
DECAY_SEQUENCE.putAll(DEFAULT_VALUES);
|
|
||||||
}
|
|
||||||
if (configObject == null) {
|
|
||||||
try (BufferedReader reader = Files.newBufferedReader(CONFIG_PATH)) {
|
|
||||||
configObject = GSON.fromJson(reader, JsonObject.class);
|
|
||||||
Map<Block, Block> blocks = CODEC.decode(JsonOps.INSTANCE, configObject).getOrThrow(false, STDERR).getFirst();
|
|
||||||
DECAY_SEQUENCE.clear();
|
|
||||||
DECAY_SEQUENCE.putAll(blocks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final Random RANDOM = new Random();
|
private static final Random RANDOM = new Random();
|
||||||
private static Block[] blocksImmuneToDecay = null;
|
|
||||||
|
|
||||||
public static Map<Block, Block> getDecaySequence() {
|
|
||||||
return DECAY_SEQUENCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Block[] getBlocksImmuneToDecay() {
|
|
||||||
if (blocksImmuneToDecay == null) {
|
|
||||||
blocksImmuneToDecay = ArrayUtils.addAll(DoorData.DOORS.toArray(new Block[0]), UNRAVELLED_FABRIC, ETERNAL_FLUID, DETACHED_RIFT, GOLD_DOOR, QUARTZ_DOOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
return blocksImmuneToDecay;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
* Checks the blocks orthogonally around a given location (presumably the location of an Unraveled Fabric block)
|
||||||
|
@ -173,94 +125,14 @@ public final class LimboDecay {
|
||||||
* Checks if a block can be decayed and, if so, changes it to the next block ID along the decay sequence.
|
* Checks if a block can be decayed and, if so, changes it to the next block ID along the decay sequence.
|
||||||
*/
|
*/
|
||||||
private static boolean decayBlock(World world, BlockPos pos) {
|
private static boolean decayBlock(World world, BlockPos pos) {
|
||||||
BlockState state = world.getBlockState(pos);
|
@NotNull Collection<DecayPattern> patterns = DecayLoader.getInstance().getPatterns();
|
||||||
|
|
||||||
if (canDecayBlock(state, world, pos)) {
|
if(patterns.isEmpty()) return false;
|
||||||
//Loop over the block IDs that decay can go through.
|
|
||||||
//Find an index matching the current blockID, if any.
|
|
||||||
|
|
||||||
if (getDecaySequence().containsKey(state.getBlock())) {
|
for (DecayPattern pattern : DecayLoader.getInstance().getPatterns()) {
|
||||||
Block decay = getDecaySequence().get(state.getBlock());
|
if(pattern.run(world, pos)) return true;
|
||||||
world.setBlockState(pos, decay.getDefaultState());
|
|
||||||
} else if (!state.isFullCube(world, pos)) {
|
|
||||||
world.setBlockState(pos, AIR.getDefaultState());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if a block can decay. We will not decay air, certain DD blocks, or containers.
|
|
||||||
*/
|
|
||||||
private static boolean canDecayBlock(BlockState state, World world, BlockPos pos) {
|
|
||||||
if (world.isAir(pos)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int k = 0; k < getBlocksImmuneToDecay().length; k++) {
|
|
||||||
if (state.getBlock().equals(getBlocksImmuneToDecay()[k])) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return !(state.getBlock() instanceof BlockWithEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
static {
|
|
||||||
ImmutableMap.Builder<Block, Block> builder = ImmutableMap.builder();
|
|
||||||
BiConsumer<Block, Block> blockBiConsumer = builder::put;
|
|
||||||
|
|
||||||
blockBiConsumer.accept(STONE, COBBLESTONE);
|
|
||||||
blockBiConsumer.accept(COBBLESTONE, END_STONE);
|
|
||||||
blockBiConsumer.accept(GRAVEL, SAND);
|
|
||||||
blockBiConsumer.accept(SAND, UNRAVELLED_FABRIC);
|
|
||||||
blockBiConsumer.accept(GLASS, SAND);
|
|
||||||
blockBiConsumer.accept(GRASS_BLOCK, DIRT);
|
|
||||||
blockBiConsumer.accept(DIRT, SAND);
|
|
||||||
blockBiConsumer.accept(REDSTONE_BLOCK, REDSTONE_ORE);
|
|
||||||
blockBiConsumer.accept(REDSTONE_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(EMERALD_BLOCK, EMERALD_ORE);
|
|
||||||
blockBiConsumer.accept(EMERALD_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(COAL_BLOCK, COAL_ORE);
|
|
||||||
blockBiConsumer.accept(COAL_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(IRON_BLOCK, IRON_ORE);
|
|
||||||
blockBiConsumer.accept(IRON_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(LAPIS_BLOCK, LAPIS_ORE);
|
|
||||||
blockBiConsumer.accept(LAPIS_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(GOLD_BLOCK, GOLD_ORE);
|
|
||||||
blockBiConsumer.accept(GOLD_ORE, STONE);
|
|
||||||
blockBiConsumer.accept(SANDSTONE, SAND);
|
|
||||||
blockBiConsumer.accept(END_STONE_BRICKS, END_STONE);
|
|
||||||
blockBiConsumer.accept(DIRT_PATH, DIRT);
|
|
||||||
blockBiConsumer.accept(POLISHED_GRANITE, GRANITE);
|
|
||||||
blockBiConsumer.accept(POLISHED_ANDESITE, ANDESITE);
|
|
||||||
blockBiConsumer.accept(ANDESITE, DIORITE);
|
|
||||||
blockBiConsumer.accept(POLISHED_DIORITE, DIORITE);
|
|
||||||
blockBiConsumer.accept(GRANITE, DIORITE);
|
|
||||||
blockBiConsumer.accept(DIORITE, COBBLESTONE);
|
|
||||||
blockBiConsumer.accept(POLISHED_BLACKSTONE, BLACKSTONE);
|
|
||||||
blockBiConsumer.accept(BLACKSTONE, COBBLESTONE);
|
|
||||||
blockBiConsumer.accept(PODZOL, DIRT);
|
|
||||||
blockBiConsumer.accept(FARMLAND, DIRT);
|
|
||||||
blockBiConsumer.accept(STONE_BRICKS, CRACKED_STONE_BRICKS);
|
|
||||||
blockBiConsumer.accept(CRACKED_STONE_BRICKS, DIORITE);
|
|
||||||
blockBiConsumer.accept(END_STONE, SAND);
|
|
||||||
blockBiConsumer.accept(OAK_LOG, OAK_PLANKS);
|
|
||||||
blockBiConsumer.accept(BIRCH_LOG, BIRCH_PLANKS);
|
|
||||||
blockBiConsumer.accept(SPRUCE_LOG, SPRUCE_PLANKS);
|
|
||||||
blockBiConsumer.accept(JUNGLE_LOG, JUNGLE_PLANKS);
|
|
||||||
blockBiConsumer.accept(ACACIA_LOG, ACACIA_PLANKS);
|
|
||||||
blockBiConsumer.accept(DARK_OAK_LOG, DARK_OAK_PLANKS);
|
|
||||||
blockBiConsumer.accept(OAK_WOOD, OAK_LOG);
|
|
||||||
blockBiConsumer.accept(BIRCH_WOOD, BIRCH_LOG);
|
|
||||||
blockBiConsumer.accept(SPRUCE_WOOD, SPRUCE_LOG);
|
|
||||||
blockBiConsumer.accept(JUNGLE_WOOD, JUNGLE_LOG);
|
|
||||||
blockBiConsumer.accept(ACACIA_WOOD, ACACIA_LOG);
|
|
||||||
blockBiConsumer.accept(DARK_OAK_WOOD, DARK_OAK_LOG);
|
|
||||||
|
|
||||||
DEFAULT_VALUES = builder.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:acacia_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:acacia_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:acacia_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:acacia_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:andesite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:diorite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:birch_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:birch_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:birch_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:birch_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:blackstone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cobblestone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:coal_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:coal_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:coal_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cobblestone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:end_stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cracked_stone_bricks"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:diorite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dark_oak_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dark_oak_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dark_oak_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dark_oak_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/diorite.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/diorite.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:diorite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cobblestone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/dirt.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/dirt.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt_path"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:emerald_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:emerald_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:emerald_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:end_stone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:end_stone_bricks"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:end_stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:farmland"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/glass.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/glass.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:glass"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:gold_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:gold_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:gold_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/granite.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/granite.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:granite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:diorite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:grass_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/gravel.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/gravel.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:gravel"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:iron_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:iron_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:iron_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:jungle_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:jungle_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:jungle_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:jungle_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:lapis_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:lapis_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:lapis_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/oak_log.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/oak_log.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:oak_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:oak_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:oak_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:oak_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/podzol.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/podzol.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:podzol"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:dirt",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:polished_andesite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:andesite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:polished_blackstone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:blackstone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:polished_diorite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:diorite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:polished_granite"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:granite",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:redstone_block"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:redstone_ore",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:redstone_ore"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/sand.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/sand.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "dimdoors:unravelled_fabric",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sandstone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:sand",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:spruce_log"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:spruce_planks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:spruce_wood"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:spruce_log",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
11
src/main/resources/data/dimdoors/decay_patterns/stone.json
Normal file
11
src/main/resources/data/dimdoors/decay_patterns/stone.json
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cobblestone",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
{
|
||||||
|
"predicate": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:stone_bricks"
|
||||||
|
},
|
||||||
|
"processor": {
|
||||||
|
"type": "dimdoors:simple",
|
||||||
|
"block": "minecraft:cracked_stone_bricks",
|
||||||
|
"entropy": 1
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue