Skip to content

Commit

Permalink
Polishing
Browse files Browse the repository at this point in the history
  • Loading branch information
miyucomics committed Oct 5, 2024
1 parent d5b2a82 commit 8b1a6e9
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.4.0
- added gauntlet staff
- added advancement for conjuring Hexxy
- added fun fortune telling feature to media jar
- added a section of pigment patterns and a pigment iota
- added two more patterns for affecting the top three iota of the stack, now you can arrange three iota in any way with a single pattern
- added effect to magic missiles to set the velocity of a target hit to 0.6th of their own normalized velocity + a bit of upwards push
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/miyucomics/hexical/blocks/MediaJarBlock.kt
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package miyucomics.hexical.blocks

import miyucomics.hexical.HexicalMain
import miyucomics.hexical.inits.HexicalSounds
import net.minecraft.block.*
import net.minecraft.entity.player.PlayerEntity
import net.minecraft.sound.BlockSoundGroup
import net.minecraft.sound.SoundCategory
import net.minecraft.text.Text
import net.minecraft.util.ActionResult
import net.minecraft.util.Hand
import net.minecraft.util.hit.BlockHitResult
Expand All @@ -25,6 +27,7 @@ class MediaJarBlock : TransparentBlock(Settings.of(Material.GLASS).emissiveLight
return ActionResult.SUCCESS
player.swingHand(hand)
world.playSoundFromEntity(null, player, HexicalSounds.PLAYER_SLURP, SoundCategory.PLAYERS, 1f, 1f)
player.sendMessage(Text.translatable("hexical.fortune." + HexicalMain.RANDOM.nextInt(20)), true)
return ActionResult.SUCCESS
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import net.minecraft.util.math.Vec3f
import net.minecraft.world.World

@OptIn(ExperimentalStdlibApi::class)
open class MeshEntity(entityType: EntityType<MeshEntity>, world: World) : BaseSpecklike(entityType, world) {
open class MeshEntity(entityType: EntityType<out MeshEntity>, world: World) : BaseSpecklike(entityType, world) {
constructor(world: World) : this(HexicalEntities.MESH_ENTITY, world)

var clientVertices: MutableList<Vec3f> = mutableListOf()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ import kotlin.math.sin

@OptIn(ExperimentalStdlibApi::class)
class MeshRenderer(ctx: EntityRendererFactory.Context) : EntityRenderer<MeshEntity>(ctx) {
private val sides = 6
private val angleIncrement = 2 * Math.PI / 6
private val renderLayer = RenderLayer.getEntityCutoutNoCull(modLoc("textures/entity/white.png"))

override fun getTexture(entity: MeshEntity?): Identifier? = null
override fun shouldRender(entity: MeshEntity?, frustum: Frustum?, x: Double, y: Double, z: Double) = true
override fun render(entity: MeshEntity?, yaw: Float, tickDelta: Float, matrices: MatrixStack, vertexConsumers: VertexConsumerProvider, light: Int) {
Expand Down Expand Up @@ -56,9 +52,9 @@ class MeshRenderer(ctx: EntityRendererFactory.Context) : EntityRenderer<MeshEnti
val perpendicularCrossProduct = perpendicular.crossProduct(direction)
val directionDotProduct = direction.multiply(direction.dotProduct(perpendicular))

for (i in 0 until sides) {
val startAngle = i * angleIncrement
val endAngle = (i + 1) % sides * angleIncrement
for (i in 0 until SIDES) {
val startAngle = i * ANGLE_INCREMENT
val endAngle = (i + 1) % SIDES * ANGLE_INCREMENT
val a = perpendicular.multiply(cos(startAngle)).add(perpendicularCrossProduct.multiply(sin(startAngle))).add(directionDotProduct.multiply(1 - cos(startAngle))).normalize().multiply(thickness)
val b = perpendicular.multiply(cos(endAngle)).add(perpendicularCrossProduct.multiply(sin(endAngle))).add(directionDotProduct.multiply(1 - cos(endAngle))).normalize().multiply(thickness)

Expand All @@ -72,4 +68,10 @@ class MeshRenderer(ctx: EntityRendererFactory.Context) : EntityRenderer<MeshEnti
private fun vertex(pose: Matrix4f, norm: Matrix3f, vertices: VertexConsumer, position: Vec3d, pigment: FrozenColorizer) {
vertices.vertex(pose, position.x.toFloat(), position.y.toFloat(), position.z.toFloat()).color(pigment.getColor(0f, position)).texture(0f, 0f).overlay(OverlayTexture.DEFAULT_UV).light(LightmapTextureManager.MAX_LIGHT_COORDINATE).normal(norm, 0f, 1f, 0f).next()
}

companion object {
private const val SIDES = 6
private const val ANGLE_INCREMENT = 2 * Math.PI / SIDES
private val renderLayer = RenderLayer.getEntityCutoutNoCull(modLoc("textures/entity/white.png"))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ class SpeckRenderer(ctx: EntityRendererFactory.Context) : EntityRenderer<SpeckEn
RenderSystem.enableCull()
} else {
val top = matrices.peek()
val buffer = vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCull(WHITE))
val buffer = vertexConsumers.getBuffer(renderLayer)
RenderUtils.drawLines(top.positionMatrix, top.normalMatrix, LightmapTextureManager.MAX_LIGHT_COORDINATE, entity.clientThickness * 0.05f / entity.clientSize, buffer, entity.clientVerts) { pos -> entity.clientPigment.getColor(0f, Vec3d(pos.x.toDouble(), pos.y.toDouble(), 0.0).multiply(2.0).add(entity.pos)) }
}

matrices.pop()
}

companion object {
private val WHITE: Identifier = modLoc("textures/entity/white.png")
private val renderLayer = RenderLayer.getEntityCutoutNoCull(modLoc("textures/entity/white.png"))
}
}
16 changes: 8 additions & 8 deletions src/main/java/miyucomics/hexical/inits/HexicalEntities.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ import net.minecraft.entity.SpawnGroup
import net.minecraft.util.registry.Registry

object HexicalEntities {
val MAGIC_MISSILE_ENTITY: EntityType<MagicMissileEntity> = EntityType.Builder.create(::MagicMissileEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(4).trackingTickInterval(20).build(HexicalMain.MOD_ID + ":magic_missile")
val LIVING_SCROLL_ENTITY: EntityType<LivingScrollEntity> = EntityType.Builder.create(::LivingScrollEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(10).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":living_scroll")
val MAGIC_MISSILE_ENTITY: EntityType<MagicMissileEntity> = EntityType.Builder.create(::MagicMissileEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(4).trackingTickInterval(20).build(HexicalMain.MOD_ID + ":magic_missile")
val SPIKE_ENTITY: EntityType<SpikeEntity> = EntityType.Builder.create(::SpikeEntity, SpawnGroup.MISC).setDimensions(1f, 1f).maxTrackingRange(10).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":spike")

val MESH_ENTITY: EntityType<MeshEntity> = EntityType.Builder.create(::MeshEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(10).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":mesh")
val SPECK_ENTITY: EntityType<SpeckEntity> = EntityType.Builder.create(::SpeckEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(10).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":speck")
val MESH_ENTITY: EntityType<MeshEntity> = EntityType.Builder.create(::MeshEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(32).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":mesh")
val SPECK_ENTITY: EntityType<SpeckEntity> = EntityType.Builder.create(::SpeckEntity, SpawnGroup.MISC).setDimensions(0.5f, 0.5f).maxTrackingRange(32).trackingTickInterval(1).build(HexicalMain.MOD_ID + ":speck")

@JvmStatic
fun init() {
Expand All @@ -32,11 +32,11 @@ object HexicalEntities {

@JvmStatic
fun clientInit() {
EntityRendererRegistry.register(LIVING_SCROLL_ENTITY) { ctx: EntityRendererFactory.Context -> LivingScrollRenderer(ctx) }
EntityRendererRegistry.register(MAGIC_MISSILE_ENTITY) { ctx: EntityRendererFactory.Context -> MagicMissileRenderer(ctx) }
EntityRendererRegistry.register(SPIKE_ENTITY) { ctx: EntityRendererFactory.Context -> SpikeRenderer(ctx) }
EntityRendererRegistry.register(LIVING_SCROLL_ENTITY) { ctx -> LivingScrollRenderer(ctx) }
EntityRendererRegistry.register(MAGIC_MISSILE_ENTITY) { ctx -> MagicMissileRenderer(ctx) }
EntityRendererRegistry.register(SPIKE_ENTITY) { ctx -> SpikeRenderer(ctx) }

EntityRendererRegistry.register(MESH_ENTITY) { ctx: EntityRendererFactory.Context -> MeshRenderer(ctx) }
EntityRendererRegistry.register(SPECK_ENTITY) { ctx: EntityRendererFactory.Context -> SpeckRenderer(ctx) }
EntityRendererRegistry.register(MESH_ENTITY) { ctx -> MeshRenderer(ctx) }
EntityRendererRegistry.register(SPECK_ENTITY) { ctx -> SpeckRenderer(ctx) }
}
}
24 changes: 23 additions & 1 deletion src/main/resources/assets/hexical/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@
"particle.minecraft.soul_7": "",
"misc.hexical.media_vision": "",

"hexical.fortune.0": "It is certain.",
"hexical.fortune.1": "It is decidedly so.",
"hexical.fortune.2": "Without a doubt.",
"hexical.fortune.3": "Yes definitely.",
"hexical.fortune.4": "You may rely on it.",
"hexical.fortune.5": "As I see it, yes.",
"hexical.fortune.6": "Most likely.",
"hexical.fortune.7": "Outlook good.",
"hexical.fortune.8": "Yes.",
"hexical.fortune.9": "Signs point to yes.",
"hexical.fortune.10": "Reply hazy, try again.",
"hexical.fortune.11": "Ask again later.",
"hexical.fortune.12": "Better not tell you now.",
"hexical.fortune.13": "Cannot predict.",
"hexical.fortune.14": "Concentrate and ask again.",
"hexical.fortune.15": "Don't count on it.",
"hexical.fortune.16": "My reply is no.",
"hexical.fortune.17": "My sources say no.",
"hexical.fortune.18": "Outlook not so good.",
"hexical.fortune.19": "Very doubtful.",

"hexcasting.mishap.bad_block.akashic_bookshelf": "an akashic bookshelf",
"hexcasting.mishap.bad_block.mage_block": "a mage block",
"hexcasting.mishap.bad_block.prestidigitation": "a prestidigitation-sensitive block",
Expand Down Expand Up @@ -180,7 +201,8 @@
"hexical.page.vanish_scroll.summary": "Causes the scroll paper to become invisible, leaving only the pattern, making it appear as though the pattern were magically etched into the surface.",

"hexical.page.media_jar.title": "Media Jar",
"hexical.page.media_jar.0": "I can craft this little decorative jar of liquid _media that glows quite brightly. Unfortunately, it seems the glass is too thick for me to draw _media through it, although I have read tales that ancient _Hexcasters were able to solve this issue and being able to bottle up liquid _media and use it for their _Hexes. I wonder what I would see if I took a sip.",
"hexical.page.media_jar.0": "I can craft this little decorative jar of liquid _media that glows quite brightly. Unfortunately, it seems the glass is too thick for me to draw _media through it, although I have read tales that ancient _Hexcasters were able to solve this issue and being able to bottle up liquid _media and use it for their _Hexes.",
"hexical.page.media_jar.1": "A similar item was built by prior _Hexcasters and they seemed to use it as crystal ball by sipping the fluid. Holding the energy of thought that permeates existence, perhaps its answers hold some merit.$(br2)$(o)Signs point to yes.$()",

"hexical.category.lamp": "Genie Lamp",
"hexical.category.lamp.desc": "I have heard tales from the villagers about a magical artifact. Legends say it contains a spirit that grants wishes, but I suspect that is just embellishment evolved over centuries of storytelling. However, legends must arise from something and I dedicate this section to my pursuit and research of it.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
}, {
"type": "patchouli:crafting",
"recipe": "hexical:media_jar"
}, {
"type": "patchouli:text",
"text": "hexical.page.media_jar.1"
}
]
}

0 comments on commit 8b1a6e9

Please sign in to comment.