Skip to content

Commit

Permalink
Wawa
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Oct 10, 2023
1 parent ce71657 commit cae9547
Show file tree
Hide file tree
Showing 50 changed files with 427 additions and 300 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.476
lodestoneVersion=1.4.2.484
forgegradleVersion=5.1.53
mixingradleVersion=0.7-SNAPSHOT
librarianVersion=1.+
Expand Down

This file was deleted.

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

import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.particle.ParticleEngine;
import team.lodestar.lodestone.systems.particle.options.*;
import team.lodestar.lodestone.systems.particle.world.FrameSetParticle;
import team.lodestar.lodestone.systems.particle.world.WorldParticleOptions;

public class SpiritFlameParticle extends FrameSetParticle {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import net.minecraft.client.particle.ParticleProvider;
import net.minecraft.client.particle.SpriteSet;
import net.minecraft.core.particles.ParticleType;
import team.lodestar.lodestone.systems.particle.world.WorldParticleOptions;
import team.lodestar.lodestone.systems.particle.options.*;

import javax.annotation.Nullable;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public void render(SpiritJarBlockEntity blockEntityIn, float partialTicks, PoseS
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);
itemRenderer.renderStatic(blockEntityIn.type.getSpiritShardItem().getDefaultInstance(), ItemTransforms.TransformType.FIXED, combinedLightIn, NO_OVERLAY, poseStack, bufferIn, 0);
itemRenderer.renderStatic(blockEntityIn.type.spiritShard.get().getDefaultInstance(), ItemTransforms.TransformType.FIXED, combinedLightIn, NO_OVERLAY, poseStack, bufferIn, 0);
poseStack.popPose();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import team.lodestar.lodestone.systems.rendering.*;
import team.lodestar.lodestone.systems.rendering.trail.*;

import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.stream.*;

import static com.sammy.malum.MalumMod.*;
Expand Down Expand Up @@ -51,13 +53,15 @@ public void render(FloatingItemEntity entity, float entityYaw, float partialTick
poseStack.translate(-x, -y, -z);
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat();
VertexConsumer lightBuffer = DELAYED_RENDER.getBuffer(LIGHT_TYPE);
final Color primaryColor = entity.spiritType.getPrimaryColor();
final Color secondaryColor = entity.spiritType.getSecondaryColor();
for (int i = 0; i < 2; i++) {
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 * 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)));
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size, f -> builder.setAlpha(alpha * f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 2f, secondaryColor, primaryColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> 1.5f * size, f -> builder.setAlpha(alpha * f / 2f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 1.5f, secondaryColor, primaryColor)))
.renderTrail(lightBuffer, poseStack, trailPoints, f -> size * 2.5f, f -> builder.setAlpha(alpha * f / 4f).setColor(ColorHelper.colorLerp(Easing.SINE_IN, f * 1.5f, secondaryColor, primaryColor)));
}
poseStack.translate(x, y, z);
}
Expand All @@ -69,7 +73,7 @@ public void render(FloatingItemEntity entity, float entityYaw, float partialTick
public static void renderSpirit(FloatingItemEntity entity, ItemRenderer itemRenderer, float partialTicks, PoseStack poseStack, MultiBufferSource bufferIn, int packedLightIn) {
ItemStack itemStack = entity.getItem();
BakedModel model = itemRenderer.getModel(itemStack, entity.level, null, entity.getItem().getCount());
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat().setColor(entity.startColor);
VFXBuilders.WorldVFXBuilder builder = VFXBuilders.createWorld().setPosColorTexLightmapDefaultFormat().setColor(entity.spiritType.getPrimaryColor());
float yOffset = entity.getYOffset(partialTicks);
float scale = model.getTransforms().getTransform(ItemTransforms.TransformType.GROUND).scale.y();
float rotation = entity.getRotation(partialTicks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public void renderRight(Minecraft minecraft, PoseStack poseStack, EntryScreen sc

public void renderRite(PoseStack poseStack, EntryScreen screen, int left, int top, int mouseX, int mouseY, List<MalumSpiritType> spirits) {
for (int i = 0; i < spirits.size(); i++) {
ItemStack stack = spirits.get(i).getSpiritShardItem().getDefaultInstance();
ItemStack stack = spirits.get(i).spiritShard.get().getDefaultInstance();
renderItem(screen, poseStack, stack, left, top - 20 * i, mouseX, mouseY);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -458,12 +458,10 @@ public void passiveParticles() {
ItemStack item = spiritInventory.getStackInSlot(i);
if (item.getItem() instanceof SpiritShardItem spiritSplinterItem) {
Vec3 offset = spiritOffset(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();
SpiritLightSpecs.spiritLightSpecs(level, new Vec3(x,y,z), color, endColor);
SpiritLightSpecs.spiritLightSpecs(level, new Vec3(x,y,z), spiritSplinterItem.type);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import team.lodestar.lodestone.systems.particle.data.*;
import team.lodestar.lodestone.systems.particle.data.color.*;
import team.lodestar.lodestone.systems.particle.data.spin.*;
import team.lodestar.lodestone.systems.particle.render_types.*;
import team.lodestar.lodestone.systems.particle.world.*;

import java.awt.*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public void tick() {
.setRandomOffset(0.15f, 0.2f)
.addMotion(0, 0.0035f, 0)
.setRandomMotion(0.001f, 0.005f)
.addActor(p -> p.setParticleSpeed(p.getParticleSpeed().scale(0.985f-level.random.nextFloat() * 0.04f)))
.addActor(p -> p.setParticleMotion(p.getParticleSpeed().scale(0.985f-level.random.nextFloat() * 0.04f)))
.enableNoClip()
.setDiscardFunction(SimpleParticleOptions.ParticleDiscardFunctionType.ENDING_CURVE_INVISIBLE)
.spawn(level, x, y, z);
Expand All @@ -173,7 +173,7 @@ public void tick() {
.setRandomOffset(0.1f, 0.225f)
.addMotion(0, velocity / 2f, 0)
.setRandomMotion(0, 0.015f)
.addActor(p -> p.setParticleSpeed(p.getParticleSpeed().scale(0.97f-level.random.nextFloat() * 0.025f)))
.addActor(p -> p.setParticleMotion(p.getParticleSpeed().scale(0.97f-level.random.nextFloat() * 0.025f)))
.enableNoClip()
.setDiscardFunction(SimpleParticleOptions.ParticleDiscardFunctionType.ENDING_CURVE_INVISIBLE)
.spawn(level, x, y, z);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public InteractionResult use(BlockState pState, Level pLevel, BlockPos pPos, Pla
return super.use(pState, pLevel, pPos, player, pHand, pHit);
}
MalumSpiritType spiritType = spiritShardItem.type;
BlockState blockstate = spiritType.getSpiritMoteBlock().defaultBlockState();
BlockState blockstate = spiritType.spiritMote.get().defaultBlockState();
SoundType soundtype = blockstate.getSoundType(pLevel, pPos, player);
pLevel.setBlock(pPos, blockstate, 3);
pLevel.levelEvent(2001, pPos, Block.getId(pState));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void tick() {
if (level.isClientSide) {
if (inventory.getStackInSlot(0).getItem() instanceof SpiritShardItem item) {
MalumSpiritType type = item.type;
SpiritLightSpecs.rotatingLightSpecs(level, getItemCenterPos(), type.getPrimaryColor(), type.getSecondaryColor(), 0.4f, 2);
SpiritLightSpecs.rotatingLightSpecs(level, getItemCenterPos(), type, 0.4f, 2);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public int getSlots() {
@Override
public ItemStack getStackInSlot(int slot) {
if (slot == 0 && type != null) {
return new ItemStack(type.getSpiritShardItem(), count); // Yes, this can create a stack bigger than 64. It's fine.
return new ItemStack(type.spiritShard.get(), count); // Yes, this can create a stack bigger than 64. It's fine.
} else
return ItemStack.EMPTY;
}
Expand Down Expand Up @@ -107,7 +107,7 @@ public ItemStack extractItem(int slot, int amount, boolean simulate) {
}
}

return new ItemStack(extractedType.getSpiritShardItem(), amountToExtract);
return new ItemStack(extractedType.spiritShard.get(), amountToExtract);
}

@Override
Expand Down Expand Up @@ -241,7 +241,7 @@ public void tick() {
double x = getBlockPos().getX() + 0.5f;
double y = getBlockPos().getY() + 0.5f + (float)Math.sin((level.getGameTime() % 360) / 20f) * 0.2f;
double z = getBlockPos().getZ() + 0.5f;
SpiritLightSpecs.rotatingLightSpecs(level, new Vec3(x, y, z), type.getPrimaryColor(), type.getSecondaryColor(), 0.4f, 3);
SpiritLightSpecs.rotatingLightSpecs(level, new Vec3(x, y, z), type, 0.4f, 3);
}
}
}
Expand Down
23 changes: 8 additions & 15 deletions src/main/java/com/sammy/malum/common/entity/FloatingEntity.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.sammy.malum.common.entity;

import com.sammy.malum.core.systems.spirit.*;
import com.sammy.malum.registry.common.SpiritTypeRegistry;
import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag;
Expand Down Expand Up @@ -31,11 +32,9 @@

public abstract class FloatingEntity extends Entity {

protected static final EntityDataAccessor<Integer> DATA_COLOR = SynchedEntityData.defineId(FloatingEntity.class, EntityDataSerializers.INT);
protected static final EntityDataAccessor<Integer> DATA_END_COLOR = SynchedEntityData.defineId(FloatingEntity.class, EntityDataSerializers.INT);
protected static final EntityDataAccessor<String> DATA_SPIRIT = SynchedEntityData.defineId(FloatingEntity.class, EntityDataSerializers.STRING);
public final TrailPointBuilder trailPointBuilder = TrailPointBuilder.create(10);
public Color startColor = SpiritTypeRegistry.ARCANE_SPIRIT.getPrimaryColor();
public Color endColor = SpiritTypeRegistry.ARCANE_SPIRIT.getSecondaryColor();
public MalumSpiritType spiritType = SpiritTypeRegistry.SACRED_SPIRIT;
public int maxAge;
public int age;
public float moveTime;
Expand All @@ -50,8 +49,7 @@ public FloatingEntity(EntityType<? extends FloatingEntity> type, Level level) {

@Override
protected void defineSynchedData() {
this.getEntityData().define(DATA_COLOR, SpiritTypeRegistry.ARCANE_SPIRIT.getPrimaryColor().getRGB());
this.getEntityData().define(DATA_END_COLOR, SpiritTypeRegistry.ARCANE_SPIRIT.getSecondaryColor().getRGB());
this.getEntityData().define(DATA_SPIRIT, SpiritTypeRegistry.SACRED_SPIRIT.identifier);
}

@Override
Expand All @@ -61,8 +59,7 @@ public void addAdditionalSaveData(CompoundTag compound) {
compound.putFloat("moveTime", moveTime);
compound.putFloat("windUp", windUp);

compound.putInt("start", startColor.getRGB());
compound.putInt("end", endColor.getRGB());
compound.putString("spiritType", spiritType.identifier);
}

@Override
Expand All @@ -71,17 +68,13 @@ public void readAdditionalSaveData(CompoundTag compound) {
maxAge = compound.getInt("maxAge");
moveTime = compound.getFloat("moveTime");
windUp = compound.getFloat("windUp");
startColor = new Color(compound.getInt("start"));
endColor = new Color(compound.getInt("end"));
spiritType = SpiritTypeRegistry.SPIRITS.get(compound.getString("spiritType"));
}

@Override
public void onSyncedDataUpdated(EntityDataAccessor<?> pKey) {
if (DATA_COLOR.equals(pKey)) {
startColor = new Color(entityData.get(DATA_COLOR));
}
if (DATA_END_COLOR.equals(pKey)) {
endColor = new Color(entityData.get(DATA_END_COLOR));
if (DATA_SPIRIT.equals(pKey)) {
spiritType = SpiritTypeRegistry.SPIRITS.get(entityData.get(DATA_SPIRIT));
}
super.onSyncedDataUpdated(pKey);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.sammy.malum.common.entity;

import com.sammy.malum.common.item.spirit.*;
import com.sammy.malum.registry.common.item.ItemRegistry;
import com.sammy.malum.core.systems.item.IFloatingGlowItem;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
Expand All @@ -11,8 +11,6 @@
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;

import java.awt.*;

public class FloatingItemEntity extends FloatingEntity {

private static final EntityDataAccessor<ItemStack> DATA_ITEM_STACK = SynchedEntityData.defineId(FloatingItemEntity.class, EntityDataSerializers.ITEM_STACK);
Expand All @@ -24,20 +22,14 @@ public FloatingItemEntity(EntityType<? extends FloatingEntity> type, Level level
}

public void setItem(ItemStack pStack) {
if (pStack.getItem() instanceof IFloatingGlowItem glow) {
setColor(glow.getColor(), glow.getEndColor());
if (pStack.getItem() instanceof SpiritShardItem shardItem) {
this.spiritType = shardItem.type;
}
if (!pStack.is(this.getDefaultItem()) || pStack.hasTag()) {
this.getEntityData().set(DATA_ITEM_STACK, pStack);
}
}

public void setColor(Color color, Color endColor) {
this.startColor = color;
getEntityData().set(DATA_COLOR, color.getRGB());
this.endColor = endColor;
getEntityData().set(DATA_END_COLOR, endColor.getRGB());
}
@Override
protected void defineSynchedData() {
this.getEntityData().define(DATA_ITEM_STACK, ItemStack.EMPTY);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import team.lodestar.lodestone.systems.particle.data.*;
import team.lodestar.lodestone.systems.particle.data.color.*;
import team.lodestar.lodestone.systems.particle.data.spin.*;
import team.lodestar.lodestone.systems.particle.render_types.*;
import team.lodestar.lodestone.systems.particle.world.*;

import java.awt.*;
Expand Down Expand Up @@ -212,7 +213,7 @@ public static void spawnParticles(NightTerrorSeekerEntity nightTerrorSeekerEntit
double lerpY = Mth.lerp(pDelta, oy, y) + motion.y / 4f;
double lerpZ = Mth.lerp(pDelta, oz, z) + motion.z / 4f;
float alphaMultiplier = (0.35f + extraAlpha) * Math.min(1, nightTerrorSeekerEntity.age * 0.2f);
SpiritLightSpecs.spiritLightSpecs(nightTerrorSeekerEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, firstColor.darker(), b -> b.setMotion(norm));
// SpiritLightSpecs.spiritLightSpecs(nightTerrorSeekerEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, firstColor.darker(), b -> b.setMotion(norm));

final ColorParticleDataBuilder colorDataBuilder = ColorParticleData.create(NIGHT_TERROR_DARK, NIGHT_TERROR_DARK)
.setEasing(Easing.QUINTIC_OUT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import team.lodestar.lodestone.systems.particle.data.*;
import team.lodestar.lodestone.systems.particle.data.color.*;
import team.lodestar.lodestone.systems.particle.data.spin.*;
import team.lodestar.lodestone.systems.particle.render_types.*;
import team.lodestar.lodestone.systems.particle.world.*;

import java.awt.*;
Expand Down Expand Up @@ -81,7 +82,7 @@ public static void spawnParticles(EthericNitrateEntity ethericNitrateEntity) {
double lerpY = Mth.lerp(pDelta, oy, y) - motion.y / 4f;
double lerpZ = Mth.lerp(pDelta, oz, z) - motion.z / 4f;
float alphaMultiplier = (0.35f + extraAlpha) * Math.min(1, ethericNitrateEntity.windUp * 2);
SpiritLightSpecs.spiritLightSpecs(ethericNitrateEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, SECOND_COLOR, b -> b.setMotion(norm));
//SpiritLightSpecs.spiritLightSpecs(ethericNitrateEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, SECOND_COLOR, b -> b.setMotion(norm));

final ColorParticleDataBuilder colorDataBuilder = ColorParticleData.create(SECOND_COLOR, SECOND_SMOKE_COLOR)
.setEasing(Easing.QUINTIC_OUT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import team.lodestar.lodestone.systems.particle.data.*;
import team.lodestar.lodestone.systems.particle.data.color.*;
import team.lodestar.lodestone.systems.particle.data.spin.*;
import team.lodestar.lodestone.systems.particle.render_types.*;
import team.lodestar.lodestone.systems.particle.world.*;

import java.awt.*;
Expand Down Expand Up @@ -121,7 +122,7 @@ public static void spawnParticles(VividNitrateEntity vividNitrateEntity) {
double lerpY = Mth.lerp(pDelta, oy, y) - motion.y / 4f;
double lerpZ = Mth.lerp(pDelta, oz, z) - motion.z / 4f;
float alphaMultiplier = (0.30f + extraAlpha) * Math.min(1, vividNitrateEntity.windUp * 2);
SpiritLightSpecs.spiritLightSpecs(vividNitrateEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, secondColor, b -> b.setMotion(norm));
// SpiritLightSpecs.spiritLightSpecs(vividNitrateEntity.level, new Vec3(lerpX, lerpY, lerpZ), firstColor, secondColor, b -> b.setMotion(norm));

final ColorParticleDataBuilder colorDataBuilder = ColorParticleData.create(secondColor, SECOND_SMOKE_COLOR)
.setEasing(Easing.QUINTIC_OUT)
Expand Down
Loading

0 comments on commit cae9547

Please sign in to comment.