Skip to content

Commit

Permalink
forgot
Browse files Browse the repository at this point in the history
  • Loading branch information
j0code committed Feb 29, 2024
1 parent ef1c337 commit f9a56dc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/ItemStack.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Graphics from "./Graphics.js"
import Item, { type ItemData } from "./Item.js"
import { type HasData } from "./util/interfaces.js"
import { type NamespacedId, type HasData } from "./util/interfaces.js"

export default class ItemStack implements HasData {

readonly item: Item
#amount: number

constructor(item: Item | string, amount: number = 1) {
constructor(item: Item | NamespacedId, amount: number = 1) {
if (item instanceof Item) this.item = item
else this.item = new Item(item)
if (amount > 0 && amount <= this.item.maxItemStack) this.#amount = amount
Expand Down
3 changes: 2 additions & 1 deletion src/world/WorldGenerator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Block from "../block/Block.js";
import { blockdefs } from "../main.js";
import { type NamespacedId } from "../util/interfaces.js";
import World from "./World.js";
import YSON from "https://j0code.github.io/browserjs-yson/main.mjs"

Expand All @@ -8,7 +9,7 @@ export default class WorldGenerator {
static flat(world: World) {
for (let y = world.minY; y <= world.maxY && y <= 0; y++) {
for (let x = world.minX; x <= world.maxX; x++) {
let blockId: string
let blockId: NamespacedId
if (y <= -3) blockId = "tiny:stone"
else if(y < 0) blockId = "tiny:dirt"
else if(y == 0) blockId = "tiny:grass_block"
Expand Down

0 comments on commit f9a56dc

Please sign in to comment.