diff options
| author | Léa Gris <lea.gris@noiraude.net> | 2022-07-23 13:21:54 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-23 13:21:54 +0200 |
| commit | 74464417fd78c389b9d84173a7f9aeb4443ae0b6 (patch) | |
| tree | 84170a821c75e6198801438e7d5da71df48b2beb /src/main/java/gregtech | |
| parent | 4f4a5e495e5a71467fb22ae5694f508193bc5f13 (diff) | |
| download | GT5-Unofficial-74464417fd78c389b9d84173a7f9aeb4443ae0b6.tar.gz GT5-Unofficial-74464417fd78c389b9d84173a7f9aeb4443ae0b6.tar.bz2 GT5-Unofficial-74464417fd78c389b9d84173a7f9aeb4443ae0b6.zip | |
add(api/enums): particle and sound effect enumerations (#1154)
* add(api/enums): particle and sound effect enumerations
- Adds new GregTech API enumerations:
- `ParticleFX`: Enumerates known EntityFX particles.
- `SoundResource`: Enumerates known sounds with, id and ResourceLocation.
- Refactors code to use the new enumerations instead of string literals.
- Uses `ParticleFX` and `onRandomDisplayTick` to improve or implement
new particle effects for these machines:
- BBF: Adds random flames in front of the firebox.
- Steam machines: Changes pressure-exhaust particles to white vapour,
rather than dark smoke.
- Magic Energy Absorber: Adds random effect, of absorbed magical purple
particles, by the EnderDragon Egg siphon.
- Forge Hammer: Adds sparse random sparks, ejected from the main face.
Diffstat (limited to 'src/main/java/gregtech')
89 files changed, 2610 insertions, 1819 deletions
diff --git a/src/main/java/gregtech/api/GregTech_API.java b/src/main/java/gregtech/api/GregTech_API.java index cb56c52c67..0a99ea776c 100644 --- a/src/main/java/gregtech/api/GregTech_API.java +++ b/src/main/java/gregtech/api/GregTech_API.java @@ -7,6 +7,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.GT_Mod; import gregtech.api.enums.Materials; +import gregtech.api.enums.SoundResource; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IDamagableItem; import gregtech.api.interfaces.ITexture; @@ -169,8 +170,10 @@ public class GregTech_API { public static final Map<String, ItemStack> sBookList = new ConcurrentHashMap<>(); /** * The List of all Sounds used in GT, indices are in the static Block at the bottom + * @deprecated Use {@link SoundResource} */ - public static final Map<Integer, String> sSoundList = new ConcurrentHashMap<>(); + @Deprecated + public static final Map<Integer, String> sSoundList = SoundResource.asSoundList(); /** * The List of Tools, which can be used. Accepts regular damageable Items and Electric Items */ @@ -375,39 +378,6 @@ public class GregTech_API { //sDimensionalList.add(56); //sDimensionalList.add(55); - - sSoundList.put(0, "random.break"); - sSoundList.put(1, "random.anvil_use"); - sSoundList.put(2, "random.anvil_break"); - sSoundList.put(3, "random.click"); - sSoundList.put(4, "random.fizz"); - sSoundList.put(5, "random.explode"); - sSoundList.put(6, "fire.ignite"); - - sSoundList.put(100, aTextIC2Lower + ":" + "tools.Wrench"); - sSoundList.put(101, aTextIC2Lower + ":" + "tools.RubberTrampoline"); - sSoundList.put(102, aTextIC2Lower + ":" + "tools.Painter"); - sSoundList.put(103, aTextIC2Lower + ":" + "tools.BatteryUse"); - sSoundList.put(104, aTextIC2Lower + ":" + "tools.chainsaw.ChainsawUseOne"); - sSoundList.put(105, aTextIC2Lower + ":" + "tools.chainsaw.ChainsawUseTwo"); - sSoundList.put(106, aTextIC2Lower + ":" + "tools.drill.DrillSoft"); - sSoundList.put(107, aTextIC2Lower + ":" + "tools.drill.DrillHard"); - sSoundList.put(108, aTextIC2Lower + ":" + "tools.ODScanner"); - sSoundList.put(109, aTextIC2Lower + ":" + "tools.InsulationCutters"); - - sSoundList.put(200, aTextIC2Lower + ":" + "machines.ExtractorOp"); - sSoundList.put(201, aTextIC2Lower + ":" + "machines.MaceratorOp"); - sSoundList.put(202, aTextIC2Lower + ":" + "machines.InductionLoop"); - sSoundList.put(203, aTextIC2Lower + ":" + "machines.CompressorOp"); - sSoundList.put(204, aTextIC2Lower + ":" + "machines.RecyclerOp"); - sSoundList.put(205, aTextIC2Lower + ":" + "machines.MinerOp"); - sSoundList.put(206, aTextIC2Lower + ":" + "machines.PumpOp"); - sSoundList.put(207, aTextIC2Lower + ":" + "machines.ElectroFurnaceLoop"); - sSoundList.put(208, aTextIC2Lower + ":" + "machines.InductionLoop"); - sSoundList.put(209, aTextIC2Lower + ":" + "machines.MachineOverload"); - sSoundList.put(210, aTextIC2Lower + ":" + "machines.InterruptOne"); - sSoundList.put(211, aTextIC2Lower + ":" + "machines.KaChing"); - sSoundList.put(212, aTextIC2Lower + ":" + "machines.MagnetizerLoop"); } /** diff --git a/src/main/java/gregtech/api/enums/Materials.java b/src/main/java/gregtech/api/enums/Materials.java index fde3e77d4a..f5197ef502 100644 --- a/src/main/java/gregtech/api/enums/Materials.java +++ b/src/main/java/gregtech/api/enums/Materials.java @@ -952,6 +952,9 @@ public class Materials implements IColorModulationContainer, ISubTagContainer { */ //Superconductor re-routed for mod compability. Circuits are re-routed into SuperconductorUHV aswell, internal name is now Superconductor while translated name is SuperconductorUHV + /** + * @deprecated Use {@link #SuperconductorUHV} instead + */ @Deprecated public static Materials Superconductor = new Materials(SuperconductorUHV, true);// new Materials( -1, TextureSet.SET_NONE , 1.0F, 0, 0, 0 , 255, 255, 255, 0, "Superconductor" , "Superconductor" , 0, 0, -1, 0, false, false, 1, 1, 1, Dyes.dyeLightGray , Arrays.asList(new TC_AspectStack(TC_Aspects.ELECTRUM, 9))); @Deprecated diff --git a/src/main/java/gregtech/api/enums/ParticleFX.java b/src/main/java/gregtech/api/enums/ParticleFX.java new file mode 100644 index 0000000000..a20c7a16e3 --- /dev/null +++ b/src/main/java/gregtech/api/enums/ParticleFX.java @@ -0,0 +1,53 @@ +package gregtech.api.enums; + +/** + * Enumerate known EntityFX particles + */ +public enum ParticleFX { + HUGE_EXPLOSION("hugeexplosion"), + LARGE_EXPLODE("largeexplode"), + FIREWORKS_SPARK("fireworksSpark"), + BUBBLE("bubble"), + SUSPENDED("suspended"), + DEPTH_SUSPEND("depthsuspend"), + TOWN_AURA("townaura"), + CRIT("crit"), + MAGIC_CRIT("magicCrit"), + SMOKE("smoke"), + MOB_SPELL("mobSpell"), + MOB_SPELL_AMBIENT("mobSpellAmbient"), + SPELL("spell"), + INSTANT_SPELL("instantSpell"), + WITCH_MAGIC("witchMagic"), + NOTE("note"), + PORTAL("portal"), + ENCHANTMENT_TABLE("enchantmenttable"), + EXPLODE("explode"), + FLAME("flame"), + LAVA("lava"), + FOOTSTEP("footstep"), + SPLASH("splash"), + WAKE("wake"), + LARGE_SMOKE("largesmoke"), + CLOUD("cloud"), + RED_DUST("reddust"), + SNOWBALL_POOF("snowballpoof"), + DRIP_WATER("dripWater"), + DRIP_LAVA("dripLava"), + SNOW_SHOVEL("snowshovel"), + SLIME("slime"), + HEART("heart"), + ANGRY_VILLAGER("angryVillager"), + HAPPY_VILLAGER("happyVillager"); + + private final String identifier; + + ParticleFX(String name) { + this.identifier = name; + } + + public String toString() { + return this.identifier; + } +} + diff --git a/src/main/java/gregtech/api/enums/SoundResource.java b/src/main/java/gregtech/api/enums/SoundResource.java new file mode 100644 index 0000000000..2994f03d2a --- /dev/null +++ b/src/main/java/gregtech/api/enums/SoundResource.java @@ -0,0 +1,361 @@ +package gregtech.api.enums; + +import com.google.common.collect.Maps; +import net.minecraft.util.ResourceLocation; + +import java.util.EnumSet; +import java.util.Locale; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +import static gregtech.api.enums.GT_Values.MOD_ID_IC2; + +/** + * Enumerate known sounds with id and resource-location + * + * <p>Note that the id serve no specific purpose, if for legacy compatibility of + * a plausible yet unimplemented network packet weight optimization.</p> + */ +public enum SoundResource { + + RANDOM_BREAK(0, "random.break"), + RANDOM_ANVIL_USE(1, "random.anvil_use"), + RANDOM_ANVIL_BREAK(2, "random.anvil_break"), + RANDOM_CLICK(3, "random.click"), |
