|
7 | 7 | import com.google.common.collect.Sets; |
8 | 8 | import com.mojang.logging.LogUtils; |
9 | 9 | import net.minecraft.client.particle.*; |
10 | | -import net.minecraft.world.level.block.Block; |
11 | 10 | import org.jspecify.annotations.Nullable; |
12 | 11 |
|
13 | 12 | import java.util.HashSet; |
@@ -91,12 +90,14 @@ public enum TakeOver implements ITranslatable { |
91 | 90 | ); |
92 | 91 | @SuppressWarnings("unchecked") |
93 | 92 | private static final HashSet<Class<? extends Particle>> RENDER_BLACKLIST = Sets.newHashSet( |
94 | | - //TODO support item atlas |
| 93 | + ); |
| 94 | + |
| 95 | + private static final HashSet<Class<? extends SingleQuadParticle>> ITEM_ATLAS = Sets.newHashSet( |
95 | 96 | BlockMarker.class, |
96 | 97 | BreakingItemParticle.class |
97 | 98 | ); |
98 | 99 | @SuppressWarnings("unchecked") |
99 | | - private static final HashSet<Class<? extends SingleQuadParticle>> RENDER_VANILLA = Sets.newHashSet( |
| 100 | + private static final HashSet<Class<? extends SingleQuadParticle>> PARTICLE_ATLAS = Sets.newHashSet( |
100 | 101 | SnowflakeParticle.class, |
101 | 102 | SpitParticle.class, |
102 | 103 | SpellParticle.class, |
@@ -160,25 +161,34 @@ public static ParticleRenderType map(Particle particle) { |
160 | 161 | if (!(particle instanceof SingleQuadParticle)) { |
161 | 162 | return originalType; |
162 | 163 | } |
163 | | - if (originalType == ModParticleRenderTypes.INSTANCED || originalType == ModParticleRenderTypes.INSTANCED_TERRAIN) { |
| 164 | + if (originalType == ModParticleRenderTypes.INSTANCED || originalType == ModParticleRenderTypes.INSTANCED_TERRAIN || originalType == ModParticleRenderTypes.INSTANCED_ITEM) { |
164 | 165 | return originalType; |
165 | 166 | } |
166 | 167 | return switch (originalType.name()) { |
167 | 168 | case "INSTANCED" -> ModParticleRenderTypes.INSTANCED; |
168 | 169 | case "INSTANCED_TERRAIN" -> ModParticleRenderTypes.INSTANCED_TERRAIN; |
| 170 | + case "INSTANCED_ITEM" -> ModParticleRenderTypes.INSTANCED_ITEM; |
169 | 171 | case "SINGLE_QUADS" -> switch (ConfigHelper.getConfigRead(MadParticleConfig.class).takeOverRendering) { |
170 | 172 | case NONE -> originalType; |
171 | 173 | case ALL -> { |
172 | | - if (particle instanceof TerrainParticle) { |
| 174 | + if (RENDER_BLACKLIST.contains(particle.getClass())) { |
| 175 | + yield ParticleRenderType.SINGLE_QUADS; |
| 176 | + } else if (particle instanceof TerrainParticle) { |
173 | 177 | yield ModParticleRenderTypes.INSTANCED_TERRAIN; |
| 178 | + } else if (ITEM_ATLAS.contains(particle.getClass())) { |
| 179 | + yield ModParticleRenderTypes.INSTANCED_ITEM; |
174 | 180 | } |
175 | | - yield RENDER_BLACKLIST.contains(particle.getClass()) ? ParticleRenderType.SINGLE_QUADS : ModParticleRenderTypes.INSTANCED; |
| 181 | + yield ModParticleRenderTypes.INSTANCED; |
176 | 182 | } |
177 | 183 | case VANILLA -> { |
178 | 184 | if (particle instanceof TerrainParticle) { |
179 | 185 | yield ModParticleRenderTypes.INSTANCED_TERRAIN; |
| 186 | + } else if (ITEM_ATLAS.contains(particle.getClass())) { |
| 187 | + yield ModParticleRenderTypes.INSTANCED_ITEM; |
| 188 | + } else if (PARTICLE_ATLAS.contains(particle.getClass())) { |
| 189 | + yield ModParticleRenderTypes.INSTANCED; |
180 | 190 | } |
181 | | - yield RENDER_VANILLA.contains(particle.getClass()) ? ModParticleRenderTypes.INSTANCED : originalType; |
| 191 | + yield originalType; |
182 | 192 | } |
183 | 193 | }; |
184 | 194 | default -> originalType; |
|
0 commit comments