Skip to content
Open
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
3 changes: 3 additions & 0 deletions src/core/BlockState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ export class BlockState {
if (!this.name.equals(other.name)) {
return false
}
if (Object.keys(this.properties).length !== Object.keys(other.properties).length) {
return false
}
return Object.keys(this.properties).every(p => {
return other.properties[p] === this.properties[p]
})
Expand Down
6 changes: 5 additions & 1 deletion src/render/BlockDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ type ModelVariantEntry = ModelVariant | (ModelVariant & {
})[]

type ModelMultiPartCondition = {
OR: ModelMultiPartCondition[],
OR?: ModelMultiPartCondition[],
AND?: ModelMultiPartCondition[],
} | {
[key: string]: string,
}
Expand Down Expand Up @@ -91,6 +92,9 @@ export class BlockDefinition {
if (Array.isArray(condition.OR)) {
return condition.OR.some(c => this.matchesCase(c, props))
}
if (Array.isArray(condition.AND)) {
return condition.AND.every(c => this.matchesCase(c, props))
}
const states = condition as {[key: string]: string}
return Object.keys(states).every(k => {
const values = states[k].split('|')
Expand Down
8 changes: 8 additions & 0 deletions src/render/SpecialRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,6 +840,14 @@ export namespace SpecialRenderers {
'minecraft:chest': SpecialRenderers.chestRenderer(Identifier.create('normal')),
'minecraft:ender_chest': SpecialRenderers.chestRenderer(Identifier.create('ender')),
'minecraft:trapped_chest': SpecialRenderers.chestRenderer(Identifier.create('trapped')),
'minecraft:copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper')),
'minecraft:exposed_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_exposed')),
'minecraft:weathered_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_weathered')),
'minecraft:oxidized_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_oxidized')),
'minecraft:waxed_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper')),
'minecraft:waxed_exposed_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_exposed')),
'minecraft:waxed_weathered_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_weathered')),
'minecraft:waxed_oxidized_copper_chest': SpecialRenderers.chestRenderer(Identifier.create('copper_oxidized')),
}))

const SkullRenderers = new Map(Object.entries({
Expand Down