Skip to content

Commit

Permalink
particle stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Sep 22, 2023
1 parent b332733 commit 6d36375
Show file tree
Hide file tree
Showing 78 changed files with 373 additions and 399 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ org.gradle.daemon=false
# Dependency Version
minecraftVersion=1.18.2
forgeVersion=40.2.0
lodestoneVersion=1.4.2.448
lodestoneVersion=1.4.2.469
forgegradleVersion=5.1.53
mixingradleVersion=0.7-SNAPSHOT
librarianVersion=1.+
Expand Down
74 changes: 0 additions & 74 deletions src/main/java/com/sammy/malum/client/ParticleEffects.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public SpiritFlameParticleType() {

@Override
public Codec<WorldParticleOptions> codec() {
return WorldParticleOptions.codecFor(this);
return WorldParticleOptions.worldCodec(this);
}

public static class Factory implements ParticleProvider<WorldParticleOptions> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.sammy.malum.common.block.storage.ItemStandBlockEntity;
import com.sammy.malum.common.item.spirit.SpiritShardItem;
import com.sammy.malum.common.block.storage.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
Expand All @@ -12,27 +11,24 @@
import net.minecraft.client.renderer.entity.ItemRenderer;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.phys.*;

import static net.minecraft.client.renderer.texture.OverlayTexture.NO_OVERLAY;


public class ItemStandRenderer implements BlockEntityRenderer<ItemStandBlockEntity> {
public ItemStandRenderer(BlockEntityRendererProvider.Context context) {
public class MalumItemHolderRenderer implements BlockEntityRenderer<MalumItemHolderBlockEntity> {
public MalumItemHolderRenderer(BlockEntityRendererProvider.Context context) {
}

@Override
public void render(ItemStandBlockEntity blockEntityIn, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
public void render(MalumItemHolderBlockEntity blockEntityIn, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int combinedLightIn, int combinedOverlayIn) {
Level level = Minecraft.getInstance().level;
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
ItemStack stack = blockEntityIn.inventory.getStackInSlot(0);
if (!stack.isEmpty()) {
poseStack.pushPose();
Vector3f offset = new Vector3f(blockEntityIn.itemOffset());
if (stack.getItem() instanceof SpiritShardItem) {
double y = Math.sin(((level.getGameTime() + partialTicks)) / 20f) * 0.05f;
poseStack.translate(0, y, 0);
}
poseStack.translate(offset.x(), offset.y(), offset.z());
Vec3 itemOffset = blockEntityIn.getItemOffset();
poseStack.translate(itemOffset.x(), itemOffset.y(), itemOffset.z());
poseStack.mulPose(Vector3f.YP.rotationDegrees(((level.getGameTime() % 360) + partialTicks) * 3));
poseStack.scale(0.6f, 0.6f, 0.6f);
itemRenderer.renderStatic(stack, ItemTransforms.TransformType.FIXED, combinedLightIn, NO_OVERLAY, poseStack, bufferIn, 0);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sammy.malum.client.renderer.block;

import com.mojang.blaze3d.vertex.PoseStack;
import com.sammy.malum.common.block.storage.SoulVialBlockEntity;
import com.sammy.malum.common.block.storage.vial.SoulVialBlockEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Vector3f;
import com.sammy.malum.common.block.storage.SpiritJarBlockEntity;
import com.sammy.malum.common.block.storage.jar.SpiritJarBlockEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.block.model.ItemTransforms;
Expand All @@ -24,7 +24,7 @@ public void render(SpiritJarBlockEntity blockEntityIn, float partialTicks, PoseS
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
if (blockEntityIn.type != null) {
poseStack.pushPose();
double y = 0.5f + Math.sin((level.getGameTime() + partialTicks) / 20f) * 0.2f;
double y = 0.5f + (float)Math.sin((level.getGameTime() % 360) / 20f) * 0.2f;
poseStack.translate(0.5f, y, 0.5f);
poseStack.mulPose(Vector3f.YP.rotationDegrees(((level.getGameTime() % 360) + partialTicks) * 3));
poseStack.scale(0.6f, 0.6f, 0.6f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ public void render(FloatingItemEntity entity, float entityYaw, float partialTick
float x = (float) Mth.lerp(partialTicks, entity.xOld, entity.getX());
float y = (float) Mth.lerp(partialTicks, entity.yOld, entity.getY());
float z = (float) Mth.lerp(partialTicks, entity.zOld, entity.getZ());
trailPoints.add(new TrailPoint(new Vec3(x, y + entity.getYOffset(partialTicks) + 0.25F, z).add(entity.getDeltaMovement().multiply(partialTicks, partialTicks, partialTicks))));
trailPoints.add(new TrailPoint(new Vec3(x, y + entity.getYOffset(partialTicks) + 0.25F, z).add(entity.getDeltaMovement().scale(1+partialTicks))));
poseStack.translate(-x, -y, -z);
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat();
VertexConsumer lightBuffer = DELAYED_RENDER.getBuffer(LIGHT_TYPE);
for (int i = 0; i < 2; i++) {
float size = 0.4f + i * 0.2f;
float size = 0.2f + i * 0.2f;
float alpha = (0.7f - i * 0.35f);
builder.setAlpha(alpha)
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size, f -> builder.setAlpha(alpha * f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 3f, entity.endColor, entity.startColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> 1.5f * size, f -> builder.setAlpha(alpha * f / 2f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 2f, entity.endColor, entity.startColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size * 2.5f, f -> builder.setAlpha(alpha * f / 4f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 2f, entity.endColor, entity.startColor)));
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size, f -> builder.setAlpha(alpha * f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 2f, entity.endColor, entity.startColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> 1.5f * size, f -> builder.setAlpha(alpha * f / 2f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 1.5f, entity.endColor, entity.startColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size * 2.5f, f -> builder.setAlpha(alpha * f / 4f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 1.5f, entity.endColor, entity.startColor)));
}
poseStack.translate(x, y, z);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sammy.malum.client.renderer.item;

import com.mojang.blaze3d.vertex.PoseStack;
import com.sammy.malum.common.block.storage.SpiritJarBlockEntity;
import com.sammy.malum.common.block.storage.jar.SpiritJarBlockEntity;
import com.sammy.malum.common.item.spirit.SpiritJarItem;
import com.sammy.malum.core.helper.SpiritHelper;
import com.sammy.malum.registry.common.block.BlockRegistry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import team.lodestar.lodestone.systems.easing.*;
import team.lodestar.lodestone.systems.multiblock.*;
import team.lodestar.lodestone.systems.particle.*;
import team.lodestar.lodestone.systems.particle.builder.*;
import team.lodestar.lodestone.systems.particle.data.*;

import java.awt.*;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.sammy.malum.common.block.curiosities.spirit_altar;

import com.sammy.malum.client.*;
import com.sammy.malum.common.block.storage.*;
import com.sammy.malum.common.item.spirit.*;
import com.sammy.malum.common.packets.particle.curiosities.altar.*;
import com.sammy.malum.common.recipe.*;
Expand All @@ -9,6 +9,7 @@
import com.sammy.malum.core.systems.spirit.*;
import com.sammy.malum.registry.common.*;
import com.sammy.malum.registry.common.block.*;
import com.sammy.malum.visual_effects.*;
import net.minecraft.core.*;
import net.minecraft.nbt.*;
import net.minecraft.sounds.*;
Expand All @@ -31,6 +32,7 @@
import team.lodestar.lodestone.systems.blockentity.*;
import team.lodestar.lodestone.systems.easing.*;
import team.lodestar.lodestone.systems.particle.*;
import team.lodestar.lodestone.systems.particle.builder.*;
import team.lodestar.lodestone.systems.particle.data.*;
import team.lodestar.lodestone.systems.recipe.*;

Expand All @@ -42,7 +44,6 @@
import java.util.stream.*;

import static com.sammy.malum.registry.common.PacketRegistry.*;
import static com.sammy.malum.registry.common.SpiritTypeRegistry.SACRED_SPIRIT;

public class SpiritAltarBlockEntity extends LodestoneBlockEntity {

Expand Down Expand Up @@ -276,9 +277,9 @@ public boolean consume() {
int extras = extrasInventory.nonEmptyItemAmount;
if (extras < recipe.extraItems.size()) {
progress *= 0.8f;
Collection<IAltarProvider> altarProviders = BlockHelper.getBlockEntities(IAltarProvider.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE);
for (IAltarProvider provider : altarProviders) {
LodestoneBlockEntityInventory inventoryForAltar = provider.getInventoryForAltar();
Collection<IMalumSpecialItemAccessPoint> altarProviders = BlockHelper.getBlockEntities(IMalumSpecialItemAccessPoint.class, level, worldPosition, HORIZONTAL_RANGE, VERTICAL_RANGE, HORIZONTAL_RANGE);
for (IMalumSpecialItemAccessPoint provider : altarProviders) {
LodestoneBlockEntityInventory inventoryForAltar = provider.getSuppliedInventory();
ItemStack providedStack = inventoryForAltar.getStackInSlot(0);
IngredientWithCount requestedItem = recipe.extraItems.get(extras);
boolean matches = requestedItem.matches(providedStack);
Expand All @@ -293,12 +294,12 @@ public boolean consume() {
requestedItem = recipe.extraItems.get(extras);
matches = requestedItem.matches(providedStack);
if (matches) {
level.playSound(null, provider.getBlockPosForAltar(), SoundRegistry.ALTAR_CONSUME.get(), SoundSource.BLOCKS, 1, 0.9f + level.random.nextFloat() * 0.2f);
Vec3 providedItemPos = provider.getItemPosForAltar();
MALUM_CHANNEL.send(PacketDistributor.TRACKING_CHUNK.with(() -> level.getChunkAt(provider.getBlockPosForAltar())), new AltarConsumeParticlePacket(providedStack, recipe.spirits.stream().map(s -> s.type.identifier).collect(Collectors.toList()), providedItemPos.x, providedItemPos.y, providedItemPos.z, itemPos.x, itemPos.y, itemPos.z));
level.playSound(null, provider.getAccessPointBlockPos(), SoundRegistry.ALTAR_CONSUME.get(), SoundSource.BLOCKS, 1, 0.9f + level.random.nextFloat() * 0.2f);
Vec3 providedItemPos = provider.getItemCenterPos();
MALUM_CHANNEL.send(PacketDistributor.TRACKING_CHUNK.with(() -> level.getChunkAt(provider.getAccessPointBlockPos())), new AltarConsumeParticlePacket(providedStack, recipe.spirits.stream().map(s -> s.type.identifier).collect(Collectors.toList()), providedItemPos.x, providedItemPos.y, providedItemPos.z, itemPos.x, itemPos.y, itemPos.z));
extrasInventory.insertItem(level, providedStack.split(requestedItem.count));
inventoryForAltar.updateData();
BlockHelper.updateAndNotifyState(level, provider.getBlockPosForAltar());
BlockHelper.updateAndNotifyState(level, provider.getAccessPointBlockPos());
break;
}
}
Expand Down Expand Up @@ -410,10 +411,11 @@ public void passiveParticles() {
Vec3 offset = getSpiritOffset(spiritsRendered++, 0);
Color color = spiritSplinterItem.type.getPrimaryColor();
Color endColor = spiritSplinterItem.type.getSecondaryColor();
double x = getBlockPos().getX() + offset.x();
double y = getBlockPos().getY() + offset.y();
double z = getBlockPos().getZ() + offset.z();
ParticleEffects.spawnSpiritGlimmerParticles(level, x, y, z, color, endColor);
final BlockPos blockPos = getBlockPos();
double x = blockPos.getX() + offset.x();
double y = blockPos.getY() + offset.y();
double z = blockPos.getZ() + offset.z();
SpiritLightSpecs.spiritLightSpecs(level, new Vec3(blockPos.getX()+offset.x, blockPos.getY()+offset.y, blockPos.getZ()+offset.z), color, endColor);
if (recipe != null) {
Vec3 velocity = new Vec3(x, y, z).subtract(itemPos).normalize().scale(particleVelocityMultiplier);
WorldParticleBuilder.create(LodestoneParticleRegistry.WISP_PARTICLE)
Expand Down
Loading

0 comments on commit 6d36375

Please sign in to comment.