Skip to content

Commit c4f6ce0

Browse files
committed
v1.2.0 Update
1 parent 978a7be commit c4f6ce0

File tree

35 files changed

+178
-25
lines changed

35 files changed

+178
-25
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ jobs:
2222
distribution: 'microsoft'
2323
- name: make gradle wrapper executable
2424
run: chmod +x ./gradlew
25-
- name: build
26-
run: ./gradlew buildAndCollect+All
25+
- name: build fabric
26+
run: ./gradlew buildAndCollect+fabric+All
27+
- name: build forge
28+
run: ./gradlew buildAndCollect+forge+All
29+
- name: build neoforge
30+
run: ./gradlew buildAndCollect+neoforge+All
2731
- name: capture build artifacts
2832
if: ${{ matrix.java == '21' }} # Only upload artifacts built from latest java
2933
uses: actions/upload-artifact@v4

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
- Bumped to 1.21.11
1+
- Added new particles for the Breath of the Nautilus effect
2+
- Added compatibility for the Old Potions mod

build.gradle

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ mossyDependencies {
1717
parchment = prop("build.parchment")
1818

1919
additional {
20-
//override("modCompileOnly", "yacl")
20+
//disable("oldpotions")
21+
}
22+
}
23+
24+
dependencies {
25+
def oldPotions = prop("dep.oldpotions")
26+
if (oldPotions != "unknown") {
27+
implementation group: 'com.electronwill.night-config', name: 'toml', version: '3.6.7'
2128
}
2229
}
2330

gradle.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ org.gradle.jvmargs=-Xmx24G
77
org.gradle.parallel=true
88

99
# Mossy Plugin
10-
mossy_plugin_version = 1.2.4
10+
mossy_plugin_version = 2.0.0
1111

1212
# Stonecutter
1313
dev.kikugie.stonecutter.hard_mode=true
1414

1515
# Mod Properties
1616
data.mod_id = particle_effects
1717
data.mod_name = Particle Effects
18-
data.mod_version = 1.1.0
18+
data.mod_version = 1.2.0
1919
data.mod_group = net.lopymine.pe
2020
data.mod_maven_group = net.lopymine
2121
data.mixin_configs = none
@@ -48,6 +48,7 @@ build.forge = [VERSIONED]
4848
# Additional Dependencies, "dep." is important
4949
dep.yacl = [VERSIONED]
5050
dep.modmenu = [VERSIONED]
51+
dep.oldpotions = [VERSIONED]
5152

5253
# # # # # # # # # # # # # #
5354
# Publication Properties #
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.lopymine.pe.compat;
2+
3+
import java.util.stream.Stream;
4+
import net.lopymine.pe.loader.MossyLoader;
5+
6+
public class LoadedMods {
7+
8+
public static boolean isAnyOldPotionsModLoaded() {
9+
return Stream.of("oldpotions", "legacy_potion_colors").anyMatch((id) -> MossyLoader.isModLoaded(id, true));
10+
}
11+
12+
}

