Skip to content

Commit

Permalink
Transmutation Page Update
Browse files Browse the repository at this point in the history
  • Loading branch information
SammySemicolon committed Nov 19, 2023
1 parent a5ded79 commit ff9eb6a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTic
for (int i = openPages; i < openPages + 2; i++) {
if (i < openEntry.pages.size()) {
BookPage page = openEntry.pages.get(i);
page.render(minecraft, poseStack, this, mouseX, mouseY, partialTicks);
boolean isRepeat = i % 2 != 0 && page.getClass().equals(openEntry.pages.get(i - 1).getClass());
page.render(minecraft, poseStack, this, mouseX, mouseY, partialTicks, isRepeat);
if (i % 2 == 0) {
page.renderLeft(minecraft, poseStack, this, mouseX, mouseY, partialTicks);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public boolean isValid() {
return true;
}

public void render(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks) {
public void render(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks, boolean isRepeat) {

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,12 @@
import team.lodestar.lodestone.systems.easing.*;
import team.lodestar.lodestone.systems.particle.builder.*;
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.screen.*;

import java.util.*;

import static com.sammy.malum.client.screen.codex.ArcanaCodexHelper.*;
import static net.minecraft.util.Mth.nextFloat;

public class SpiritRiteRecipePage extends BookPage {

Expand All @@ -35,11 +33,13 @@ public SpiritRiteRecipePage(MalumRiteType riteType) {
}

@Override
public void render(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks) {
if (ScreenParticleHandler.canSpawnParticles) {
RITE_PARTICLES.tick();
public void render(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks, boolean isRepeat) {
if (!isRepeat) {
if (ScreenParticleHandler.canSpawnParticles) {
RITE_PARTICLES.tick();
}
ScreenParticleHandler.renderParticles(RITE_PARTICLES);
}
ScreenParticleHandler.renderParticles(RITE_PARTICLES);
}

@Override
Expand Down Expand Up @@ -72,11 +72,12 @@ public void renderRite(PoseStack poseStack, EntryScreen screen, int left, int to
float xOffset = 25;
float yMotion = RandomHelper.randomBetween(rand, 0.2f, 0.4f) * (rand.nextBoolean() ? -1 : 1);
int lifetime = RandomHelper.randomBetween(rand, 40, 80);
float yScale = RandomHelper.randomBetween(rand, 0.2f, 0.6f);
float scale = RandomHelper.randomBetween(rand, 0.2f, 0.6f);
float spin = RandomHelper.randomBetween(rand, 0.2f, 0.4f);
ScreenParticleBuilder.create(LodestoneScreenParticleRegistry.WISP, RITE_PARTICLES)
.setTransparencyData(GenericParticleData.create(0.04f, 0.4f, 0f).setEasing(Easing.SINE_IN_OUT).build())
.setSpinData(SpinParticleData.create(nextFloat(rand, 0.2f, 0.4f)).setEasing(Easing.EXPO_OUT).build())
.setScaleData(GenericParticleData.create(yScale, 0).build())
.setSpinData(SpinParticleData.create(spin).build())
.setScaleData(GenericParticleData.create(scale, 0).build())
.setColorData(spiritType.createMainColorData().setCoefficient(0.25f).build())
.setLifetime(lifetime)
.setMotion(0, yMotion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,32 @@
import com.sammy.malum.*;
import com.sammy.malum.client.screen.codex.*;
import com.sammy.malum.common.recipe.*;
import com.sammy.malum.registry.common.*;
import com.sammy.malum.registry.common.item.*;
import net.minecraft.client.*;
import net.minecraft.network.chat.*;
import net.minecraft.world.item.*;
import net.minecraft.world.item.crafting.*;
import net.minecraftforge.data.loading.*;
import team.lodestar.lodestone.handlers.screenparticle.*;
import team.lodestar.lodestone.helpers.*;
import team.lodestar.lodestone.setup.*;
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.particle.data.spin.*;
import team.lodestar.lodestone.systems.particle.screen.*;
import team.lodestar.lodestone.systems.recipe.*;

import java.util.*;

import static com.sammy.malum.client.screen.codex.ArcanaCodexHelper.*;

@SuppressWarnings("all")
public class SpiritTransmutationPage extends BookPage {

private static final ScreenParticleHolder TRANSMUTATION_PARTICLES = new ScreenParticleHolder();

private final String headlineTranslationKey;
private final List<WrappedIngredient> itemTree = new ArrayList<>();

Expand Down Expand Up @@ -49,16 +60,31 @@ public boolean isValid() {
return !itemTree.isEmpty();
}

@Override
public void render(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks, boolean isRepeat) {
if (!isRepeat) {
if (ScreenParticleHandler.canSpawnParticles) {
TRANSMUTATION_PARTICLES.tick();
}
ScreenParticleHandler.renderParticles(TRANSMUTATION_PARTICLES);
}
}

@Override
public void renderLeft(Minecraft minecraft, PoseStack poseStack, EntryScreen screen, int mouseX, int mouseY, float partialTicks) {
int guiLeft = guiLeft();
int guiTop = guiTop();
Component component = new TranslatableComponent(headlineTranslationKey());
renderText(poseStack, component, guiLeft + 75 - minecraft.font.width(component.getString()) / 2, guiTop + 10);
List<WrappedIngredient> copy = new ArrayList<>(itemTree);
renderComponent(screen, poseStack, copy.remove(0), guiLeft + 67, guiTop + 44, mouseX, mouseY);
renderComponent(screen, poseStack, copy.remove(copy.size() - 1), guiLeft + 67, guiTop + 126, mouseX, mouseY);
renderComponents(screen, poseStack, copy, guiLeft + 65, guiTop + 82, mouseX, mouseY, false);
renderComponent(screen, poseStack, itemTree.get(0), guiLeft + 67, guiTop + 44, mouseX, mouseY);
renderComponent(screen, poseStack, itemTree.get(itemTree.size() - 1), guiLeft + 67, guiTop + 126, mouseX, mouseY);

int leftStart = guiLeft + 77 - (itemTree.size())*10;
for (int i = 1; i < itemTree.size()-1; i++) {
WrappedIngredient wrappedIngredient = itemTree.get(i);
renderComponent(screen, poseStack, wrappedIngredient, leftStart+i*20, guiTop + 85, mouseX, mouseY);
}
spawnParticles(guiLeft + 75, guiTop + 94, false);
}

@Override
Expand All @@ -67,9 +93,31 @@ public void renderRight(Minecraft minecraft, PoseStack poseStack, EntryScreen sc
int guiTop = guiTop();
Component component = new TranslatableComponent(headlineTranslationKey());
renderText(poseStack, component, guiLeft + 218 - minecraft.font.width(component.getString()) / 2, guiTop + 10);
List<WrappedIngredient> copy = new ArrayList<>(itemTree);
renderComponent(screen, poseStack, copy.remove(0), guiLeft + 209, guiTop + 44, mouseX, mouseY);
renderComponent(screen, poseStack, copy.remove(copy.size() - 1), guiLeft + 209, guiTop + 126, mouseX, mouseY);
renderComponents(screen, poseStack, DataHelper.reverseOrder(new ArrayList<>(), copy), guiLeft + 207, guiTop + 82, mouseX, mouseY, false);
renderComponent(screen, poseStack, itemTree.get(0), guiLeft + 209, guiTop + 44, mouseX, mouseY);
renderComponent(screen, poseStack, itemTree.get(itemTree.size() - 1), guiLeft + 209, guiTop + 126, mouseX, mouseY);
int leftStart = guiLeft + 199 + (itemTree.size())*10;
for (int i = 1; i < itemTree.size()-1; i++) {
WrappedIngredient wrappedIngredient = itemTree.get(itemTree.size() - i);
renderComponent(screen, poseStack, wrappedIngredient, leftStart-i*20, guiTop + 85, mouseX, mouseY);
}
spawnParticles(guiLeft + 218, guiTop + 94, true);
}

public void spawnParticles(float x,float y, boolean rightSide) {
if (ScreenParticleHandler.canSpawnParticles) {
Random rand = Minecraft.getInstance().level.random;
float scale = RandomHelper.randomBetween(rand, 0.2f, 0.4f);
float spin = RandomHelper.randomBetween(rand, 0.2f, 0.4f);
final double xOffset = Math.sin(((rightSide ? -1 : 1) *Minecraft.getInstance().level.getGameTime() % 320) / 320f * Math.PI * 2) * 46;
final double yOffset = Math.sin((Minecraft.getInstance().level.getGameTime() % 80) / 80f * Math.PI * 2) * 6;
ScreenParticleBuilder.create(LodestoneScreenParticleRegistry.WISP, TRANSMUTATION_PARTICLES)
.setTransparencyData(GenericParticleData.create(0.2f, 0.4f, 0.2f).build())
.setSpinData(SpinParticleData.create(spin).build())
.setScaleData(GenericParticleData.create(0, scale, 0).build())
.setColorData(SpiritTypeRegistry.ELDRITCH_SPIRIT.createMainColorData().setCoefficient(0.25f).build())
.setLifetime(80)
.setDiscardFunction(SimpleParticleOptions.ParticleDiscardFunctionType.ENDING_CURVE_INVISIBLE)
.spawn(x-xOffset, y+yOffset);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ protected void buildCraftingRecipes(Consumer<FinishedRecipe> consumer) {

new SpiritInfusionRecipeBuilder(ItemRegistry.ORNATE_NECKLACE.get(), 1, ItemRegistry.NECKLACE_OF_THE_MYSTIC_MIRROR.get(), 1)
.addExtraItem(ItemRegistry.RUNEWOOD_PLANKS.get(), 8)
.addExtraItem(ItemRegistry.SPECTRAL_OPTIC.get(), 4)
.addExtraItem(ItemRegistry.SPECTRAL_OPTIC.get(), 1)
.addExtraItem(Items.ENDER_EYE, 1)
.addSpirit(SACRED_SPIRIT, 24)
.build(consumer);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ff9eb6a

Please sign in to comment.