-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
different appearance for fixed-rate contracts (#619)
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "wares:item/delivery_agreement" | ||
}, | ||
"overrides": [ | ||
{"predicate": { "count": 1.0000 },"model": "wares:item/fixed_rates_delivery_agreement"} | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
kubejs/assets/wares/models/item/fixed_rates_delivery_agreement.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "wares:item/fixed_rates_delivery_agreement" | ||
} | ||
} |
Binary file added
BIN
+463 Bytes
kubejs/assets/wares/textures/item/fixed_rates_delivery_agreement.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// priority: -20 | ||
|
||
global.predicates = {} | ||
|
||
/** | ||
* | ||
* @param {Internal.ItemStack} stack | ||
* @returns | ||
*/ | ||
global.predicates.waresPredicate = function (stack) { | ||
if(!stack.nbt) return 0 | ||
return stack.nbt.ordered ? 0 : 1 | ||
}; | ||
|
||
//by @reveter from the kubejs discord | ||
StartupEvents.postInit((event) => { | ||
console.log("= predicate"); | ||
if (!Platform.isClientEnvironment) return; | ||
const $ItemProperties = Java.loadClass( | ||
"net.minecraft.client.renderer.item.ItemProperties" | ||
); | ||
console.log("= got class"); | ||
console.log($ItemProperties); | ||
|
||
$ItemProperties.register( | ||
Item.of("wares:delivery_agreement"), | ||
new ResourceLocation("count"), | ||
(stack, world, living, seed) => { | ||
if(!global.predicates.waresPredicate) return 0; | ||
return global.predicates.waresPredicate(stack); | ||
} | ||
); | ||
}); |