rest of BC commit

This commit is contained in:
thatsIch 2015-06-18 20:10:37 +02:00
parent 97f23cf955
commit 51ed55510c
9 changed files with 219 additions and 217 deletions

View File

@ -31,6 +31,7 @@ import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.util.AEPartLocation;
import appeng.client.render.IRenderHelper;
@ -52,20 +53,18 @@ public interface IFacadePart
* used to collide, and pick the part
*
* @param ch collision helper
* @param e colliding entity
* @param e colliding entity
*/
void getBoxes( IPartCollisionHelper ch, Entity e );
/**
* render the part.
*
* @param x x pos of part
* @param y y pos of part
* @param z z pos of part
* @param instance render helper
* @param renderer renderer
* @param fc face container
* @param busBounds bounding box
* @param pos pos of part
* @param instance render helper
* @param renderer renderer
* @param fc face container
* @param busBounds bounding box
* @param renderStilt if to render stilt
*/
@SideOnly( Side.CLIENT )

View File

@ -21,9 +21,10 @@ package appeng.core;
import java.io.File;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull;
import com.google.common.base.Stopwatch;
import net.minecraftforge.fml.common.FMLCommonHandler;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
@ -36,6 +37,7 @@ import net.minecraftforge.fml.common.event.FMLServerAboutToStartEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.FMLServerStoppingEvent;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import appeng.core.crash.CrashInfo;
import appeng.core.crash.IntegrationCrashEnhancement;
import appeng.core.crash.ModCrashEnhancement;
@ -49,8 +51,6 @@ import appeng.services.VersionChecker;
import appeng.services.version.VersionCheckerConfig;
import appeng.util.Platform;
import com.google.common.base.Stopwatch;
@Mod( modid = AppEng.MOD_ID, acceptedMinecraftVersions = "[1.8]", name = AppEng.MOD_NAME, version = AEConfig.VERSION, dependencies = AppEng.MOD_DEPENDENCIES, guiFactory = "appeng.client.gui.config.AEConfigGuiFactory" )
public final class AppEng
@ -76,7 +76,7 @@ public final class AppEng
private File configDirectory;
AppEng()
private AppEng()
{
this.imcHandler = new IMCHandler();

View File

@ -24,6 +24,7 @@ import java.io.IOException;
import io.netty.buffer.ByteBuf;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -140,9 +141,9 @@ public class FacadeContainer implements IFacadeContainer
if( isBC && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
final IFacadePart created = bc.createFacadePart( Block.getStateById( ids[0] ), ids[1], side );
final IBlockState state = Block.getStateById( ids[0] );
final IFacadePart created = bc.createFacadePart( state, side );
changed = changed || this.storage.getFacade( x ) == null;
this.storage.setFacade( x, bc.createFacadePart( Block.getStateById( id[0] ), ids[1], side ) );
this.storage.setFacade( x, created );
}

View File

@ -36,6 +36,7 @@ import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import appeng.api.AEApi;
import appeng.api.parts.IBoxProvider;
import appeng.api.parts.IFacadeContainer;
@ -129,7 +130,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
if( this.notAEFacade() && IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
IBuildCraftTransport bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
myIcon = bc.getFacadeTexture();
myIcon = bc.getCobbleStructurePipeTexture();
}
if( myIcon == null )
@ -217,14 +218,8 @@ public class FacadePart implements IFacadePart, IBoxProvider
else
{*/
IAESprite[] icon_down = renderer.getIcon( blk.getDefaultState() );
instance.setTexture(
icon_down[EnumFacing.DOWN.ordinal()],
icon_down[EnumFacing.UP.ordinal()],
icon_down[EnumFacing.NORTH.ordinal()],
icon_down[EnumFacing.SOUTH.ordinal()],
icon_down[EnumFacing.WEST.ordinal()],
icon_down[EnumFacing.EAST.ordinal()] );
instance.setTexture( icon_down[EnumFacing.DOWN.ordinal()], icon_down[EnumFacing.UP.ordinal()], icon_down[EnumFacing.NORTH.ordinal()], icon_down[EnumFacing.SOUTH.ordinal()], icon_down[EnumFacing.WEST.ordinal()], icon_down[EnumFacing.EAST.ordinal()] );
//}
if( busBounds == null )
@ -348,7 +343,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
@Override
@SideOnly( Side.CLIENT )
public void renderInventory( IPartRenderHelper instance, RenderBlocks renderer )
public void renderInventory( IPartRenderHelper instance, IRenderHelper renderer )
{
if( this.facade != null )
{
@ -356,47 +351,42 @@ public class FacadePart implements IFacadePart, IBoxProvider
try
{
if( fi != null )
ItemStack randomItem = fi.getTextureItem( this.facade );
instance.setTexture( renderer.getIcon( facade ) );
instance.setBounds( 7, 7, 4, 9, 9, 14 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
if( randomItem != null )
{
ItemStack randomItem = fi.getTextureItem( this.facade );
instance.setTexture( this.facade.getIconIndex() );
instance.setBounds( 7, 7, 4, 9, 9, 14 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
if( randomItem != null )
if( randomItem.getItem() instanceof ItemBlock )
{
if( randomItem.getItem() instanceof ItemBlock )
ItemBlock ib = (ItemBlock) randomItem.getItem();
Block blk = Block.getBlockFromItem( ib );
try
{
ItemBlock ib = (ItemBlock) randomItem.getItem();
Block blk = Block.getBlockFromItem( ib );
try
{
int color = ib.getColorFromItemStack( randomItem, 0 );
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( color );
}
catch( Throwable error )
{
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0F );
instance.setInvColor( 0xffffff );
}
Tessellator.instance.setBrightness( 15 << 20 | 15 << 4 );
Tessellator.instance.setColorOpaque_F( 1, 1, 1 );
instance.setTexture( blk.getIcon( this.side.ordinal(), ib.getMetadata( randomItem.getItemDamage() ) ) );
instance.setBounds( 0, 0, 14, 16, 16, 16 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
int color = ib.getColorFromItemStack( randomItem, 0 );
instance.setInvColor( color );
}
catch( Throwable error )
{
instance.setInvColor( 0xffffff );
}
renderer.setBrightness( 15 << 20 | 15 << 4 );
renderer.setColorOpaque_F( 1, 1, 1 );
instance.setTexture( renderer.getIcon( blk.getDefaultState() )[side.ordinal()] );
instance.setBounds( 0, 0, 14, 16, 16, 16 );
instance.renderInventoryBox( renderer );
instance.setTexture( null );
}
}
}
catch( Exception ignored )
catch( Throwable ignored )
{
}
@ -404,7 +394,7 @@ public class FacadePart implements IFacadePart, IBoxProvider
}
@Override
public ForgeDirection getSide()
public AEPartLocation getSide()
{
return this.side;
}

View File

@ -24,15 +24,14 @@ import javax.annotation.Nullable;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
/**
* Contains wrench behaviour
*
* and registers the engines as P2P attunements for RF tunnels
* (since BC 7, they are part of BC Core)
* The attunement is currently not public anymore,
* because it was only used internally
* and registers the engines as P2P attunements for RF tunnels (since BC 7, they are part of BC Core) The attunement is currently not public anymore, because it
* was only used internally
*
* @author AlgorithmX2
* @version rv3
@ -50,26 +49,22 @@ public interface IBuildCraftCore
/**
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
* @param wrencher wrenching player, can be probably {@code null}, but not sure
* @param x x pos
* @param y y pos
* @param z z pos
* @param pos pos
*
* @return {@code true} if player can wrench with that {@code wrench}
*
* @throws NullPointerException if {@code wrench} is {@code null}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
*/
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
boolean canWrench( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
/**
* @param wrench to be checked item, must be an {@link buildcraft.api.tools.IToolWrench}
* @param wrencher wrenching player, can be probably {@code null}, but not sure
* @param x x pos
* @param y y pos
* @param z z pos
* @param pos pos
*
* @throws NullPointerException if {@code wrench} is {@code null}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
* @throws ClassCastException if {@code wrench} is not an {@link buildcraft.api.tools.IToolWrench}
*/
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, int x, int y, int z );
void wrenchUsed( @Nonnull Item wrench, EntityPlayer wrencher, BlockPos pos );
}

View File

@ -22,13 +22,14 @@ package appeng.integration.abstraction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import appeng.api.parts.IFacadePart;
import appeng.api.util.AEPartLocation;
import appeng.client.texture.IAESprite;
/**
@ -61,7 +62,7 @@ public interface IBuildCraftTransport
* @return ae facade through bc facade system
*/
@Nullable
IFacadePart createFacadePart( @Nullable Block blk, int meta, @Nonnull ForgeDirection side );
IFacadePart createFacadePart( @Nullable IBlockState blk, @Nonnull AEPartLocation side );
/**
* @param held create facade for that item
@ -71,7 +72,7 @@ public interface IBuildCraftTransport
*
* @throws IllegalArgumentException if {@code held} is {@code null}
*/
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull ForgeDirection side );
IFacadePart createFacadePart( @Nonnull ItemStack held, @Nonnull AEPartLocation side );
/**
* @param facade buildcraft facade
@ -85,9 +86,9 @@ public interface IBuildCraftTransport
/**
* @return texture of buildcraft cobblestone structure pipe or null if something bad happens
*/
// */
@Nullable
IIcon getCobbleStructurePipeTexture();
IAESprite getCobbleStructurePipeTexture();
/**
* @param te the to be checked {@link TileEntity}
@ -97,7 +98,7 @@ public interface IBuildCraftTransport
*
* @throws NullPointerException if {@code dir} is {@code null}
*/
boolean isPipe( @Nullable TileEntity te, @Nonnull ForgeDirection dir );
boolean isPipe( @Nullable TileEntity te, @Nonnull EnumFacing dir );
/**
* checks weather if the {@code te} is injectable and simulates to inject the item
@ -108,7 +109,7 @@ public interface IBuildCraftTransport
*
* @return {@code true} if items were simulated successfully being added
*/
boolean canAddItemsToPipe( TileEntity te, ItemStack is, ForgeDirection dir );
boolean canAddItemsToPipe( TileEntity te, ItemStack is, EnumFacing dir );
/**
* checks weather if the {@code te} is injectable, simulates the inject and tries to inject the item
@ -119,5 +120,5 @@ public interface IBuildCraftTransport
*
* @return {@code true} if items were added to the buildcraft pipe
*/
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull ForgeDirection dir );
boolean addItemsToPipe( @Nullable TileEntity te, @Nullable ItemStack is, @Nonnull EnumFacing dir );
}

View File

@ -136,7 +136,7 @@ public class PartP2PItems extends PartP2PTunnel<PartP2PItems> implements ISidedI
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
final IBuildCraftTransport buildcraft = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
if( buildcraft.isPipe( te, this.side.getOpposite() ) )
if( buildcraft.isPipe( te, this.side.getOpposite().getFacing() ) )
{
try
{

View File

@ -19,109 +19,94 @@
package appeng.util.inv;
import java.util.Iterator;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import appeng.api.config.FuzzyMode;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
import appeng.integration.abstraction.IBC;
import appeng.integration.abstraction.IBuildCraftTransport;
import appeng.util.InventoryAdaptor;
import appeng.util.iterators.NullIterator;
public class AdaptorBCPipe extends InventoryAdaptor
{
private final IBuildCraftTransport bc;
private final TileEntity i;
private final ForgeDirection d;
public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
{
if( this.bc.isPipe( s, dd ) )
{
this.i = s;
this.d = dd;
return;
}
}
this.i = null;
this.d = null;
}
@Override
public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
{
return null;
}
@Override
public ItemStack addItems( ItemStack toBeAdded )
{
if( this.i == null )
{
return toBeAdded;
}
if( toBeAdded == null )
{
return null;
}
if( toBeAdded.stackSize == 0 )
{
return null;
}
if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
{
return null;
}
return toBeAdded;
}
@Override
public ItemStack simulateAdd( ItemStack toBeSimulated )
{
if( this.i == null )
{
return toBeSimulated;
}
return null;
}
@Override
public boolean containsItems()
{
return false;
}
@Override
public Iterator<ItemSlot> iterator()
{
return new NullIterator<ItemSlot>();
}
}
//public class AdaptorBCPipe extends InventoryAdaptor
//{
// private final IBuildCraftTransport bc;
// private final TileEntity i;
// private final ForgeDirection d;
//
// public AdaptorBCPipe( TileEntity s, ForgeDirection dd )
// {
// this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BC );
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) )
// {
// if( this.bc.isPipe( s, dd ) )
// {
// this.i = s;
// this.d = dd;
// return;
// }
// }
// this.i = null;
// this.d = null;
// }
//
// @Override
// public ItemStack removeItems( int amount, ItemStack filter, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack simulateRemove( int amount, ItemStack filter, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack removeSimilarItems( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack simulateSimilarRemove( int amount, ItemStack filter, FuzzyMode fuzzyMode, IInventoryDestination destination )
// {
// return null;
// }
//
// @Override
// public ItemStack addItems( ItemStack toBeAdded )
// {
// if( this.i == null )
// {
// return toBeAdded;
// }
// if( toBeAdded == null )
// {
// return null;
// }
// if( toBeAdded.stackSize == 0 )
// {
// return null;
// }
//
// if( IntegrationRegistry.INSTANCE.isEnabled( IntegrationType.BuildCraftTransport ) && this.bc.addItemsToPipe( this.i, toBeAdded, this.d ) )
// {
// return null;
// }
// return toBeAdded;
// }
//
// @Override
// public ItemStack simulateAdd( ItemStack toBeSimulated )
// {
// if( this.i == null )
// {
// return toBeSimulated;
// }
// return null;
// }
//
// @Override
// public boolean containsItems()
// {
// return false;
// }
//
// @Override
// public Iterator<ItemSlot> iterator()
// {
// return new NullIterator<ItemSlot>();
// }
//}

