View difference between Paste ID: xaiqYxtw and wuphub53
SHOW: | | - or go back to the newest paste.
1
get shield item
2
3
shield.addPropertyOverride(new ResourceLocation("yourmod", "blockheld"), new IItemPropertyOverride() {
4
    @Override
5
    @SideOnly(Side.CLIENT)
6
    public float apply(ItemStack stack, World worldIn, EntityLivingBase entityIn) {
7
        if stack == entity's main hand
8-
            check = offhand
8+
            checkhand = offhand
9-
        else check = mainhand
9+
        else checkhand = mainhand
10
11-
        if (mainhand is a block)
11+
        if (checkhand holding a block)
12
            return 1;
13
        else return 0;
14
    }
15
});
16
17
18
19
in the main shield.json
20
 
21
{
22
    "parent": "builtin/entity",
23
    "overrides": [
24
        {
25
            "predicate": {
26-
                "yourmod:blockheld": 1 // this the resourcelocation you made above
26+
                "yourmod:blockheld": 1 // this the resourcelocation you made above. The JSON tests for a value greater than or equal to what we specify here. Predicates tested from top to bottom
27
            },
28
            "model": "yourmod:item/shield_with_block_held" // give it another item json
29
        }
30
    ]
31
}
32
33
in shield_with_block_held
34
35
{
36
    "parent": "builtin/entity",
37
    <add your transforms>
38
}