Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dcc58c5
commit 7427e7c
Showing
2 changed files
with
37 additions
and
1 deletion.
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version=12.0 | ||
version=12.8pre1 | ||
|
||
mc_version=1.10.2 | ||
forge_version=12.18.1.2017 | ||
|
36 changes: 36 additions & 0 deletions
36
src/main/java/mod/chiselsandbits/client/ItemColorPatterns.java
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,36 @@ | ||
package mod.chiselsandbits.client; | ||
|
||
import mod.chiselsandbits.core.ClientSide; | ||
import mod.chiselsandbits.render.helpers.ModelUtil; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.client.renderer.color.IItemColor; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
|
||
public class ItemColorPatterns implements IItemColor | ||
{ | ||
|
||
@Override | ||
public int getColorFromItemstack( | ||
final ItemStack stack, | ||
final int tint ) | ||
{ | ||
if ( ClientSide.instance.holdingShift() ) | ||
{ | ||
final IBlockState state = Block.getStateById( tint ); | ||
final Block blk = state.getBlock(); | ||
final Item i = Item.getItemFromBlock( blk ); | ||
|
||
if ( i != null ) | ||
{ | ||
return ModelUtil.getItemStackColor( new ItemStack( i, 1, blk.getMetaFromState( state ) ), 0 ); | ||
} | ||
|
||
return 0xffffff; | ||
} | ||
|
||
return 0xffffffff; | ||
} | ||
|
||
} |