Class ScreenParticleHandler
java.lang.Object
team.lodestar.lodestone.handlers.screenparticle.ScreenParticleHandler
A handler for screen particles.
Particles are spawned during rendering once per tick.
We also track all present ItemStacks on the screen to allow our particles to more optimally follow a given ItemStacks position
Use
addParticle(ScreenParticleHolder, ScreenParticleOptions, double, double, double, double) to create a screen particle, which will then be ticked.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Collection<ScreenParticleItemStackRetrievalKey>static ScreenParticleHolderstatic booleanstatic intstatic intstatic final Map<ScreenParticleItemStackKey,ScreenParticleHolder> Item Stack Bound Particles are rendered just after an item stack in the inventory.static final Map<ScreenParticleItemStackRetrievalKey,net.minecraft.world.item.ItemStack> static booleanstatic final com.mojang.blaze3d.vertex.Tesselator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends ScreenParticleOptions>
ScreenParticleaddParticle(ScreenParticleHolder screenParticleTarget, T options, double x, double y, double xMotion, double yMotion) static voidstatic voidclearParticles(ScreenParticleHolder screenParticleTarget) static voidpullFromParticleVault(ScreenParticleItemStackRetrievalKey cacheKey, net.minecraft.world.item.ItemStack currentStack, ScreenParticleHolder target, boolean isRenderedAfterItem) static voidrenderItemStackEarly(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.world.item.ItemStack stack, int x, int y) static voidstatic voidrenderParticles(ScreenParticleHolder screenParticleTarget) static voidrenderTick(net.minecraftforge.event.TickEvent.RenderTickEvent event) static ScreenParticleHolderspawnAndPullParticles(net.minecraft.client.multiplayer.ClientLevel level, ParticleEmitterHandler.ItemParticleSupplier emitter, net.minecraft.world.item.ItemStack stack, boolean isRenderedAfterItem) static void
-
Field Details
-
ITEM_PARTICLES
Item Stack Bound Particles are rendered just after an item stack in the inventory. They are ticked the same as other particles. We use a pair of a boolean and the ItemStack as a key. The boolean sorts item particles based on if the ItemStack in question is in the hotbar or not. -
ITEM_STACK_CACHE
public static final Map<ScreenParticleItemStackRetrievalKey,net.minecraft.world.item.ItemStack> ITEM_STACK_CACHE -
ACTIVELY_ACCESSED_KEYS
-
cachedItemParticles
-
currentItemX
public static int currentItemX -
currentItemY
public static int currentItemY -
TESSELATOR
public static final com.mojang.blaze3d.vertex.Tesselator TESSELATOR -
canSpawnParticles
public static boolean canSpawnParticles -
renderingHotbar
public static boolean renderingHotbar
-
-
Constructor Details
-
ScreenParticleHandler
public ScreenParticleHandler()
-
-
Method Details
-
tickParticles
public static void tickParticles() -
renderTick
public static void renderTick(net.minecraftforge.event.TickEvent.RenderTickEvent event) -
renderItemStackEarly
public static void renderItemStackEarly(com.mojang.blaze3d.vertex.PoseStack poseStack, net.minecraft.world.item.ItemStack stack, int x, int y) -
spawnAndPullParticles
public static ScreenParticleHolder spawnAndPullParticles(net.minecraft.client.multiplayer.ClientLevel level, ParticleEmitterHandler.ItemParticleSupplier emitter, net.minecraft.world.item.ItemStack stack, boolean isRenderedAfterItem) -
pullFromParticleVault
public static void pullFromParticleVault(ScreenParticleItemStackRetrievalKey cacheKey, net.minecraft.world.item.ItemStack currentStack, ScreenParticleHolder target, boolean isRenderedAfterItem) -
renderItemStackLate
public static void renderItemStackLate() -
renderParticles
-
clearParticles
public static void clearParticles() -
clearParticles
-
addParticle
public static <T extends ScreenParticleOptions> ScreenParticle addParticle(ScreenParticleHolder screenParticleTarget, T options, double x, double y, double xMotion, double yMotion)
-