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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
@Override
|
||||
public EnumActionResult onItemUseFirst( final ItemStack is, final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
|
||||
{
|
||||
return AEApi.instance().partHelper().placeBus( is, pos, side, player, world ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, world ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,10 +169,9 @@ public class ItemFacade extends AEBaseItem implements IFacadeItem, IAlphaPassIte
|
||||
ds[0] = Item.getIdFromItem( l.getItem() );
|
||||
ds[1] = metadata;
|
||||
data.setIntArray( "x", ds );
|
||||
//TODO 1.9.4 - UniqueIdentifier => ResourceLocation ???
|
||||
final UniqueIdentifier ui = GameRegistry.findUniqueIdentifierFor( l.getItem() );
|
||||
data.setString( "modid", ui.modId );
|
||||
data.setString( "itemname", ui.name );
|
||||
final ResourceLocation ui = Item.REGISTRY.getNameForObject( l.getItem() );
|
||||
data.setString( "modid", ui.getResourceDomain() );
|
||||
data.setString( "itemname", ui.getResourcePath() );
|
||||
is.setTagCompound( data );
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -186,7 +186,7 @@ public final class ItemMultiPart extends AEBaseItem implements IPartItem, IItemG
|
||||
return EnumActionResult.PASS;
|
||||
}
|
||||
|
||||
return AEApi.instance().partHelper().placeBus( is, pos, side, player, w ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
return AEApi.instance().partHelper().placeBus( is, pos, side, player, hand, w ) ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -124,7 +124,7 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
|
||||
if( Platform.isClient() )
|
||||
{
|
||||
NetworkHandler.instance.sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ ) );
|
||||
NetworkHandler.instance.sendToServer( new PacketClick( pos, side, hitX, hitY, hitZ, hand ) );
|
||||
}
|
||||
return EnumActionResult.SUCCESS;
|
||||
}
|
||||
@@ -135,12 +135,10 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
public boolean serverSideToolLogic( final ItemStack is, final EntityPlayer p, final EnumHand hand, final World w, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ )
|
||||
{
|
||||
if( side != null )
|
||||
{
|
||||
//TODO 1.9.4 - 2 hands! Just do something!
|
||||
final EnumHand hand = EnumHand.MAIN_HAND;
|
||||
if( !Platform.hasPermissions( new DimensionalCoord( w, pos ), p ) )
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -226,8 +226,7 @@ public class ToolEntropyManipulator extends AEBasePoweredItem implements IBlockT
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
{
|
||||
//TODO 1.9.4 - getRayTraceResultFromPlayer => ?
|
||||
final RayTraceResult target = this.getRayTraceResultFromPlayer( w, p, true );
|
||||
final RayTraceResult target = this.rayTrace( w, p, true );
|
||||
|
||||
if( target == null )
|
||||
{
|
||||
|
||||
@@ -22,6 +22,8 @@ package appeng.items.tools.powered;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -117,7 +119,7 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
||||
}
|
||||
|
||||
@Override
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final EnumHand hand )
|
||||
public ActionResult<ItemStack> onItemRightClick( final ItemStack item, final World w, final EntityPlayer p, final @Nullable EnumHand hand )
|
||||
{
|
||||
if( this.getAECurrentPower( item ) > 1600 )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user