Second update pass (2/3) - 82 -> 0 errors

Second update pass which fixes all compile errors. Some parts may have
aftermath effect, hence why 3rd pass will check those maked with
"aftermath".
Errors: 82 -> 0. Mod can be launched.
This commit is contained in:
elix-x
2016-06-21 11:03:10 +02:00
parent 5498eb6d7c
commit 05aa6972c4
83 changed files with 564 additions and 405 deletions
@@ -22,12 +22,17 @@ package appeng.items.misc;
import java.util.EnumSet;
import java.util.List;
import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.client.renderer.color.IBlockColor;
import net.minecraft.client.renderer.color.IItemColor;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@@ -36,6 +41,7 @@ import appeng.client.ClientHelper;
import appeng.core.features.AEFeature;
import appeng.core.localization.GuiText;
import appeng.items.AEBaseItem;
import appeng.util.Platform;
public class ItemPaintBall extends AEBaseItem
@@ -47,6 +53,11 @@ public class ItemPaintBall extends AEBaseItem
{
this.setFeature( EnumSet.of( AEFeature.PaintBalls ) );
this.setHasSubtypes( true );
if( Platform.isClient() )
{
Minecraft.getMinecraft().getItemColors().registerItemColorHandler( new ItemPaintBallColor(), this );
}
}
@Override
@@ -82,29 +93,6 @@ public class ItemPaintBall extends AEBaseItem
return ( is.getItemDamage() >= DAMAGE_THRESHOLD ? GuiText.Lumen.getLocal() + ' ' : "" ) + this.getColor( is );
}
//TODO 1.9.4 - Move to IItemColor
@Override
public int getColorFromItemStack( final ItemStack stack, final int renderPass )
{
final AEColor col = this.getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
}
else
{
return r << 16 | g << 8 | b | 0xff << 24;
}
}
public AEColor getColor( final ItemStack is )
{
int dmg = is.getItemDamage();
@@ -146,4 +134,32 @@ public class ItemPaintBall extends AEBaseItem
final int dmg = is.getItemDamage();
return dmg >= DAMAGE_THRESHOLD;
}
@SideOnly( Side.CLIENT )
public class ItemPaintBallColor implements IItemColor
{
@Override
public int getColorFromItemstack( ItemStack stack, int tintIndex )
{
final AEColor col = getColor( stack );
final int colorValue = stack.getItemDamage() >= 20 ? col.mediumVariant : col.mediumVariant;
final int r = ( colorValue >> 16 ) & 0xff;
final int g = ( colorValue >> 8 ) & 0xff;
final int b = ( colorValue ) & 0xff;
if( stack.getItemDamage() >= 20 )
{
final float fail = 0.7f;
final int full = (int) ( 255 * 0.3 );
return (int) ( full + r * fail ) << 16 | (int) ( full + g * fail ) << 8 | (int) ( full + b * fail ) | 0xff << 24;
}
else
{
return r << 16 | g << 8 | b | 0xff << 24;
}
}
}
}