Skip to content

Commit

Permalink
Wiki Files
Browse files Browse the repository at this point in the history
  • Loading branch information
Its-Cryptic committed Oct 8, 2024
1 parent b085bf1 commit ea9b6fb
Show file tree
Hide file tree
Showing 7 changed files with 732 additions and 0 deletions.
113 changes: 113 additions & 0 deletions docs/wiki/Home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Overview

Lodestone is a library containing all the code that I throughout my time in the modding scene have found useful. It contains utilities such as a rendering system, static config initialization, simplified block entities & inventories, a simple multiblock system, a custom fire effects, and so on. Just a bunch of random useful stuff that I needed in my other projects.

The way I approach writing this wiki will essentially work on a priority system. You are free to ping me at any time in my discord asking for help with a certain thing, and if I have time I will write about that thing here. After enough time the wiki will contain everything, with the most frequently used things being prioritized.

# Setup Guide

Like any other mod, Lodestone needs to be added to the project.
This can be done using the [Blamejared Maven](https://maven.blamejared.com/team/lodestar/lodestone/lodestone/).

## Forge

On Forge, Lodestone requires [Curios](https://github.com/TheIllusiveC4/Curios).
```groovy
repositories {
mavenCentral()
maven {
name 'Curios maven'
url = "https://maven.theillusivec4.top/"
}
maven { url = 'https://maven.blamejared.com/' }
}
dependencies {
minecraft "net.minecraftforge:forge:${project.minecraftVersion}-${project.forgeVersion}"
implementation fg.deobf("team.lodestar.lodestone:lodestone:${minecraft_version}-${lodestone_version}")
//1.18.2 Example: implementation fg.deobf("team.lodestar.lodestone:lodestone:1.18.2-1.4.1.435")
//1.19.2 Example: implementation fg.deobf("team.lodestar.lodestone:lodestone:1.19.2-1.4.2.83")
//1.20.1 Example: implementation fg.deobf("team.lodestar.lodestone:lodestone:1.20.1-1.4.2.62")
compileOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${minecraft_version}:api")
runtimeOnly fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${minecraft_version}")
}
```

### Mixins

Lodestone utilizes mixins, and without the appropriate plugin present in your Lodestone-dependent project the game will refuse to launch.

```groovy
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
classpath 'org.spongepowered:mixingradle:0.7-SNAPSHOT'
}
}
apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'org.spongepowered.mixin'
```

I believe writing your buildscript as such, and making sure to apply the `'org.spongepowered.mixin'` plugin is enough. For reference, the buildscript is the very first codeblock in your build.gradle file. It should be right at the very top.

For more info, consult the [Mixin wiki](https://github.com/SpongePowered/Mixin/wiki/Mixins-on-Minecraft-Forge).

## Fabric

On Fabric, Lodestone requires [Cardinal Components](https://github.com/Ladysnake/Cardinal-Components-API), [Trinkets](https://github.com/emilyploszaj/trinkets), [Porting Lib](https://github.com/Fabricators-of-Create/Porting-Lib), and [Reach Entity Attributes](https://github.com/JamiesWhiteShirt/reach-entity-attributes).
```txt
port_lib_version = 2.3.4+1.20.1
port_lib_modules = \
accessors,\
base,\
blocks,\
core,\
data,\
extensions,\
lazy_registration,\
model_generators,\
models,\
networking,\
tool_actions
```
```groovy
repositories {
maven {url = 'https://maven.blamejared.com/' }
maven {url = "https://mvn.devos.one/releases/" }
maven {url = "https://api.modrinth.com/maven" }
maven {url = "https://maven.theillusivec4.top/"}
maven {url = "https://maven.jamieswhiteshirt.com/libs-release"}
maven {url = 'https://maven.ladysnake.org/releases'}
maven {url = "https://maven.terraformersmc.com/"}
}
dependencies {
modImplementation("team.lodestar.lodestone:lodestone:${project.minecraft_version}-${project.lodestone_version}-fabric")
//For this you also need the following
modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-base:${project.cca_version}")
modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-entity:${project.cca_version}")
modImplementation("dev.onyxstudios.cardinal-components-api:cardinal-components-world:${project.cca_version}")
modImplementation("dev.emi:trinkets:${project.trinkets_version}")
for (String module in port_lib_modules.split(",")) {
modImplementation("io.github.fabricators_of_create.Porting-Lib:$module:$port_lib_version")
}
modImplementation("com.jamieswhiteshirt:reach-entity-attributes:${project.rea_version}")
}
```


# Documented Features
- [InWorld Particles](https://github.com/LodestarMC/Lodestone/wiki/InWorld-Particles)
- [Post Processing Shaders](https://github.com/LodestarMC/Lodestone/wiki/Post-Processing-Shaders)
62 changes: 62 additions & 0 deletions docs/wiki/InWorld-Particles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
One of the more sought out and key features of Lodestone is the Particle System.
Lodestone Particles are still based on the Particle Engine, it's not a brand new thing with no connection to minecraft, but it is quite elaborate.
The basic premise is to allow Lodestone Particles to have everything about them defined by the WorldParticleBuilder, hopefully preventing the need for any hardcoded behavior.

To begin, you will need to instantiate a WorldParticleBuilder using `WorldParticleBuilder.create`
```java
var builder = WorldParticleBuilder.create(LodestoneParticleRegistry.WISP_PARTICLE)
```
The Particle Builder will require a particle type and nothing else. Once that's done, you are free to edit the properties that your particle will be spawned with in any way you want. And once you're done, simply use one of the `spawn` methods provided by the builder.

Here's an example of an actual effect:
```java
import net.minecraft.client.*;
import net.minecraft.client.player.*;
import net.minecraft.world.level.*;
import net.minecraft.world.phys.*;
import net.minecraftforge.api.distmarker.*;
import net.minecraftforge.event.*;
import net.minecraftforge.eventbus.api.*;
import net.minecraftforge.fml.common.*;
import team.lodestar.lodestone.registry.common.particle.*;
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 java.awt.Color;

@Mod.EventBusSubscriber(value = Dist.CLIENT, bus = Mod.EventBusSubscriber.Bus.FORGE)
public class ExampleParticleEffect {

@SubscribeEvent
public static void clientTick(TickEvent.ClientTickEvent event) {
final LocalPlayer player = Minecraft.getInstance().player;
if (player != null) {
spawnExampleParticles(player.level(), player.position());
}
}

public static void spawnExampleParticles(Level level, Vec3 pos) {
Color startingColor = new Color(100, 0, 100);
Color endingColor = new Color(0, 100, 200);
WorldParticleBuilder.create(LodestoneParticleRegistry.WISP_PARTICLE)
.setScaleData(GenericParticleData.create(0.5f, 0).build())
.setTransparencyData(GenericParticleData.create(0.75f, 0.25f).build())
.setColorData(ColorParticleData.create(startingColor, endingColor).setCoefficient(1.4f).setEasing(Easing.BOUNCE_IN_OUT).build())
.setSpinData(SpinParticleData.create(0.2f, 0.4f).setSpinOffset((level.getGameTime() * 0.2f) % 6.28f).setEasing(Easing.QUARTIC_IN).build())
.setLifetime(40)
.addMotion(0, 0.01f, 0)
.enableNoClip()
.spawn(level, pos.x, pos.y, pos.z);
}
}
```

The given codeblock is a class that when present in your mod will spawn a particle every tick at the player's position.
Worth noting is; for scale, transparency, color, and spin you will be using ParticleData classes.
These include: `ColorParticleData` for color, `SpinParticleData` for rotation and `GenericParticleData` for everything else.
Any of these are simply instantiated using an appropriate `#create` function, and here you will define things such as starting, middle and ending values, a lifetime coefficient, as well as easings. Finalize this by using `#build`

For more examples of InWorld Particle Effects please look at this area of the Malum Repository: [Example Visual Effects](https://github.com/SammySemicolon/Malum-Mod/tree/1.6-1.20.1/src/main/java/com/sammy/malum/visual_effects)
Loading

0 comments on commit ea9b6fb

Please sign in to comment.