mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 14:34:28 +00:00
There a lot of performance improvements related to events. No more InheritableEvent for abstract events that you shouldn't add listeners to anyway, like EntityEvent. Use their sub-events. Made a lot more events records and interfaces. Mostly just a binary break, but has better performance. Mod bus posting methods are now static, no more ModLoader.get() for those. ObjectHolder was removed, use RegistryObject. Changed RuntimeEnumExtender to only target Minecraft classes. If you want other modders to interact with your API, use an Interface instead of Enum. Moved some abstract event methods to only the relevant sub-events now, e.g. can no longer check the side of a ClientTickEvent, because it'll always be client Rendering has changed a lot, they now batch most things together so that the game will render faster. RenderHighlightEvent changed a lot See https://github.com/MinecraftForge/MinecraftForge-Experimental/tree/1.21.9-dev for unsquashed commits. Co-authored-by: Paint_Ninja <[email protected]>
30 lines
2.2 KiB
Diff
30 lines
2.2 KiB
Diff
--- a/net/minecraft/client/particle/ParticleEngine.java
|
|
+++ b/net/minecraft/client/particle/ParticleEngine.java
|
|
@@ -26,7 +_,7 @@
|
|
public class ParticleEngine {
|
|
private static final List<ParticleRenderType> RENDER_ORDER = List.of(ParticleRenderType.SINGLE_QUADS, ParticleRenderType.ITEM_PICKUP, ParticleRenderType.ELDER_GUARDIANS);
|
|
protected ClientLevel level;
|
|
- private final Map<ParticleRenderType, ParticleGroup<?>> particles = Maps.newIdentityHashMap();
|
|
+ private final Map<ParticleRenderType, ParticleGroup<?>> particles = Maps.newTreeMap(net.minecraftforge.client.ForgeHooksClient.makeParticleRenderTypeComparator(RENDER_ORDER));
|
|
private final Queue<TrackingEmitter> trackingEmitters = Queues.newArrayDeque();
|
|
private final Queue<Particle> particlesToAdd = Queues.newArrayDeque();
|
|
private final Object2IntOpenHashMap<ParticleLimit> trackedParticleCounts = new Object2IntOpenHashMap<>();
|
|
@@ -63,7 +_,7 @@
|
|
private <T extends ParticleOptions> Particle makeParticle(
|
|
T p_107396_, double p_107397_, double p_107398_, double p_107399_, double p_107400_, double p_107401_, double p_107402_
|
|
) {
|
|
- ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.resourceManager.getProviders().get(BuiltInRegistries.PARTICLE_TYPE.getId(p_107396_.getType()));
|
|
+ ParticleProvider<T> particleprovider = (ParticleProvider<T>)this.resourceManager.getProvider(p_107396_.getType());
|
|
return particleprovider == null
|
|
? null
|
|
: particleprovider.createParticle(p_107396_, this.level, p_107397_, p_107398_, p_107399_, p_107400_, p_107401_, p_107402_, this.random);
|
|
@@ -123,7 +_,7 @@
|
|
}
|
|
|
|
public void extract(ParticlesRenderState p_423938_, Frustum p_424803_, Camera p_430521_, float p_426823_) {
|
|
- for (ParticleRenderType particlerendertype : RENDER_ORDER) {
|
|
+ for (ParticleRenderType particlerendertype : this.particles.keySet()) { // Forge: allow custom ParticleRenderType's
|
|
ParticleGroup<?> particlegroup = this.particles.get(particlerendertype);
|
|
if (particlegroup != null && !particlegroup.isEmpty()) {
|
|
p_423938_.add(particlegroup.extractRenderState(p_424803_, p_430521_, p_426823_));
|