Merge pull request #1426 from thatsIch/e-overly-strong-cast

reduces overly strong type cast
This commit is contained in:
thatsIch 2015-05-09 15:57:47 +02:00
commit 168038c595
18 changed files with 45 additions and 36 deletions

View file

@ -628,7 +628,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
if( this.hasBlockTileEntity() ) if( this.hasBlockTileEntity() )
{ {
rotatable = (AEBaseTile) this.getTileEntity( w, x, y, z ); rotatable = (IOrientable) this.getTileEntity( w, x, y, z );
} }
else if( this instanceof IOrientableBlock ) else if( this instanceof IOrientableBlock )
{ {
@ -759,7 +759,7 @@ public class AEBaseBlock extends BlockContainer implements IAEFeature
if( this.hasBlockTileEntity() ) if( this.hasBlockTileEntity() )
{ {
ori = (AEBaseTile) this.getTileEntity( w, x, y, z ); ori = (IOrientable) this.getTileEntity( w, x, y, z );
} }
else if( this instanceof IOrientableBlock ) else if( this instanceof IOrientableBlock )
{ {

View file

@ -330,7 +330,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi
{ {
if( s instanceof AppEngSlot ) if( s instanceof AppEngSlot )
{ {
if( ( (AppEngSlot) s ).xDisplayPosition < 197 ) if( ( (Slot) s ).xDisplayPosition < 197 )
{ {
this.repositionSlot( (AppEngSlot) s ); this.repositionSlot( (AppEngSlot) s );
} }

View file

@ -200,7 +200,7 @@ public class ItemRepo
{ {
for( Object lp : Platform.getTooltip( is ) ) for( Object lp : Platform.getTooltip( is ) )
{ {
if( lp instanceof String && m.matcher( (String) lp ).find() ) if( lp instanceof String && m.matcher( (CharSequence) lp ).find() )
{ {
this.view.add( is ); this.view.add( is );
notDone = false; notDone = false;

View file

@ -448,7 +448,7 @@ public class BaseBlockRender
{ {
if( block.hasBlockTileEntity() ) if( block.hasBlockTileEntity() )
{ {
return (AEBaseTile) block.getTileEntity( w, x, y, z ); return (IOrientable) block.getTileEntity( w, x, y, z );
} }
else if( block instanceof IOrientableBlock ) else if( block instanceof IOrientableBlock )
{ {

View file

@ -44,6 +44,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate; import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketValueConfig; import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.ICustomNameObject; import appeng.helpers.ICustomNameObject;
import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.implementations.CraftingCPUCluster; import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.tile.crafting.TileCraftingTile; import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform; import appeng.util.Platform;
@ -74,7 +75,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
if( te instanceof TileCraftingTile ) if( te instanceof TileCraftingTile )
{ {
this.setCPU( (ICraftingCPU) ( (TileCraftingTile) te ).getCluster() ); this.setCPU( (ICraftingCPU) ( (IAEMultiBlock) te ).getCluster() );
} }
if( this.network == null && Platform.isServer() ) if( this.network == null && Platform.isServer() )

View file

@ -45,6 +45,7 @@ import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost; import appeng.api.networking.IGridHost;
import appeng.api.networking.IGridNode; import appeng.api.networking.IGridNode;
import appeng.api.networking.energy.IEnergyGrid; import appeng.api.networking.energy.IEnergyGrid;
import appeng.api.networking.energy.IEnergySource;
import appeng.api.networking.security.BaseActionSource; import appeng.api.networking.security.BaseActionSource;
import appeng.api.networking.storage.IBaseMonitor; import appeng.api.networking.storage.IBaseMonitor;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
@ -113,11 +114,11 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
if( monitorable instanceof IPortableCell ) if( monitorable instanceof IPortableCell )
{ {
this.powerSrc = (IPortableCell) monitorable; this.powerSrc = (IEnergySource) monitorable;
} }
else if( monitorable instanceof IMEChest ) else if( monitorable instanceof IMEChest )
{ {
this.powerSrc = (IMEChest) monitorable; this.powerSrc = (IEnergySource) monitorable;
} }
else if( monitorable instanceof IGridHost ) else if( monitorable instanceof IGridHost )
{ {
@ -128,7 +129,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
IGrid g = node.getGrid(); IGrid g = node.getGrid();
if( g != null ) if( g != null )
{ {
this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) ); this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) );
} }
} }
} }

View file

@ -32,6 +32,7 @@ import appeng.api.config.Settings;
import appeng.api.config.Upgrades; import appeng.api.config.Upgrades;
import appeng.api.config.YesNo; import appeng.api.config.YesNo;
import appeng.api.implementations.IUpgradeableHost; import appeng.api.implementations.IUpgradeableHost;
import appeng.api.implementations.guiobjects.IGuiItem;
import appeng.api.parts.IPart; import appeng.api.parts.IPart;
import appeng.api.util.IConfigManager; import appeng.api.util.IConfigManager;
import appeng.container.AEBaseContainer; import appeng.container.AEBaseContainer;
@ -96,7 +97,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{ {
this.lockPlayerInventorySlot( x ); this.lockPlayerInventorySlot( x );
this.tbSlot = x; this.tbSlot = x;
this.tbInventory = (NetworkToolViewer) ( (ToolNetworkTool) pii.getItem() ).getGuiObject( pii, w, xCoord, yCoord, zCoord ); this.tbInventory = (NetworkToolViewer) ( (IGuiItem) pii.getItem() ).getGuiObject( pii, w, xCoord, yCoord, zCoord );
break; break;
} }
} }

View file

@ -28,6 +28,7 @@ import net.minecraft.item.ItemHoe;
import net.minecraft.item.ItemPickaxe; import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword; import net.minecraft.item.ItemSword;
import net.minecraft.item.ItemTool;
import net.minecraft.stats.AchievementList; import net.minecraft.stats.AchievementList;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
@ -119,7 +120,7 @@ public class AppEngCraftingSlot extends AppEngSlot
this.thePlayer.addStat( AchievementList.bakeCake, 1 ); this.thePlayer.addStat( AchievementList.bakeCake, 1 );
} }
if( par1ItemStack.getItem() instanceof ItemPickaxe && ( (ItemPickaxe) par1ItemStack.getItem() ).func_150913_i() != Item.ToolMaterial.WOOD ) if( par1ItemStack.getItem() instanceof ItemPickaxe && ( (ItemTool) par1ItemStack.getItem() ).func_150913_i() != Item.ToolMaterial.WOOD )
{ {
this.thePlayer.addStat( AchievementList.buildBetterPickaxe, 1 ); this.thePlayer.addStat( AchievementList.buildBetterPickaxe, 1 );
} }

View file

@ -21,6 +21,7 @@ package appeng.core.features.registries.entries;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.implementations.tiles.IChestOrDrive;
@ -79,7 +80,7 @@ public class BasicCellHandler implements ICellHandler
@Override @Override
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan ) public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
{ {
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME ); Platform.openGUI( player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME );
} }
@Override @Override

View file

@ -21,6 +21,7 @@ package appeng.core.features.registries.entries;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import appeng.api.implementations.tiles.IChestOrDrive; import appeng.api.implementations.tiles.IChestOrDrive;
@ -77,7 +78,7 @@ public class CreativeCellHandler implements ICellHandler
@Override @Override
public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan ) public void openChestGui( EntityPlayer player, IChestOrDrive chest, ICellHandler cellHandler, IMEInventoryHandler inv, ItemStack is, StorageChannel chan )
{ {
Platform.openGUI( player, (AEBaseTile) chest, chest.getUp(), GuiBridge.GUI_ME ); Platform.openGUI( player, (TileEntity) chest, chest.getUp(), GuiBridge.GUI_ME );
} }
@Override @Override

View file

@ -43,7 +43,7 @@ public class AEGenericSchematicTile extends SchematicTile
ArrayList<ItemStack> list = new ArrayList<ItemStack>(); ArrayList<ItemStack> list = new ArrayList<ItemStack>();
if( tile instanceof AEBaseTile ) if( tile instanceof AEBaseTile )
{ {
ICommonTile tcb = (AEBaseTile) tile; ICommonTile tcb = (ICommonTile) tile;
tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list ); tcb.getDrops( tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, list );
} }

View file

@ -625,7 +625,7 @@ public class GridNode implements IGridNode, IPathItem
@Override @Override
public IReadOnlyCollection<IPathItem> getPossibleOptions() public IReadOnlyCollection<IPathItem> getPossibleOptions()
{ {
return (ReadOnlyCollection) this.getConnections(); return (IReadOnlyCollection) this.getConnections();
} }
@Override @Override

View file

@ -24,6 +24,7 @@ import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.common.util.ForgeDirection;
import ic2.api.energy.tile.IEnergyAcceptor;
import ic2.api.energy.tile.IEnergySink; import ic2.api.energy.tile.IEnergySink;
import ic2.api.energy.tile.IEnergyTile; import ic2.api.energy.tile.IEnergyTile;
@ -78,7 +79,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
{ {
this.getLayerFlags().add( LayerFlags.IC2_ENET ); this.getLayerFlags().add( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) this.getEnergySinkTile() ) ); MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
} }
} }
@ -92,7 +93,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
if( this.isInIC2() && Platform.isServer() ) if( this.isInIC2() && Platform.isServer() )
{ {
this.getLayerFlags().remove( LayerFlags.IC2_ENET ); this.getLayerFlags().remove( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergySink) this.getEnergySinkTile() ) ); MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySinkTile() ) );
} }
} }
@ -141,7 +142,7 @@ public class LayerIEnergySink extends LayerBase implements IEnergySink
IPart part = this.getPart( direction ); IPart part = this.getPart( direction );
if( part instanceof IEnergySink ) if( part instanceof IEnergySink )
{ {
return ( (IEnergySink) part ).acceptsEnergyFrom( emitter, direction ); return ( (IEnergyAcceptor) part ).acceptsEnergyFrom( emitter, direction );
} }
return false; return false;
} }

