Use lambda

This commit is contained in:
raoulvdberge
2017-03-01 21:45:03 +01:00
parent 34eeee9f52
commit 48ed31413a

View File

@@ -28,13 +28,11 @@ import net.minecraft.client.renderer.VertexBuffer;
import net.minecraft.client.renderer.block.model.ModelBakery; import net.minecraft.client.renderer.block.model.ModelBakery;
import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.block.statemap.StateMap; import net.minecraft.client.renderer.block.statemap.StateMap;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.color.ItemColors;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@@ -262,20 +260,20 @@ public class ProxyClient extends ProxyCommon {
public void init(FMLInitializationEvent e) { public void init(FMLInitializationEvent e) {
super.init(e); super.init(e);
// Register IItemColor to handle passthrough ItemColors itemColors = Minecraft.getMinecraft().getItemColors();
ItemColors mcColors = Minecraft.getMinecraft().getItemColors();
mcColors.registerItemColorHandler(new IItemColor() { itemColors.registerItemColorHandler((stack, tintIndex) -> {
@Override
public int getColorFromItemstack(ItemStack stack, int tintIndex) {
CraftingPattern pattern = ItemPattern.getPatternFromCache(Minecraft.getMinecraft().world, stack); CraftingPattern pattern = ItemPattern.getPatternFromCache(Minecraft.getMinecraft().world, stack);
if (BakedModelPattern.canDisplayPatternOutput(pattern) && if (BakedModelPattern.canDisplayPatternOutput(pattern)) {
mcColors.getColorFromItemstack(pattern.getOutputs().get(0), tintIndex) != -1) { int color = itemColors.getColorFromItemstack(pattern.getOutputs().get(0), tintIndex);
return mcColors.getColorFromItemstack(pattern.getOutputs().get(0), tintIndex); // Take the item
if (color != -1) {
return color;
}
} }
return 0xFFFFFF; // Full white, no need to apply color return 0xFFFFFF; // Full white, no need to apply color
}
}, RSItems.PATTERN); }, RSItems.PATTERN);
} }