-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added ItemProperty for uno card item
itemgroup is now automatically populated with cards with indexes up to 64 (for all the uno cards) todo: make the rest of the textures
- Loading branch information
Showing
8 changed files
with
80 additions
and
2 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
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 |
---|---|---|
@@ -1,14 +1,39 @@ | ||
package net.awakaxis.uno.client; | ||
|
||
import net.awakaxis.uno.UNO; | ||
import net.awakaxis.uno.UNOBlockEntities; | ||
import net.awakaxis.uno.UNOItems; | ||
import net.awakaxis.uno.client.renderer.blockentity.CardDeckRenderer; | ||
import net.awakaxis.uno.item.UnoCardItem; | ||
import net.fabricmc.api.ClientModInitializer; | ||
import net.minecraft.client.multiplayer.ClientLevel; | ||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderers; | ||
import net.minecraft.client.renderer.item.ClampedItemPropertyFunction; | ||
import net.minecraft.client.renderer.item.ItemProperties; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import net.minecraft.world.item.ItemStack; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public class UNOClient implements ClientModInitializer { | ||
|
||
@Override | ||
public void onInitializeClient() { | ||
BlockEntityRenderers.register(UNOBlockEntities.CARD_DECK_BLOCK_ENTITY_TYPE, CardDeckRenderer::new); | ||
|
||
// fuck you, *unclamps your ClampedItemPropertyFunction* | ||
ClampedItemPropertyFunction function = new ClampedItemPropertyFunction() { | ||
@Override | ||
public float call(ItemStack itemStack, @Nullable ClientLevel clientLevel, @Nullable LivingEntity livingEntity, int i) { | ||
return itemStack.getOrCreateTag().getInt(UnoCardItem.CARD_INDEX_TAG); | ||
} | ||
|
||
@Override | ||
public float unclampedCall(ItemStack itemStack, @Nullable ClientLevel clientLevel, @Nullable LivingEntity livingEntity, int i) { | ||
return 0; | ||
} | ||
}; | ||
|
||
ItemProperties.register(UNOItems.UNO_CARD, new ResourceLocation("card_index"), function); | ||
} | ||
} |
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
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
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,20 @@ | ||
{ | ||
"parent": "item/generated", | ||
"textures": { | ||
"layer0": "uno:item/card_back" | ||
}, | ||
"overrides": [ | ||
{ | ||
"predicate": { | ||
"card_index": 0 | ||
}, | ||
"model": "uno:item/card_0" | ||
}, | ||
{ | ||
"predicate": { | ||
"card_index": 1 | ||
}, | ||
"model": "uno:item/card_1" | ||
} | ||
] | ||
} |
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": "uno:item/card_back" | ||
} | ||
} |
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": "uno:item/card_wild" | ||
} | ||
} |
Binary file not shown.