Skip to content
Open
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
15 changes: 10 additions & 5 deletions src/main/java/tonegod/emitter/ParticleEmitterNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -1408,20 +1408,23 @@ public void removeInfluencer(@NotNull ParticleInfluencer<?> influencer) {
*
* @param index the influencer's index.
*/
public void removeInfluencer(int index) {

public ParticleInfluencer removeInfluencer(int index) {
ParticleInfluencer influencer = influencers.get(index);

if (index < 0) {
return;
}

storeInfluencerData(influencers.get(index), index);
storeInfluencerData(influencer, index);

for (int i = index, length = influencers.size(); i < length; i++) {
moveInfluencerData(i + 1, i);
}

influencers.remove(index);
requiresUpdate = true;

return influencer;
}

/**
Expand Down Expand Up @@ -1529,14 +1532,16 @@ protected void storeInfluencerData(@NotNull ParticleInfluencer<?> influencer, in
* @param <T> the influencer's type.
* @param type the class of the influencer to remove.
*/
public <T extends ParticleInfluencer<?>> void removeInfluencer(@NotNull Class<T> type) {

public <T extends ParticleInfluencer<?>> T removeInfluencer(@NotNull Class<T> type) {
T influencer = getInfluencer(type);

if (influencer == null) {
return;
}

removeInfluencer(influencer);

return influencer;
}

/**
Expand Down