Jump to content

SinfulCynic

Members
  • Posts

    3
  • Joined

  • Last visited

Everything posted by SinfulCynic

  1. Given a GeoModel you can retrieve bone positions relative to the origin of the model. Here is a little example I made that was used to render an item that was "stuck to the bone": - this is in kotlin and was for a tile entity. Use the concept behind this to render text at the positon of the desired bone /** * Add custom rendering code here outside geckolib's animation system */ override fun renderFirst( tile: ChamberTile, model: GeoModel, stack: PoseStack, buffer: MultiBufferSource, packedLight: Int ) { val rootBone = model.getBone("root") rootBone.ifPresent { bone -> val rot = Math.toDegrees(abs(bone.rotationY).toDouble()) * 2 stack.pushPose() stack.mulPose(Vector3f.YP.rotationDegrees(rot.toFloat())) stack.translate(bone.positionX.toDouble(), bone.positionY.toDouble(), bone.positionZ.toDouble()) //Do world text rendering here (look at player name tag render code) //anything rendered at this point will be relative to the selected bone stack.popPose() } }
  2. For anyone still wondering, here is the updated code for 1.19.3 with parchment mappings. public static VoxelShape rotateShape(Direction from, Direction to, VoxelShape shape) { VoxelShape[] buffer = new VoxelShape[]{shape, Shapes.empty()}; int times = (to.ordinal() - from.get2DDataValue() + 4) % 4; for (int i = 0; i < times; i++) { buffer[0].forAllBoxes((minX, minY, minZ, maxX, maxY, maxZ) -> buffer[1] = Shapes.or(buffer[1], Shapes.create(1 - maxZ, minY, minX, 1 - minZ, maxY, maxX))); buffer[0] = buffer[1]; buffer[1] = Shapes.empty(); } return buffer[0]; }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.