-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
de9c0ab
commit 15f4f86
Showing
16 changed files
with
185 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
src/main/java/miyucomics/hexical/registry/HexicalStatusEffects.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
package miyucomics.hexical.registry | ||
|
||
import miyucomics.hexical.HexicalMain | ||
import miyucomics.hexical.status_effects.MediaSicknessStatusEffect | ||
import miyucomics.hexical.status_effects.MediaVisionStatusEffect | ||
import net.minecraft.util.registry.Registry | ||
|
||
object HexicalStatusEffects { | ||
val MEDIA_SICKNESS_STATUS_EFFECT = MediaSicknessStatusEffect() | ||
val MEDIA_VISION_STATUS_EFFECT = MediaVisionStatusEffect() | ||
|
||
@JvmStatic | ||
fun init() { | ||
Registry.register(Registry.STATUS_EFFECT, HexicalMain.id("media_sickness"), MEDIA_SICKNESS_STATUS_EFFECT) | ||
Registry.register(Registry.STATUS_EFFECT, HexicalMain.id("media_vision"), MEDIA_VISION_STATUS_EFFECT) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package miyucomics.hexical.utils | ||
|
||
import kotlin.math.floor | ||
|
||
class PerlinNoise(seed: Int) { | ||
private val permutations: IntArray | ||
|
||
init { | ||
val random = kotlin.random.Random(seed) | ||
permutations = IntArray(512) { random.nextInt(256) } | ||
} | ||
|
||
private fun fade(t: Double): Double { | ||
return t * t * t * (t * (t * 6 - 15) + 10) | ||
} | ||
|
||
private fun lerp(t: Double, a: Double, b: Double): Double { | ||
return a + t * (b - a) | ||
} | ||
|
||
private fun grad(hash: Int, x: Double, y: Double, z: Double, w: Double): Double { | ||
val h = hash and 31 | ||
val a = if (h and 1 == 0) x else -x | ||
val b = if (h and 2 == 0) y else -y | ||
val c = if (h and 4 == 0) z else -z | ||
val d = if (h and 8 == 0) w else -w | ||
return a + b + c + d | ||
} | ||
|
||
fun noise(x: Double, y: Double, z: Double, w: Double): Double { | ||
val X = floor(x).toInt() and 255 | ||
val Y = floor(y).toInt() and 255 | ||
val Z = floor(z).toInt() and 255 | ||
val W = floor(w).toInt() and 255 | ||
|
||
val x = x - floor(x) | ||
val y = y - floor(y) | ||
val z = z - floor(z) | ||
val w = w - floor(w) | ||
|
||
val u = fade(x) | ||
val v = fade(y) | ||
val t = fade(z) | ||
val s = fade(w) | ||
|
||
val A = permutations[X] + Y | ||
val AA = permutations[A] + Z | ||
val AAA = permutations[AA] + W | ||
val AAB = permutations[AA + 1] + W | ||
val AB = permutations[A + 1] + Z | ||
val ABA = permutations[AB] + W | ||
val ABB = permutations[AB + 1] + W | ||
val B = permutations[X + 1] + Y | ||
val BA = permutations[B] + Z | ||
val BAA = permutations[BA] + W | ||
val BAB = permutations[BA + 1] + W | ||
val BB = permutations[B + 1] + Z | ||
val BBA = permutations[BB] + W | ||
val BBB = permutations[BB + 1] + W | ||
|
||
return lerp(s, | ||
lerp(t, | ||
lerp(v, | ||
lerp(u, grad(permutations[AAA], x, y, z, w), grad(permutations[BAA], x - 1, y, z, w)), | ||
lerp(u, grad(permutations[ABA], x, y - 1, z, w), grad(permutations[BBA], x - 1, y - 1, z, w)) | ||
), | ||
lerp(v, | ||
lerp(u, grad(permutations[AAB], x, y, z - 1, w), grad(permutations[BAB], x - 1, y, z - 1, w)), | ||
lerp(u, grad(permutations[ABB], x, y - 1, z - 1, w), grad(permutations[BBB], x - 1, y - 1, z - 1, w)) | ||
) | ||
), | ||
lerp(t, | ||
lerp(v, | ||
lerp(u, grad(permutations[AAA + 1], x, y, z, w - 1), grad(permutations[BAA + 1], x - 1, y, z, w - 1)), | ||
lerp(u, grad(permutations[ABA + 1], x, y - 1, z, w - 1), grad(permutations[BBA + 1], x - 1, y - 1, z, w - 1)) | ||
), | ||
lerp(v, | ||
lerp(u, grad(permutations[AAB + 1], x, y, z - 1, w - 1), grad(permutations[BAB + 1], x - 1, y, z - 1, w - 1)), | ||
lerp(u, grad(permutations[ABB + 1], x, y - 1, z - 1, w - 1), grad(permutations[BBB + 1], x - 1, y - 1, z - 1, w - 1)) | ||
) | ||
) | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/main/resources/assets/hexical/models/block/media_jar.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/main/resources/assets/hexical/shaders/post/media_vision.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"targets": [ | ||
"swap" | ||
], | ||
"passes": [ | ||
{ | ||
"name": "sobel", | ||
"intarget": "minecraft:main", | ||
"outtarget": "swap" | ||
}, | ||
{ | ||
"name": "hexical:media_vision", | ||
"intarget": "swap", | ||
"outtarget": "minecraft:main" | ||
} | ||
] | ||
} |
15 changes: 15 additions & 0 deletions
15
src/main/resources/assets/hexical/shaders/program/media_vision.fsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#version 150 | ||
|
||
uniform sampler2D DiffuseSampler; | ||
|
||
in vec2 texCoord; | ||
|
||
out vec4 fragColor; | ||
|
||
void main() { | ||
if (distance(texture(DiffuseSampler, texCoord).rgb, vec3(0.0)) > 0.5) { | ||
fragColor = vec4(0.78, 0.56, 0.94, 1.0); | ||
} else { | ||
fragColor = vec4(0.0); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/main/resources/assets/hexical/shaders/program/media_vision.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"blend": { | ||
"func": "add", | ||
"srcrgb": "srcalpha", | ||
"dstrgb": "1-srcalpha" | ||
}, | ||
"vertex": "sobel", | ||
"fragment": "hexical:media_vision", | ||
"attributes": [ "Position" ], | ||
"samplers": [ | ||
{ "name": "DiffuseSampler" } | ||
], | ||
"uniforms": [ | ||
{ "name": "ProjMat", "type": "matrix4x4", "count": 16, "values": [ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] }, | ||
{ "name": "OutSize", "type": "float", "count": 2, "values": [ 1.0, 1.0 ] } | ||
] | ||
} |
Binary file added
BIN
+356 Bytes
src/main/resources/assets/hexical/textures/mob_effect/media_vision.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.