src/main/java/net/lopymine/pe/config/ParticleEffectsConfig.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static ParticleEffectsConfig getInstance() {
4343
private static @NotNull ParticleEffectsConfig create() {
4444
ParticleEffectsConfig config = new ParticleEffectsConfig();
4545
try (FileWriter writer = new FileWriter(CONFIG_FILE, StandardCharsets.UTF_8)) {
46-
String json = GSON.toJson(CODEC.encode(config, JsonOps.INSTANCE, JsonOps.INSTANCE.empty())/*? if >=1.20.5 {*/.getOrThrow());/*?} else*//*.getOrThrow(false, LOGGER::error));*/
46+
String json = GSON.toJson(CODEC.encode(config, JsonOps.INSTANCE, JsonOps.INSTANCE.empty())/*? if >=1.20.5 {*/.getOrThrow());/*?} else*///.getOrThrow(false, LOGGER::error));
4747
writer.write(json);
4848
} catch (Exception e) {
4949
LOGGER.error("Failed to create config", e);
@@ -68,7 +68,7 @@ public void save() {
6868
ParticleEffects.setConfig(this);
6969
CompletableFuture.runAsync(() -> {
7070
try (FileWriter writer = new FileWriter(CONFIG_FILE, StandardCharsets.UTF_8)) {
71-
String json = GSON.toJson(CODEC.encode(this, JsonOps.INSTANCE, JsonOps.INSTANCE.empty())/*? if >=1.20.5 {*/.getOrThrow());/*?} else*//*.getOrThrow(false, LOGGER::error));*/
71+
String json = GSON.toJson(CODEC.encode(this, JsonOps.INSTANCE, JsonOps.INSTANCE.empty())/*? if >=1.20.5 {*/.getOrThrow());/*?} else*///.getOrThrow(false, LOGGER::error));
7272
writer.write(json);
7373
} catch (Exception e) {
7474
LOGGER.error("Failed to save config", e);

src/main/java/net/lopymine/pe/entrypoint/PEFabricClientEntrypoint.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
//? if fabric {
44

55
import net.fabricmc.api.ClientModInitializer;
6+
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientLifecycleEvents;
67
import net.lopymine.pe.client.ParticleEffectsClient;
8+
import net.lopymine.pe.compat.LoadedMods;
79
import net.lopymine.pe.manager.ParticleEffectsManager;
810

911
public class PEFabricClientEntrypoint implements ClientModInitializer {
@@ -13,9 +15,21 @@ public void onInitializeClient() {
1315
ParticleEffectsClient.onInitializeClient();
1416
ParticleEffectsManager.registerParticleTypes();
1517
ParticleEffectsManager.swapParticleTypes();
16-
ParticleEffectsManager.registerParticleColorsForTypes();
18+
if (LoadedMods.isAnyOldPotionsModLoaded()) {
19+
ClientLifecycleEvents.CLIENT_STARTED.register((mc) -> {
20+
ParticleEffectsManager.redirectEnabled = true;
21+
ParticleEffectsManager.redirectToVanillaEffectColors = true;
22+
ParticleEffectsManager.registerParticleColorsForTypes();
23+
ParticleEffectsManager.redirectToVanillaEffectColors = false;
24+
ParticleEffectsManager.registerParticleColorsForTypes();
25+
ParticleEffectsManager.redirectEnabled = false;
26+
});
27+
} else {
28+
ParticleEffectsManager.registerParticleColorsForTypes();
29+
}
1730
ParticleEffectsManager.registerParticleFactories();
1831
}
32+
1933
}
2034

2135
//?}

src/main/java/net/lopymine/pe/loader/MossyLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public class MossyLoader {
2929
public static boolean isModLoaded(String modid, boolean loadingPhase) {
3030
if (loadingPhase) {
3131
//? if >=1.21.10 {
32-
return FMLLoader.getCurrent().getLoadingModList().getModFileById(modid) != null;
33-
//?} else {
34-
/^return FMLLoader.getLoadingModList().getModFileById(modid) != null;
35-
^///?}
32+
/^return FMLLoader.getCurrent().getLoadingModList().getModFileById(modid) != null;
33+
^///?} else {
34+
return FMLLoader.getLoadingModList().getModFileById(modid) != null;
35+
//?}
3636
} else {
3737
return ModList.get().isLoaded(modid);
3838
}

src/main/java/net/lopymine/pe/manager/ParticleEffectsManager.java

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import lombok.experimental.ExtensionMethod;
77
import net.lopymine.pe.capture.ParticleCaptures;
88
import net.lopymine.pe.client.ParticleEffectsClient;
9+
import net.lopymine.pe.compat.LoadedMods;
910
import net.lopymine.pe.extension.RegistryExtension;
1011
import net.lopymine.pe.particle.TexturedParticleFactory;
1112
import net.minecraft.client.particle.Particle;
@@ -51,6 +52,9 @@
5152
@ExtensionMethod(RegistryExtension.class)
5253
public class ParticleEffectsManager {
5354

55+
public static boolean redirectEnabled = false;
56+
public static boolean redirectToVanillaEffectColors = true;
57+
5458
//? if fabric {
5559
private static final List<ParticleOptions> REGISTERED_PARTICLE_TYPES = new ArrayList<>();
5660
private static final Map<MobEffect, ParticleOptions> EFFECT_TO_PARTICLE = new HashMap<>();
@@ -201,7 +205,19 @@ public static void registerParticleColorsForTypes() {
201205
.toList();
202206
//?}
203207

204-
COLOR_TO_PARTICLES_MAP.put(color, particleEffects);
208+
List<ParticleOptions> list = COLOR_TO_PARTICLES_MAP.get(color);
209+
if (list != null) {
210+
if (ParticleEffects.getConfig().isDebugLogEnabled()) {
211+
//? if >=1.21.4 {
212+
String potionName = potion.name();
213+
//?} else {
214+
/*String potionName = potion.name;
215+
*///?}
216+
ParticleEffects.LOGGER.warn("[DEV/Potion Registration] Found registered effects for color {} from {} potion, skipping its registration. If you just mod user, ignore it.", color, potionName);
217+
}
218+
} else {
219+
COLOR_TO_PARTICLES_MAP.put(color, particleEffects);
220+
}
205221
}
206222

207223
//------------------------------------------------------//
@@ -257,7 +273,16 @@ public static void registerParticleFactories(RegisterParticleProvidersEvent even
257273
public static void onCommonSetup(FMLCommonSetupEvent event) {
258274
event.enqueueWork(() -> {
259275
swapParticleTypes();
260-
registerParticleColorsForTypes();
276+
if (LoadedMods.isAnyOldPotionsModLoaded()) {
277+
ParticleEffectsManager.redirectEnabled = true;
278+
ParticleEffectsManager.redirectToVanillaEffectColors = true;
279+
ParticleEffectsManager.registerParticleColorsForTypes();
280+
ParticleEffectsManager.redirectToVanillaEffectColors = false;
281+
ParticleEffectsManager.registerParticleColorsForTypes();
282+
ParticleEffectsManager.redirectEnabled = false;
283+
} else {
284+
registerParticleColorsForTypes();
285+
}
261286
});
262287
}
263288
*///?}
@@ -274,7 +299,16 @@ public static void onRegisterParticleProviders(RegisterParticleProvidersEvent ev
274299
public static void onCommonSetup(FMLCommonSetupEvent event) {
275300
event.enqueueWork(() -> {
276301
swapParticleTypes();
277-
registerParticleColorsForTypes();
302+
if (LoadedMods.isAnyOldPotionsModLoaded()) {
303+
ParticleEffectsManager.redirectEnabled = true;
304+
ParticleEffectsManager.redirectToVanillaEffectColors = true;
305+
ParticleEffectsManager.registerParticleColorsForTypes();
306+
ParticleEffectsManager.redirectToVanillaEffectColors = false;
307+
ParticleEffectsManager.registerParticleColorsForTypes();
308+
ParticleEffectsManager.redirectEnabled = false;
309+
} else {
310+
registerParticleColorsForTypes();
311+
}
278312
});
279313
}
280314
*///?}

src/main/java/net/lopymine/pe/mixin/AreaEffectCloudEntityMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public abstract class AreaEffectCloudEntityMixin extends Entity {
2424
private boolean particleEffects$needResetDebugData;
2525

2626
//? =1.20.1
27-
/*@Shadow public abstract int getColor();*/
27+
//@Shadow public abstract int getColor();
2828

2929
public AreaEffectCloudEntityMixin(EntityType<?> type, Level world) {
3030
super(type, world);

0 commit comments

Comments
 (0)