Make the FireworkShapes enum extensible (Closes #9486)

This commit is contained in:
LexManos committed 2023-07-14 14:01:32 -07:00
1 parent ea7f755a11
commit 0c81a71308
7 files changed
+137 -1

No files matched your search

@@ -0,0 +1,35 @@
/*
* Copyright (c) Forge Development LLC and contributors
* SPDX-License-Identifier: LGPL-2.1-only
*/
package net.minecraftforge.client;
import java.util.HashMap;
import java.util.Map;
import org.jetbrains.annotations.Nullable;
import net.minecraft.client.particle.FireworkParticles;
import net.minecraft.world.item.FireworkRocketItem;
/**
* Keeps track of custom firework shape types, because Particle is client side only this can't be on the Shape itself.
* So sometime during your client initalization call register.
*/
public class FireworkShapeFactoryRegistry {
private static final Map<FireworkRocketItem.Shape, Factory> factories = new HashMap<>();
public static interface Factory {
void build(FireworkParticles.Starter starter, boolean trail, boolean flicker, int[] colors, int[] fadecolors);
}
public static void register(FireworkRocketItem.Shape shape, Factory factory) {
factories.put(shape, factory);
}
@Nullable
public static Factory get(FireworkRocketItem.Shape shape) {
return factories.get(shape);
}
}
@@ -76,6 +76,10 @@ public net.minecraft.client.gui.screens.Screen f_169369_ # renderables
public net.minecraft.client.model.geom.LayerDefinitions f_171106_ # OUTER_ARMOR_DEFORMATION
public net.minecraft.client.model.geom.LayerDefinitions f_171107_ # INNER_ARMOR_DEFORMATION
public net.minecraft.client.multiplayer.ClientPacketListener f_104899_ # commands
public net.minecraft.client.particle.FireworkParticles$Starter m_106767_(DDDDDD[I[IZZ)V # createParticle
public net.minecraft.client.particle.FireworkParticles$Starter m_106778_(DI[I[IZZ)V # createParticleBall
public net.minecraft.client.particle.FireworkParticles$Starter m_106785_(D[[D[I[IZZZ)V # createParticleShape
public net.minecraft.client.particle.FireworkParticles$Starter m_106793_([I[IZZ)V # createParticleBurst
public net.minecraft.client.particle.ParticleEngine m_107378_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleEngine$SpriteParticleRegistration;)V # register
public net.minecraft.client.particle.ParticleEngine m_107381_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider;)V # register
public net.minecraft.client.particle.ParticleEngine m_272137_(Lnet/minecraft/core/particles/ParticleType;Lnet/minecraft/client/particle/ParticleProvider$Sprite;)V # register