Skip to content

Commit

Permalink
Feat/AddBlockLootTable (#16)
Browse files Browse the repository at this point in the history
* #fix: 优化扳手的行为逻辑,修复扳手工具提示错误

* #feat: DataGen添加战利品表提供器,为可挖掘方块添加战利品表(钻头等多方块结构暂未添加),现在他们可以在挖掘后掉落自身了
  • Loading branch information
half-nothing authored Dec 12, 2023
1 parent 44a3539 commit 1d54e71
Show file tree
Hide file tree
Showing 20 changed files with 355 additions and 308 deletions.
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

0 comments on commit 1d54e71

Please sign in to comment.