Skip to content

Commit

Permalink
Now just need some textures :3
Browse files Browse the repository at this point in the history
  • Loading branch information
enjarai committed Sep 20, 2024
1 parent 2b57aa2 commit 42e818f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static TexturedModelData getTexturedModelData() {
var y = i / GRID_HEIGHT;
modelPartData.addChild("scroll_" + i, ModelPartBuilder.create()
.uv(0, 0)
.cuboid(16f / GRID_WIDTH * x - 1.5f, 16f - (16f / GRID_HEIGHT * y - 1.5f), 16f, 3f, 3f, 1f),
.cuboid(16f / GRID_WIDTH * x + 1.5f, 16f / GRID_HEIGHT * y + 1.5f, 16f, 3f, 3f, 1f),
ModelTransform.NONE);
}
return TexturedModelData.of(modelData, 16, 16);
Expand All @@ -53,7 +53,9 @@ public void render(ScrollShelfBlockEntity entity, float tickDelta, MatrixStack m
light = WorldRenderer.getLightmapCoordinates(entity.getWorld(), entity.getPos().offset(facing));

matrices.push();
matrices.translate(0.5f, 0, 0.5f);
matrices.multiply(RotationAxis.NEGATIVE_Y.rotationDegrees(facing.asRotation()));
matrices.translate(-0.5f, 0, -0.5f);

for (int i = 0; i < GRID_WIDTH * GRID_HEIGHT; i++) {
var stack = entity.getStack(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ public void setStack(int slot, ItemStack stack) {
}
}

@Override
public void markDirty() {
super.markDirty();
if (world != null) {
world.updateListeners(pos, getCachedState(), getCachedState(), 0);
}
}

@Override
public boolean canPlayerUse(PlayerEntity player) {
return Inventory.canPlayerUse(this, player);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 42e818f

Please sign in to comment.