View file

@ -77,7 +77,7 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
if( !this.isInIC2() && Platform.isServer() && this.isTileValid() ) if( !this.isInIC2() && Platform.isServer() && this.isTileValid() )
{ {
this.getLayerFlags().add( LayerFlags.IC2_ENET ); this.getLayerFlags().add( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergySink) this.getEnergySourceTile() ) ); MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileLoadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
} }
} }
@ -91,7 +91,7 @@ public class LayerIEnergySource extends LayerBase implements IEnergySource
if( this.isInIC2() && Platform.isServer() ) if( this.isInIC2() && Platform.isServer() )
{ {
this.getLayerFlags().remove( LayerFlags.IC2_ENET ); this.getLayerFlags().remove( LayerFlags.IC2_ENET );
MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergySink) this.getEnergySourceTile() ) ); MinecraftForge.EVENT_BUS.post( new ic2.api.energy.event.EnergyTileUnloadEvent( (IEnergyTile) this.getEnergySourceTile() ) );
} }
} }

View file

@ -476,7 +476,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
if( inv instanceof IMEMonitor ) if( inv instanceof IMEMonitor )
{ {
( (IMEMonitor) inv ).addListener( this, this.handler ); ( (IBaseMonitor) inv ).addListener( this, this.handler );
} }
} }
} }

