Update for 1.16.5
This commit is contained in:
parent
68721965eb
commit
344ae127a9
23
build.gradle
23
build.gradle
|
@ -1,5 +1,5 @@
|
||||||
plugins {
|
plugins {
|
||||||
id 'fabric-loom' version '0.2.6-SNAPSHOT'
|
id 'fabric-loom' version '0.6-SNAPSHOT'
|
||||||
id 'maven-publish'
|
id 'maven-publish'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,11 @@ group = project.maven_group
|
||||||
minecraft {
|
minecraft {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url "https://maven.shedaniel.me/" }
|
||||||
|
maven { url "https://maven.terraformersmc.com/releases/" }
|
||||||
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
//to change the versions see the gradle.properties file
|
//to change the versions see the gradle.properties file
|
||||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||||
|
@ -20,12 +25,16 @@ dependencies {
|
||||||
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||||
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
implementation 'com.google.code.findbugs:jsr305:3.0.2'
|
||||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
|
||||||
|
|
||||||
modCompile "me.sargunvohra.mcmods:autoconfig1u:2.0"
|
modApi("me.shedaniel.cloth:cloth-config-fabric:4.11.18") {
|
||||||
include "me.sargunvohra.mcmods:autoconfig1u:2.0"
|
exclude(group: "net.fabricmc.fabric-api")
|
||||||
modApi "me.shedaniel.cloth:config-2:2.13.1"
|
}
|
||||||
include "me.shedaniel.cloth:config-2:2.13.1"
|
modApi("com.terraformersmc:modmenu:1.16.8")
|
||||||
modImplementation "io.github.prospector:modmenu:1.10.0+build.28"
|
//modCompile "me.sargunvohra.mcmods:autoconfig1u:2.0"
|
||||||
|
//include "me.sargunvohra.mcmods:autoconfig1u:2.0"
|
||||||
|
//modApi "me.shedaniel.cloth:config-2:2.13.1"
|
||||||
|
//include "me.shedaniel.cloth:config-2:2.13.1"
|
||||||
|
//modImplementation "io.github.prospector:modmenu:1.10.0+build.28"
|
||||||
}
|
}
|
||||||
|
|
||||||
processResources {
|
processResources {
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
org.gradle.jvmargs = -Xmx1G
|
org.gradle.jvmargs = -Xmx1G
|
||||||
|
|
||||||
#Fabric properties
|
#Fabric properties
|
||||||
minecraft_version = 1.15.2
|
minecraft_version = 1.16.5
|
||||||
yarn_mappings = 1.15.2+build.15
|
yarn_mappings = 1.16.5+build.6
|
||||||
loader_version = 0.8.2+build.194
|
loader_version = 0.11.3
|
||||||
|
|
||||||
#Mod properties
|
#Mod properties
|
||||||
mod_version = 0.8.0
|
mod_version = 0.9.0
|
||||||
maven_group = quimufu.simple_creator
|
maven_group = quimufu.simple_creator
|
||||||
archives_base_name = simple_creator
|
archives_base_name = simple_creator
|
||||||
|
|
||||||
#Dependencies
|
#Dependencies
|
||||||
fabric_api_version = 0.5.12+build.296-1.15
|
fabric_api_version = 0.32.5+1.16
|
||||||
|
|
|
@ -4,6 +4,9 @@ import com.google.common.collect.Maps;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.GsonBuilder;
|
import com.google.gson.GsonBuilder;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
||||||
|
import net.fabricmc.fabric.api.registry.FlammableBlockRegistry;
|
||||||
|
import net.fabricmc.fabric.mixin.object.builder.AbstractBlockSettingsAccessor;
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.block.piston.PistonBehavior;
|
import net.minecraft.block.piston.PistonBehavior;
|
||||||
import net.minecraft.item.BlockItem;
|
import net.minecraft.item.BlockItem;
|
||||||
|
@ -16,7 +19,6 @@ import net.minecraft.util.Pair;
|
||||||
import net.minecraft.util.registry.Registry;
|
import net.minecraft.util.registry.Registry;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import static quimufu.simple_creator.SimpleCreatorMod.log;
|
import static quimufu.simple_creator.SimpleCreatorMod.log;
|
||||||
|
@ -58,7 +60,7 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
//build material
|
//build material
|
||||||
material = getSettings(mspj);
|
material = getSettings(mspj);
|
||||||
} else {
|
} else {
|
||||||
material = Material.EARTH;
|
material = Material.SOIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get block information
|
// get block information
|
||||||
|
@ -74,29 +76,23 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
Block resB = new Block(bs);
|
Block resB = new Block(bs);
|
||||||
Item resI = new BlockItem(resB, new Item.Settings().group(g));
|
Item resI = new BlockItem(resB, new Item.Settings().group(g));
|
||||||
|
|
||||||
FireBlock fireBlock = (FireBlock) Blocks.FIRE;
|
|
||||||
|
|
||||||
int burnChance = JsonHelper.getInt(jo,"burnChance", -1);
|
int burnChance = JsonHelper.getInt(jo,"burnChance", -1);
|
||||||
int spreadChance = JsonHelper.getInt(jo,"spreadChance", -1);
|
int spreadChance = JsonHelper.getInt(jo,"spreadChance", -1);
|
||||||
if(burnChance!=-1 && spreadChance!=-1){
|
if(burnChance!=-1 && spreadChance!=-1){
|
||||||
//spreadChance and burnChance are the wrong way around in yarn
|
FlammableBlockRegistry.getDefaultInstance().add(resB, spreadChance, burnChance);
|
||||||
fireBlock.registerFlammableBlock(resB, spreadChance, burnChance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return new Pair<>(resB, resI);
|
return new Pair<>(resB, resI);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Material getSettings(MaterialSettingsPojo mspj) {
|
private Material getSettings(MaterialSettingsPojo mspj) {
|
||||||
return new Material(
|
return new Material(
|
||||||
MaterialColor.PINK,
|
getMaterialColor(mspj.materialColor),
|
||||||
mspj.liquid,
|
mspj.liquid,
|
||||||
mspj.solid,
|
mspj.solid,
|
||||||
mspj.blocksMovement,
|
mspj.blocksMovement,
|
||||||
mspj.blocksLight,
|
mspj.blocksLight,
|
||||||
mspj.breakByHand,
|
mspj.breakByHand,
|
||||||
mspj.burnable,
|
mspj.burnable,
|
||||||
mspj.replaceable,
|
|
||||||
getPistonBehavior(mspj.pistonBehavior));
|
getPistonBehavior(mspj.pistonBehavior));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -123,7 +119,8 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
private MaterialColor getMaterialColor(String color) {
|
private MaterialColor getMaterialColor(String color) {
|
||||||
switch (color.toUpperCase()) {
|
switch (color.toUpperCase()) {
|
||||||
case "AIR":
|
case "AIR":
|
||||||
return MaterialColor.AIR;
|
case "CLEAR":
|
||||||
|
return MaterialColor.CLEAR;
|
||||||
case "GRASS":
|
case "GRASS":
|
||||||
return MaterialColor.GRASS;
|
return MaterialColor.GRASS;
|
||||||
case "SAND":
|
case "SAND":
|
||||||
|
@ -226,6 +223,21 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
return MaterialColor.RED_TERRACOTTA;
|
return MaterialColor.RED_TERRACOTTA;
|
||||||
case "BLACK_TERRACOTTA":
|
case "BLACK_TERRACOTTA":
|
||||||
return MaterialColor.BLACK_TERRACOTTA;
|
return MaterialColor.BLACK_TERRACOTTA;
|
||||||
|
case "CRIMSON_NYLIUM":
|
||||||
|
return MaterialColor.field_25702;
|
||||||
|
case "CRIMSON_WOOD":
|
||||||
|
return MaterialColor.field_25703;
|
||||||
|
case "CRIMSON_HYPHAE":
|
||||||
|
return MaterialColor.field_25704;
|
||||||
|
case "WARPED_NYLIUM":
|
||||||
|
return MaterialColor.field_25705;
|
||||||
|
case "WARPED_WOOD":
|
||||||
|
return MaterialColor.field_25706;
|
||||||
|
case "WARPED_HYPHAE":
|
||||||
|
return MaterialColor.field_25707;
|
||||||
|
case "WARPED_WART_BLOCK":
|
||||||
|
return MaterialColor.field_25708;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
log(Level.WARN, "MapColor " + color + " not found, using pink");
|
log(Level.WARN, "MapColor " + color + " not found, using pink");
|
||||||
return MaterialColor.PINK;
|
return MaterialColor.PINK;
|
||||||
|
@ -233,37 +245,21 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
}
|
}
|
||||||
|
|
||||||
private Block.Settings getSettings(Material material, BlockSettingsPojo bspj) {
|
private Block.Settings getSettings(Material material, BlockSettingsPojo bspj) {
|
||||||
Block.Settings bs = Block.Settings.of(material, material.getColor());
|
FabricBlockSettings fabricBlockSettings = FabricBlockSettings.of(material, material.getColor());
|
||||||
Field[] fields = Block.Settings.class.getDeclaredFields();
|
AbstractBlockSettingsAccessor bs = (AbstractBlockSettingsAccessor) fabricBlockSettings;
|
||||||
try {
|
bs.setMaterial(material);
|
||||||
fields[0].setAccessible(true);
|
bs.setMaterialColorFactory(ignored -> material.getColor());
|
||||||
fields[0].set(bs, material);
|
bs.setCollidable(bspj.collidable);
|
||||||
fields[1].setAccessible(true);
|
fabricBlockSettings.sounds(getSoundGroup(bspj.soundGroup));
|
||||||
fields[1].set(bs, getMaterialColor(bspj.mapColor));
|
bs.setLuminanceFunction(ignored -> bspj.lightLevel);
|
||||||
fields[2].setAccessible(true);
|
bs.setResistance(bspj.explosionResistance);
|
||||||
fields[2].setBoolean(bs, bspj.collidable);
|
bs.setHardness(bspj.hardness);
|
||||||
fields[3].setAccessible(true);
|
fabricBlockSettings.slipperiness(bspj.slipperiness);
|
||||||
fields[3].set(bs, getSoundGroup(bspj.soundGroup));
|
fabricBlockSettings.velocityMultiplier(bspj.slowDownMultiplier);
|
||||||
fields[4].setAccessible(true);
|
fabricBlockSettings.jumpVelocityMultiplier(bspj.jumpVelocityMultiplier);
|
||||||
fields[4].setInt(bs, bspj.lightLevel);
|
bs.setLootTableId(getDropTableId(bspj.dropTableId));
|
||||||
fields[5].setAccessible(true);
|
bs.setOpaque(bspj.opaque);
|
||||||
fields[5].setFloat(bs, bspj.explosionResistance);
|
return fabricBlockSettings;
|
||||||
fields[6].setAccessible(true);
|
|
||||||
fields[6].setFloat(bs, bspj.hardness);
|
|
||||||
fields[8].setAccessible(true);
|
|
||||||
fields[8].setFloat(bs, bspj.slipperiness);
|
|
||||||
fields[9].setAccessible(true);
|
|
||||||
fields[9].setFloat(bs, bspj.slowDownMultiplier);
|
|
||||||
fields[10].setAccessible(true);
|
|
||||||
fields[10].setFloat(bs, bspj.jumpVelocityMultiplier);
|
|
||||||
fields[11].setAccessible(true);
|
|
||||||
fields[11].set(bs, getDropTableId(bspj.dropTableId));
|
|
||||||
fields[12].setAccessible(true);
|
|
||||||
fields[12].setBoolean(bs, bspj.opaque);
|
|
||||||
} catch (IllegalAccessException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
return bs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Identifier getDropTableId(String s) {
|
private Identifier getDropTableId(String s) {
|
||||||
|
@ -285,6 +281,8 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
return BlockSoundGroup.GRAVEL;
|
return BlockSoundGroup.GRAVEL;
|
||||||
case "GRASS":
|
case "GRASS":
|
||||||
return BlockSoundGroup.GRASS;
|
return BlockSoundGroup.GRASS;
|
||||||
|
case "LILY_PAD":
|
||||||
|
return BlockSoundGroup.LILY_PAD;
|
||||||
case "STONE":
|
case "STONE":
|
||||||
return BlockSoundGroup.STONE;
|
return BlockSoundGroup.STONE;
|
||||||
case "METAL":
|
case "METAL":
|
||||||
|
@ -321,10 +319,56 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
return BlockSoundGroup.CROP;
|
return BlockSoundGroup.CROP;
|
||||||
case "STEM":
|
case "STEM":
|
||||||
return BlockSoundGroup.STEM;
|
return BlockSoundGroup.STEM;
|
||||||
|
case "VINE":
|
||||||
|
return BlockSoundGroup.VINE;
|
||||||
case "NETHER_WART":
|
case "NETHER_WART":
|
||||||
return BlockSoundGroup.NETHER_WART;
|
return BlockSoundGroup.NETHER_WART;
|
||||||
case "LANTERN":
|
case "LANTERN":
|
||||||
return BlockSoundGroup.LANTERN;
|
return BlockSoundGroup.LANTERN;
|
||||||
|
case "NETHER_STEM":
|
||||||
|
return BlockSoundGroup.NETHER_STEM;
|
||||||
|
case "NYLIUM":
|
||||||
|
return BlockSoundGroup.NYLIUM;
|
||||||
|
case "FUNGUS":
|
||||||
|
return BlockSoundGroup.FUNGUS;
|
||||||
|
case "ROOTS":
|
||||||
|
return BlockSoundGroup.ROOTS;
|
||||||
|
case "SHROOMLIGHT":
|
||||||
|
return BlockSoundGroup.SHROOMLIGHT;
|
||||||
|
case "WEEPING_VINES":
|
||||||
|
return BlockSoundGroup.WEEPING_VINES;
|
||||||
|
case "WEEPING_VINES_LOW_PITCH":
|
||||||
|
return BlockSoundGroup.WEEPING_VINES_LOW_PITCH;
|
||||||
|
case "SOUL_SAND":
|
||||||
|
return BlockSoundGroup.SOUL_SAND;
|
||||||
|
case "SOUL_SOIL":
|
||||||
|
return BlockSoundGroup.SOUL_SOIL;
|
||||||
|
case "BASALT":
|
||||||
|
return BlockSoundGroup.BASALT;
|
||||||
|
case "WART_BLOCK":
|
||||||
|
return BlockSoundGroup.WART_BLOCK;
|
||||||
|
case "NETHERRACK":
|
||||||
|
return BlockSoundGroup.NETHERRACK;
|
||||||
|
case "NETHER_BRICKS":
|
||||||
|
return BlockSoundGroup.NETHER_BRICKS;
|
||||||
|
case "NETHER_SPROUTS":
|
||||||
|
return BlockSoundGroup.NETHER_SPROUTS;
|
||||||
|
case "NETHER_ORE":
|
||||||
|
return BlockSoundGroup.NETHER_ORE;
|
||||||
|
case "BONE":
|
||||||
|
return BlockSoundGroup.BONE;
|
||||||
|
case "NETHERITE":
|
||||||
|
return BlockSoundGroup.NETHERITE;
|
||||||
|
case "ANCIENT_DEBRIS":
|
||||||
|
return BlockSoundGroup.ANCIENT_DEBRIS;
|
||||||
|
case "LODESTONE":
|
||||||
|
return BlockSoundGroup.LODESTONE;
|
||||||
|
case "CHAIN":
|
||||||
|
return BlockSoundGroup.CHAIN;
|
||||||
|
case "NETHER_GOLD_ORE":
|
||||||
|
return BlockSoundGroup.NETHER_GOLD_ORE;
|
||||||
|
case "GILDED_BLACKSTONE":
|
||||||
|
return BlockSoundGroup.GILDED_BLACKSTONE;
|
||||||
default:
|
default:
|
||||||
log(Level.WARN, "Sound group " + s + " not found, using stone");
|
log(Level.WARN, "Sound group " + s + " not found, using stone");
|
||||||
return BlockSoundGroup.STONE;
|
return BlockSoundGroup.STONE;
|
||||||
|
@ -347,40 +391,52 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
return Material.UNDERWATER_PLANT;
|
return Material.UNDERWATER_PLANT;
|
||||||
case "REPLACEABLE_PLANT":
|
case "REPLACEABLE_PLANT":
|
||||||
return Material.REPLACEABLE_PLANT;
|
return Material.REPLACEABLE_PLANT;
|
||||||
|
case "NETHER_SHOOTS":
|
||||||
|
return Material.NETHER_SHOOTS;
|
||||||
|
case "REPLACEABLE_UNDERWATER_PLANT":
|
||||||
case "SEAGRASS":
|
case "SEAGRASS":
|
||||||
return Material.SEAGRASS;
|
return Material.REPLACEABLE_UNDERWATER_PLANT;
|
||||||
case "WATER":
|
case "WATER":
|
||||||
return Material.WATER;
|
return Material.WATER;
|
||||||
case "BUBBLE_COLUMN":
|
case "BUBBLE_COLUMN":
|
||||||
return Material.BUBBLE_COLUMN;
|
return Material.BUBBLE_COLUMN;
|
||||||
case "LAVA":
|
case "LAVA":
|
||||||
return Material.LAVA;
|
return Material.LAVA;
|
||||||
|
case "SNOW_LAYER":
|
||||||
case "SNOW":
|
case "SNOW":
|
||||||
return Material.SNOW;
|
return Material.SNOW_LAYER;
|
||||||
case "FIRE":
|
case "FIRE":
|
||||||
return Material.FIRE;
|
return Material.FIRE;
|
||||||
|
case "SUPPORTED":
|
||||||
case "PART":
|
case "PART":
|
||||||
return Material.PART;
|
return Material.SUPPORTED;
|
||||||
case "COBWEB":
|
case "COBWEB":
|
||||||
return Material.COBWEB;
|
return Material.COBWEB;
|
||||||
case "REDSTONE_LAMP":
|
case "REDSTONE_LAMP":
|
||||||
return Material.REDSTONE_LAMP;
|
return Material.REDSTONE_LAMP;
|
||||||
|
case "ORGANIC_PRODUCT":
|
||||||
case "CLAY":
|
case "CLAY":
|
||||||
return Material.CLAY;
|
return Material.ORGANIC_PRODUCT;
|
||||||
|
case "SOIL":
|
||||||
case "EARTH":
|
case "EARTH":
|
||||||
return Material.EARTH;
|
return Material.SOIL;
|
||||||
|
case "SOLID_ORGANIC":
|
||||||
case "ORGANIC":
|
case "ORGANIC":
|
||||||
return Material.ORGANIC;
|
return Material.SOLID_ORGANIC;
|
||||||
|
case "DENSE_ICE":
|
||||||
case "PACKED_ICE":
|
case "PACKED_ICE":
|
||||||
return Material.PACKED_ICE;
|
return Material.DENSE_ICE;
|
||||||
|
case "AGGREGATE":
|
||||||
case "SAND":
|
case "SAND":
|
||||||
return Material.SAND;
|
return Material.AGGREGATE;
|
||||||
case "SPONGE":
|
case "SPONGE":
|
||||||
return Material.SPONGE;
|
return Material.SPONGE;
|
||||||
case "SHULKER_BOX":
|
case "SHULKER_BOX":
|
||||||
return Material.SHULKER_BOX;
|
return Material.SHULKER_BOX;
|
||||||
case "WOOD":
|
case "WOOD":
|
||||||
return Material.WOOD;
|
return Material.WOOD;
|
||||||
|
case "NETHER_WOOD":
|
||||||
|
return Material.NETHER_WOOD;
|
||||||
case "BAMBOO_SAPLING":
|
case "BAMBOO_SAPLING":
|
||||||
return Material.BAMBOO_SAPLING;
|
return Material.BAMBOO_SAPLING;
|
||||||
case "BAMBOO":
|
case "BAMBOO":
|
||||||
|
@ -403,16 +459,18 @@ public class BlockResourceLoader extends GenericManualResourceLoader<Pair<Block,
|
||||||
return Material.METAL;
|
return Material.METAL;
|
||||||
case "SNOW_BLOCK":
|
case "SNOW_BLOCK":
|
||||||
return Material.SNOW_BLOCK;
|
return Material.SNOW_BLOCK;
|
||||||
|
case "REPAIR_STATION":
|
||||||
case "ANVIL":
|
case "ANVIL":
|
||||||
return Material.ANVIL;
|
return Material.REPAIR_STATION;
|
||||||
case "BARRIER":
|
case "BARRIER":
|
||||||
return Material.BARRIER;
|
return Material.BARRIER;
|
||||||
case "PISTON":
|
case "PISTON":
|
||||||
return Material.PISTON;
|
return Material.PISTON;
|
||||||
case "UNUSED_PLANT":
|
case "UNUSED_PLANT":
|
||||||
return Material.UNUSED_PLANT;
|
return Material.UNUSED_PLANT;
|
||||||
|
case "GOURD":
|
||||||
case "PUMPKIN":
|
case "PUMPKIN":
|
||||||
return Material.PUMPKIN;
|
return Material.GOURD;
|
||||||
case "EGG":
|
case "EGG":
|
||||||
return Material.EGG;
|
return Material.EGG;
|
||||||
case "CAKE":
|
case "CAKE":
|
||||||
|
|
|
@ -5,7 +5,7 @@ import com.google.common.collect.Maps;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParseException;
|
import com.google.gson.JsonParseException;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;
|
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackCreator;
|
||||||
import net.minecraft.resource.*;
|
import net.minecraft.resource.*;
|
||||||
import net.minecraft.util.Identifier;
|
import net.minecraft.util.Identifier;
|
||||||
|
@ -16,7 +16,9 @@ import org.apache.logging.log4j.Level;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static net.minecraft.resource.ResourcePackSource.method_29486;
|
||||||
import static quimufu.simple_creator.SimpleCreatorMod.log;
|
import static quimufu.simple_creator.SimpleCreatorMod.log;
|
||||||
|
|
||||||
public abstract class GenericManualResourceLoader<T> {
|
public abstract class GenericManualResourceLoader<T> {
|
||||||
|
@ -50,11 +52,19 @@ public abstract class GenericManualResourceLoader<T> {
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
config = AutoConfig.getConfigHolder(SimpleCreatorConfig.class).getConfig();
|
config = AutoConfig.getConfigHolder(SimpleCreatorConfig.class).getConfig();
|
||||||
ResourcePackManager<ResourcePackProfile> resourcePackManager = new ResourcePackManager<>(ResourcePackProfile::new);
|
ResourcePackManager resourcePackManager;
|
||||||
resourcePackManager.registerProvider(new VanillaDataPackProvider());
|
if (!config.enableTestThings) {
|
||||||
resourcePackManager.registerProvider(new FileResourcePackProvider(new File("./datapacks")));
|
resourcePackManager =
|
||||||
if (config.enableTestThings)
|
new ResourcePackManager(ResourcePackProfile::new,
|
||||||
resourcePackManager.registerProvider(new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
new VanillaDataPackProvider(),
|
||||||
|
new FileResourcePackProvider(new File("./datapacks"), method_29486("pack.source.global")));
|
||||||
|
} else {
|
||||||
|
resourcePackManager =
|
||||||
|
new ResourcePackManager(ResourcePackProfile::new,
|
||||||
|
new VanillaDataPackProvider(),
|
||||||
|
new FileResourcePackProvider(new File("./datapacks"), method_29486("pack.source.global")),
|
||||||
|
new ModResourcePackCreator(ResourceType.SERVER_DATA));
|
||||||
|
}
|
||||||
resourcePackManager.scanPacks();
|
resourcePackManager.scanPacks();
|
||||||
List<ResourcePackProfile> ep = Lists.newArrayList(resourcePackManager.getEnabledProfiles());
|
List<ResourcePackProfile> ep = Lists.newArrayList(resourcePackManager.getEnabledProfiles());
|
||||||
for (ResourcePackProfile rpp : resourcePackManager.getProfiles()) {
|
for (ResourcePackProfile rpp : resourcePackManager.getProfiles()) {
|
||||||
|
@ -62,8 +72,7 @@ public abstract class GenericManualResourceLoader<T> {
|
||||||
rpp.getInitialPosition().insert(ep, rpp, resourcePackProfile -> resourcePackProfile, false);
|
rpp.getInitialPosition().insert(ep, rpp, resourcePackProfile -> resourcePackProfile, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resourcePackManager.setEnabledProfiles(ep);
|
resourcePackManager.setEnabledProfiles(ep.stream().map(ResourcePackProfile::getName).collect(Collectors.toList()));
|
||||||
|
|
||||||
|
|
||||||
ArrayList<Pair<Identifier, JsonObject>> itemJsonList = new ArrayList<>();
|
ArrayList<Pair<Identifier, JsonObject>> itemJsonList = new ArrayList<>();
|
||||||
HashMap<Identifier, JsonObject> itemJsonMap = Maps.newHashMap();
|
HashMap<Identifier, JsonObject> itemJsonMap = Maps.newHashMap();
|
||||||
|
|
|
@ -136,12 +136,12 @@ public class ItemResourceLoader extends GenericManualResourceLoader<Item> {
|
||||||
|
|
||||||
public static ItemGroup findGroup(String filter) {
|
public static ItemGroup findGroup(String filter) {
|
||||||
for (ItemGroup g : ItemGroup.GROUPS) {
|
for (ItemGroup g : ItemGroup.GROUPS) {
|
||||||
if (g.getName().toLowerCase().equals(filter.toLowerCase())) {
|
if (g.getName().equalsIgnoreCase(filter)) {
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log(Level.WARN, "Item Group " + filter + " not found, using misc");
|
log(Level.WARN, "Item Group " + filter + " not found, using misc");
|
||||||
log(Level.INFO, "Valid groups:" + Arrays.stream(ItemGroup.GROUPS).map(ItemGroup::getId));
|
log(Level.INFO, "Valid groups:" + Arrays.stream(ItemGroup.GROUPS).map(ItemGroup::getName));
|
||||||
return ItemGroup.MISC;
|
return ItemGroup.MISC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@ import net.minecraft.block.MaterialColor;
|
||||||
import net.minecraft.block.piston.PistonBehavior;
|
import net.minecraft.block.piston.PistonBehavior;
|
||||||
|
|
||||||
public class MaterialSettingsPojo {
|
public class MaterialSettingsPojo {
|
||||||
|
String materialColor = "PINK";
|
||||||
String pistonBehavior = "normal";
|
String pistonBehavior = "normal";
|
||||||
boolean blocksMovement = true;
|
boolean blocksMovement = true;
|
||||||
boolean burnable = false;
|
boolean burnable = false;
|
||||||
boolean breakByHand = true;
|
boolean breakByHand = true;
|
||||||
boolean liquid = false;
|
boolean liquid = false;
|
||||||
boolean replaceable = false;
|
|
||||||
boolean solid = true;
|
boolean solid = true;
|
||||||
boolean blocksLight = true;
|
boolean blocksLight = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package quimufu.simple_creator;
|
package quimufu.simple_creator;
|
||||||
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigData;
|
import me.shedaniel.autoconfig.ConfigData;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.annotation.Config;
|
import me.shedaniel.autoconfig.annotation.Config;
|
||||||
|
|
||||||
@Config(name = "simple_creator")
|
@Config(name = "simple_creator")
|
||||||
public class SimpleCreatorConfig implements ConfigData {
|
public class SimpleCreatorConfig implements ConfigData {
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package quimufu.simple_creator;
|
package quimufu.simple_creator;
|
||||||
|
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.ConfigHolder;
|
import me.shedaniel.autoconfig.serializer.GsonConfigSerializer;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.serializer.GsonConfigSerializer;
|
|
||||||
import net.fabricmc.api.ModInitializer;
|
import net.fabricmc.api.ModInitializer;
|
||||||
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.Level;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package quimufu.simple_creator;
|
package quimufu.simple_creator;
|
||||||
|
|
||||||
import io.github.prospector.modmenu.api.ConfigScreenFactory;
|
|
||||||
import io.github.prospector.modmenu.api.ModMenuApi;
|
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||||
import me.sargunvohra.mcmods.autoconfig1u.AutoConfig;
|
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||||
|
import me.shedaniel.autoconfig.AutoConfig;
|
||||||
import net.minecraft.client.gui.screen.Screen;
|
import net.minecraft.client.gui.screen.Screen;
|
||||||
|
|
||||||
public class SimpleCreatorModMenuIntegration implements ModMenuApi {
|
public class SimpleCreatorModMenuIntegration implements ModMenuApi {
|
||||||
@Override
|
|
||||||
public String getModId() {
|
|
||||||
return SimpleCreatorMod.MOD_ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user