From ef7efbefd66df68b8235ff97f68aba59fccca22c Mon Sep 17 00:00:00 2001 From: yor42 Date: Mon, 18 Nov 2024 17:08:02 +0900 Subject: [PATCH] add oredicts to ores --- gradle.properties | 2 +- src/main/java/cn/academy/ACOreDict.java | 10 ++++++++++ src/main/java/cn/academy/datapart/AbilityData.java | 5 ++--- src/main/java/cn/academy/datapart/CPData.java | 2 +- src/main/java/cn/academy/datapart/CooldownData.java | 2 +- src/main/java/cn/academy/datapart/PresetData.java | 2 +- 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/gradle.properties b/gradle.properties index 05fa9444..35fa8e10 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,7 +15,7 @@ show_testing_output = false # Mod Information # HIGHLY RECOMMEND complying with SemVer for mod_version: https://semver.org/ -mod_version = 1.1.5-UES +mod_version = 1.1.6-UES root_package = cn mod_id = academy mod_name = AcademyCraft diff --git a/src/main/java/cn/academy/ACOreDict.java b/src/main/java/cn/academy/ACOreDict.java index 259aa796..5f84ac4b 100644 --- a/src/main/java/cn/academy/ACOreDict.java +++ b/src/main/java/cn/academy/ACOreDict.java @@ -5,12 +5,22 @@ public class ACOreDict { public static void InitOredicts(){ + OreDictionary.registerOre("oreImagCrystal", ACBlocks.crystal_ore); + OreDictionary.registerOre("oreResonantCrystal", ACBlocks.reso_ore); + OreDictionary.registerOre("oreConstraintMetal", ACBlocks.constraint_metal); + OreDictionary.registerOre("oreImagSilicon", ACBlocks.imagsil_ore); + OreDictionary.registerOre("oreSilicon", ACBlocks.imagsil_ore); + OreDictionary.registerOre("plateIron", ACItems.reinforced_iron_plate); OreDictionary.registerOre("ingotSilicon", ACItems.imag_silicon_ingot); OreDictionary.registerOre("nuggetSilicon", ACItems.imag_silicon_piece); OreDictionary.registerOre("waferSilicon", ACItems.wafer); + OreDictionary.registerOre("ingotImagSilicon", ACItems.imag_silicon_ingot); + OreDictionary.registerOre("nuggetImagSilicon", ACItems.imag_silicon_piece); + OreDictionary.registerOre("waferImagSilicon", ACItems.wafer); + OreDictionary.registerOre("ingotConstraintMetal", ACItems.constraint_ingot); OreDictionary.registerOre("plateConstraintMetal", ACItems.constraint_plate); diff --git a/src/main/java/cn/academy/datapart/AbilityData.java b/src/main/java/cn/academy/datapart/AbilityData.java index faad156e..4ebe3af2 100644 --- a/src/main/java/cn/academy/datapart/AbilityData.java +++ b/src/main/java/cn/academy/datapart/AbilityData.java @@ -17,6 +17,7 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.relauncher.Side; +import java.util.Arrays; import java.util.BitSet; import java.util.Collections; import java.util.List; @@ -77,9 +78,7 @@ public void setCategory(Category c) { level = 0; } - for(int i = 0; i < skillExps.length; ++i) { - skillExps[i] = 0.0f; - } + Arrays.fill(skillExps, 0.0f); learnedSkills.set(0, learnedSkills.size(), false); sync(); diff --git a/src/main/java/cn/academy/datapart/CPData.java b/src/main/java/cn/academy/datapart/CPData.java index eb82d4cb..19b46252 100644 --- a/src/main/java/cn/academy/datapart/CPData.java +++ b/src/main/java/cn/academy/datapart/CPData.java @@ -52,7 +52,7 @@ public interface IInterfSource { boolean interfering(); } - private Map interfSources = new HashMap<>(); + private final Map interfSources = new HashMap<>(); @SerializeIncluded private boolean activated = false; diff --git a/src/main/java/cn/academy/datapart/CooldownData.java b/src/main/java/cn/academy/datapart/CooldownData.java index d5acf974..d453207a 100644 --- a/src/main/java/cn/academy/datapart/CooldownData.java +++ b/src/main/java/cn/academy/datapart/CooldownData.java @@ -124,7 +124,7 @@ public SkillCooldown get(Controllable ctrl) { */ public SkillCooldown getSub(Controllable ctrl, int id) { int sid = toID(ctrl, id); - return cooldownMap.containsKey(sid) ? cooldownMap.get(sid) : EMPTY_COOLDOWN; + return cooldownMap.getOrDefault(sid, EMPTY_COOLDOWN); } public void clear() { diff --git a/src/main/java/cn/academy/datapart/PresetData.java b/src/main/java/cn/academy/datapart/PresetData.java index ec05d598..01a2c411 100644 --- a/src/main/java/cn/academy/datapart/PresetData.java +++ b/src/main/java/cn/academy/datapart/PresetData.java @@ -71,7 +71,7 @@ public Preset read(NBTBase tag_, Class type) { NetworkS11n.addDirect(Preset.class, new NetS11nAdaptor() { @Override public void write(ByteBuf buf, Preset obj) { - int count = (int) IntStream.range(0, MAX_KEYS).filter(idx -> obj.hasMapping(idx)).count(); + int count = (int) IntStream.range(0, MAX_KEYS).filter(obj::hasMapping).count(); buf.writeByte(count); IntStream.range(0, MAX_KEYS).forEach(idx -> {