View File

@ -23,7 +23,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent;
import appeng.integration.IntegrationRegistry;
import appeng.integration.IntegrationType;
@ -34,9 +35,9 @@ public class WrapperBCPipe implements IInventory
{
private final IBuildCraftTransport bc;
private final TileEntity ad;
private final ForgeDirection dir;
private final EnumFacing dir;
public WrapperBCPipe( TileEntity te, ForgeDirection d )
public WrapperBCPipe( TileEntity te, EnumFacing d )
{
this.bc = (IBuildCraftTransport) IntegrationRegistry.INSTANCE.getInstance( IntegrationType.BuildCraftTransport );
this.ad = te;
@ -76,18 +77,6 @@ public class WrapperBCPipe implements IInventory
}
}
@Override
public String getInventoryName()
{
return "BC Pipe Wrapper";
}
@Override
public boolean hasCustomInventoryName()
{
return false;
}
@Override
public int getInventoryStackLimit()
{
@ -100,27 +89,69 @@ public class WrapperBCPipe implements IInventory
}
@Override
public void openInventory( EntityPlayer player )
{
}
@Override
public void closeInventory( EntityPlayer player )
{
}
@Override
public boolean isUseableByPlayer( EntityPlayer entityplayer )
{
return false;
}
@Override
public void openInventory()
{
}
@Override
public void closeInventory()
{
}
@Override
public boolean isItemValidForSlot( int i, ItemStack itemstack )
{
return this.bc.canAddItemsToPipe( this.ad, itemstack, this.dir );
}
@Override
public int getField( int id )
{
return 0;
}
@Override
public void setField( int id, int value )
{
}
@Override
public int getFieldCount()
{
return 0;
}
@Override
public void clear()
{
}
@Override
public String getName()
{
return null;
}
@Override
public boolean hasCustomName()
{
return false;
}
@Override
public IChatComponent getDisplayName()
{
return null;
}
}