Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion src/main/resources/assets/opencomputers/models/item/drone.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,70 @@
{
"parent": "builtin/entity"
"parent": "minecraft:block/block",
"textures": {
"all": "opencomputers:item/drone",
"particle": "opencomputers:item/drone"
},
"elements": [
{
"from": [6, 6, 6],
"to": [10, 9, 10],
"rotation": {"angle": 45, "axis": "y", "origin": [8, 7.5, 8]},
"faces": {
"north": {"uv": [2, 7, 6, 10], "texture": "#all"},
"east": {"uv": [10, 7, 14, 10], "texture": "#all"},
"south": {"uv": [10, 6, 14, 9], "texture": "#all"},
"west": {"uv": [2, 7, 6, 10], "texture": "#all"},
"up": {"uv": [10, 10, 6, 6], "texture": "#all"},
"down": {"uv": [10, 6, 6, 10], "texture": "#all"}
}
},
{
"from": [1, 7, 1],
"to": [7, 8, 7],
"faces": {
"north": {"uv": [1, 7, 7, 8], "texture": "#all"},
"east": {"uv": [1, 7, 7, 8], "texture": "#all"},
"south": {"uv": [1, 7, 7, 8], "texture": "#all"},
"west": {"uv": [1, 7, 7, 8], "texture": "#all"},
"up": {"uv": [7, 7, 1, 1], "texture": "#all"},
"down": {"uv": [7, 1, 1, 7], "texture": "#all"}
}
},
{
"from": [1, 7, 9],
"to": [7, 8, 15],
"faces": {
"north": {"uv": [1, 8, 7, 9], "texture": "#all"},
"east": {"uv": [1, 8, 7, 9], "texture": "#all"},
"south": {"uv": [1, 8, 7, 9], "texture": "#all"},
"west": {"uv": [1, 8, 7, 9], "texture": "#all"},
"up": {"uv": [7, 15, 1, 9], "texture": "#all"},
"down": {"uv": [7, 9, 1, 15], "texture": "#all"}
}
},
{
"from": [9, 7, 1],
"to": [15, 8, 7],
"faces": {
"north": {"uv": [9, 7, 15, 8], "texture": "#all"},
"east": {"uv": [9, 7, 15, 8], "texture": "#all"},
"south": {"uv": [9, 7, 15, 8], "texture": "#all"},
"west": {"uv": [9, 7, 15, 8], "texture": "#all"},
"up": {"uv": [15, 7, 9, 1], "texture": "#all"},
"down": {"uv": [15, 1, 9, 7], "texture": "#all"}
}
},
{
"from": [9, 7, 9],
"to": [15, 8, 15],
"faces": {
"north": {"uv": [9, 8, 15, 9], "texture": "#all"},
"east": {"uv": [9, 8, 15, 9], "texture": "#all"},
"south": {"uv": [9, 8, 15, 9], "texture": "#all"},
"west": {"uv": [9, 8, 15, 9], "texture": "#all"},
"up": {"uv": [15, 15, 9, 9], "texture": "#all"},
"down": {"uv": [15, 9, 9, 15], "texture": "#all"}
}
}
]
}
44 changes: 0 additions & 44 deletions src/main/scala/li/cil/oc/client/renderer/block/DroneModel.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ object ModelInitialization {
registry.put(PrintBlockLocation, PrintModel)
registry.put(PrintItemLocation, PrintModel)
registry.put(RobotItemLocation, RobotModel)
registry.put(loc(Constants.ItemName.Drone, "inventory"), DroneModel)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What puts the inventory on the drone now that the model class is gone?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main item model JSON!


val modelOverrides = Map[String, BakedModel => BakedModel](
Constants.BlockName.ScreenTier1 -> (_ => ScreenModel),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import net.minecraft.client.renderer.RenderType
import net.neoforged.neoforge.client.model.data.ModelData
import org.joml.Vector3f

trait SmartBlockModelBase extends BakedModel {
abstract class SmartBlockModelBase extends BakedModel {
override def getOverrides: ItemOverrides = ItemOverrides.EMPTY

override def getQuads(state: BlockState, side: Direction, rand: RandomSource): util.List[BakedQuad] =
Expand Down Expand Up @@ -99,21 +99,6 @@ trait SmartBlockModelBase extends BakedModel {
math.max(minZ, math.min(maxZ, vertex.z)))))
}

protected def rotateVector(v: Vec3, angle: Double, axis: Vec3) = {
def scale(v: Vec3, s: Double) = v.scale(s)
val cosAngle = math.cos(angle)
val sinAngle = math.sin(angle)
scale(v, cosAngle)
.add(scale(axis.cross(v), sinAngle))
.add(scale(axis, axis.dot(v) * (1 - cosAngle)))
}

protected def rotateFace(face: Array[Vec3], angle: Double, axis: Vec3, around: Vec3 = new Vec3(0.5, 0.5, 0.5)) =
face.map(v => rotateVector(v.subtract(around), angle, axis).add(around))

protected def rotateBox(box: Array[Array[Vec3]], angle: Double, axis: Vec3 = new Vec3(0, 1, 0), around: Vec3 = new Vec3(0.5, 0.5, 0.5)) =
box.map(face => rotateFace(face, angle, axis, around))

protected def bakeQuads(box: Array[Array[Vec3]], texture: Array[TextureAtlasSprite], color: Option[Int]): Array[BakedQuad] =
bakeQuads(box, texture, color.getOrElse(White))

Expand Down
Loading