Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/AddBlockLootTable #16

Merged
merged 2 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ dependencies {
implementation fg.deobf("curse.maven:just-enough-characters-250702:${justEnoughCharacters_id}")

implementation fg.deobf("curse.maven:kiwi-303657:${kiwi_fileId}")
implementation("org.apache.commons:commons-io:1.3.2")
// annotationProcessor "curse.maven:kiwi-303657:${kiwi_fileId}"
// Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/hechu/mindustry/Mindustry.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
@Mod(MindustryConstants.MOD_ID)
public class Mindustry {
public Mindustry() {
MindustryConstants.config_folder = FMLPaths.GAMEDIR.get().resolve("config/" + MindustryConstants.MOD_ID);
Utils.checkFolder(MindustryConstants.config_folder);
MindustryConstants.configFolder = FMLPaths.GAMEDIR.get().resolve("config/" + MindustryConstants.MOD_ID);
Utils.checkFolder(MindustryConstants.configFolder);
MindustryConstants.commonConfig = ConfigHandler.readConfig("common", CommonConfig.class);
// IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();

Expand Down
41 changes: 31 additions & 10 deletions src/main/java/com/hechu/mindustry/MindustryConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,42 @@
public class MindustryConstants {
public static final Logger logger = LogUtils.getLogger();
public static final String MOD_ID = "mindustry";
public static Path config_folder;
public static Path configFolder;
public static CommonConfig commonConfig;

/**
* 鐢ㄤ簬瑙勮寖缈昏瘧鏂囨。
*/
public static final String CHAT = "chat." + MOD_ID + ".";
public static final String CHAT_WARN = CHAT + "warning.";
public static final String CHAT_INFO = CHAT + "info.";
public static final String CHAT_COMMAND = CHAT + "command.";
public enum Chat {
CHAT("chat." + MOD_ID),
CHAT_WARN(CHAT.msg + ".warning."),
CHAT_INFO(CHAT.msg + ".info."),
CHAT_COMMAND(CHAT.msg + ".command.");
public final String msg;

public static final String DESC = "desc." + MOD_ID + ".";
public static final String DESC_INFO = DESC + "info.";
public static final String DESC_FLAVOUR = DESC + "flavour.";
Chat(String string) {
msg = string;
}
}

public static final String GUI = "gui." + MOD_ID + ".";
public static final String GUI_CONFIG = "gui." + MOD_ID + ".config.";
public enum Desc {
DESC("desc." + MOD_ID),
DESC_INFO(DESC.msg + ".info."),
DESC_FLAVOUR(DESC.msg + ".flavour.");
public final String msg;

Desc(String string) {
msg = string;
}
}

public enum Gui {
GUI("gui." + MOD_ID),
GUI_CONFIG(GUI.msg + ".config.");
public final String msg;

Gui(String string) {
msg = string;
}
}
}
5 changes: 4 additions & 1 deletion src/main/java/com/hechu/mindustry/config/CommonConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@

import java.nio.file.Path;

public class CommonConfig extends Config{
public class CommonConfig extends Config {
public CommonConfig(String configName, Path configPath) {
super(configName, configPath);
}

@Expose()
@SerializedName("common")
private Common common = new Common();

public Common getCommon() {
return this.common;
}

public static class Common {
@Expose()
@SerializedName("mining_speed")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class ConfigHandler {
@Nullable
public static <T extends Config> T readConfig(String configName, Class<T> configClass) {
configName = "%s_%s".formatted(MOD_ID, configName);
Path configPath = config_folder.resolve("%s.json".formatted(configName));
Path configPath = configFolder.resolve("%s.json".formatted(configName));
if (configPath.toFile().isFile()) {
try {
return GSON.fromJson(FileUtils.readFileToString(configPath.toFile(), StandardCharsets.UTF_8),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public boolean isEmpty() {
itemStack = itemStackFromJson(jsonObject);
} else if (jsonObject.has("tag")) {
//TODO
throw new JsonParseException("MindustryProcessingIngredient 暂不支持 Tag");
throw new JsonParseException("MindustryProcessingIngredient Tag");
// ResourceLocation resourcelocation = new ResourceLocation(GsonHelper.getAsString(json, "tag"));
// TagKey<Item> tagkey = TagKey.create(Registries.ITEM, resourcelocation);
// return new TagValue(tagkey);
Expand Down Expand Up @@ -92,7 +92,7 @@ public static MindustryProcessingIngredient of(ItemLike item, int count) {
}

public static @NotNull MindustryProcessingIngredient of(TagKey<Item> tag) {
throw new NotImplementedException("MindustryProcessingIngredient 暂不支持 Tag");
throw new NotImplementedException("MindustryProcessingIngredient 锟捷诧拷支锟斤拷 Tag");
}

public static MindustryProcessingIngredient of(ItemStack itemStack) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public MindustryProcessingRecipe(ResourceLocation id, String group, int processT
}

/**
* 获取每个物品输入槽应该消耗的物品数量
*
* @param blockEntity
* @return
Expand Down
Loading
Loading