View file

@ -244,7 +244,7 @@ public class ShapedRecipe implements IRecipe, IRecipeBakeable
{ {
boolean matched = false; boolean matched = false;
for( ItemStack item : (ArrayList<ItemStack>) target ) for( ItemStack item : (Iterable<ItemStack>) target )
{ {
matched = matched || this.checkItemEquals( item, slot ); matched = matched || this.checkItemEquals( item, slot );
} }

View file

@ -528,22 +528,22 @@ public class Platform
} }
case 1: // ( A instanceof NBTTagByte ) case 1: // ( A instanceof NBTTagByte )
return ( (NBTTagByte) left ).func_150287_d() == ( (NBTTagByte) right ).func_150287_d(); return ( (NBTBase.NBTPrimitive) left ).func_150287_d() == ( (NBTBase.NBTPrimitive) right ).func_150287_d();
case 4: // else if ( A instanceof NBTTagLong ) case 4: // else if ( A instanceof NBTTagLong )
return ( (NBTTagLong) left ).func_150291_c() == ( (NBTTagLong) right ).func_150291_c(); return ( (NBTBase.NBTPrimitive) left ).func_150291_c() == ( (NBTBase.NBTPrimitive) right ).func_150291_c();
case 8: // else if ( A instanceof NBTTagString ) case 8: // else if ( A instanceof NBTTagString )
return ( (NBTTagString) left ).func_150285_a_().equals( ( (NBTTagString) right ).func_150285_a_() ) || ( (NBTTagString) left ).func_150285_a_().equals( ( (NBTTagString) right ).func_150285_a_() ); return ( (NBTTagString) left ).func_150285_a_().equals( ( (NBTTagString) right ).func_150285_a_() ) || ( (NBTTagString) left ).func_150285_a_().equals( ( (NBTTagString) right ).func_150285_a_() );
case 6: // else if ( A instanceof NBTTagDouble ) case 6: // else if ( A instanceof NBTTagDouble )
return ( (NBTTagDouble) left ).func_150286_g() == ( (NBTTagDouble) right ).func_150286_g(); return ( (NBTBase.NBTPrimitive) left ).func_150286_g() == ( (NBTBase.NBTPrimitive) right ).func_150286_g();
case 5: // else if ( A instanceof NBTTagFloat ) case 5: // else if ( A instanceof NBTTagFloat )
return ( (NBTTagFloat) left ).func_150288_h() == ( (NBTTagFloat) right ).func_150288_h(); return ( (NBTBase.NBTPrimitive) left ).func_150288_h() == ( (NBTBase.NBTPrimitive) right ).func_150288_h();
case 3: // else if ( A instanceof NBTTagInt ) case 3: // else if ( A instanceof NBTTagInt )
return ( (NBTTagInt) left ).func_150287_d() == ( (NBTTagInt) right ).func_150287_d(); return ( (NBTBase.NBTPrimitive) left ).func_150287_d() == ( (NBTBase.NBTPrimitive) right ).func_150287_d();
default: default:
return left.equals( right ); return left.equals( right );
@ -629,22 +629,22 @@ public class Platform
} }
case 1: // ( A instanceof NBTTagByte ) case 1: // ( A instanceof NBTTagByte )
return hash + ( (NBTTagByte) nbt ).func_150290_f(); return hash + ( (NBTBase.NBTPrimitive) nbt ).func_150290_f();
case 4: // else if ( A instanceof NBTTagLong ) case 4: // else if ( A instanceof NBTTagLong )
return hash + (int) ( (NBTTagLong) nbt ).func_150291_c(); return hash + (int) ( (NBTBase.NBTPrimitive) nbt ).func_150291_c();
case 8: // else if ( A instanceof NBTTagString ) case 8: // else if ( A instanceof NBTTagString )
return hash + ( (NBTTagString) nbt ).func_150285_a_().hashCode(); return hash + ( (NBTTagString) nbt ).func_150285_a_().hashCode();
case 6: // else if ( A instanceof NBTTagDouble ) case 6: // else if ( A instanceof NBTTagDouble )
return hash + (int) ( (NBTTagDouble) nbt ).func_150286_g(); return hash + (int) ( (NBTBase.NBTPrimitive) nbt ).func_150286_g();
case 5: // else if ( A instanceof NBTTagFloat ) case 5: // else if ( A instanceof NBTTagFloat )
return hash + (int) ( (NBTTagFloat) nbt ).func_150288_h(); return hash + (int) ( (NBTBase.NBTPrimitive) nbt ).func_150288_h();
case 3: // else if ( A instanceof NBTTagInt ) case 3: // else if ( A instanceof NBTTagInt )
return hash + ( (NBTTagInt) nbt ).func_150287_d(); return hash + ( (NBTBase.NBTPrimitive) nbt ).func_150287_d();
default: default:
return hash; return hash;
@ -856,7 +856,7 @@ public class Platform
return teA; return teA;
} }
return new InventoryLargeChest( "", teA, (TileEntityChest) teB ); return new InventoryLargeChest( "", teA, (IInventory) teB );
} }
public static boolean isModLoaded( String modid ) public static boolean isModLoaded( String modid )
@ -992,7 +992,7 @@ public class Platform
{ {
if( AESharedNBT.isShared( willAdd.getTagCompound() ) ) if( AESharedNBT.isShared( willAdd.getTagCompound() ) )
{ {
if( ( (AESharedNBT) willAdd.getTagCompound() ).getSpecialComparison() != null ) if( ( (IAETagCompound) willAdd.getTagCompound() ).getSpecialComparison() != null )
{ {
return true; return true;
} }

View file

@ -31,6 +31,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools; import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
@ -38,6 +39,7 @@ import net.minecraftforge.fluids.FluidStack;
import appeng.api.config.FuzzyMode; import appeng.api.config.FuzzyMode;
import appeng.api.storage.StorageChannel; import appeng.api.storage.StorageChannel;
import appeng.api.storage.data.IAEFluidStack; import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEStack;
import appeng.api.storage.data.IAETagCompound; import appeng.api.storage.data.IAETagCompound;
import appeng.util.Platform; import appeng.util.Platform;
@ -101,7 +103,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
} }
if( a instanceof AEFluidStack ) if( a instanceof AEFluidStack )
{ {
( (AEFluidStack) a ).copy(); ( (IAEStack<IAEFluidStack>) a ).copy();
} }
if( a instanceof FluidStack ) if( a instanceof FluidStack )
{ {
@ -215,7 +217,7 @@ public final class AEFluidStack extends AEStack<IAEFluidStack> implements IAEFlu
if( this.tagCompound != null ) if( this.tagCompound != null )
{ {
i.setTag( "tag", (NBTTagCompound) this.tagCompound ); i.setTag( "tag", (NBTBase) this.tagCompound );
} }
else else
{ {