Compare commits
6 Commits
rv2.beta.4
...
rv2.beta.7
| Author | SHA1 | Date | |
|---|---|---|---|
| 15ba197083 | |||
| ff903e65a5 | |||
| 305fc6c7f2 | |||
| ada69b9a95 | |||
| 97dabc4a5c | |||
| fec00fee17 |
@@ -55,7 +55,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
for (int x = 0; x < this.facades; x++)
|
for (int x = 0; x < this.facades; x++)
|
||||||
{
|
{
|
||||||
if ( this.getFacade( ForgeDirection.getOrientation( x ) ) != null )
|
if ( this.getFacade( ForgeDirection.getOrientation( x ) ) != null )
|
||||||
facadeSides = facadeSides | (1 << x);
|
facadeSides |= ( 1 << x );
|
||||||
}
|
}
|
||||||
out.writeByte( (byte) facadeSides );
|
out.writeByte( (byte) facadeSides );
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
|
|
||||||
boolean changed = false;
|
boolean changed = false;
|
||||||
|
|
||||||
int ids[] = new int[2];
|
int[] ids = new int[2];
|
||||||
for (int x = 0; x < this.facades; x++)
|
for (int x = 0; x < this.facades; x++)
|
||||||
{
|
{
|
||||||
ForgeDirection side = ForgeDirection.getOrientation( x );
|
ForgeDirection side = ForgeDirection.getOrientation( x );
|
||||||
@@ -205,7 +205,7 @@ public class FacadeContainer implements IFacadeContainer
|
|||||||
@Override
|
@Override
|
||||||
public void rotateLeft()
|
public void rotateLeft()
|
||||||
{
|
{
|
||||||
IFacadePart newFacades[] = new FacadePart[6];
|
IFacadePart[] newFacades = new FacadePart[6];
|
||||||
|
|
||||||
newFacades[ForgeDirection.UP.ordinal()] = this.storage.getFacade( ForgeDirection.UP.ordinal() );
|
newFacades[ForgeDirection.UP.ordinal()] = this.storage.getFacade( ForgeDirection.UP.ordinal() );
|
||||||
newFacades[ForgeDirection.DOWN.ordinal()] = this.storage.getFacade( ForgeDirection.DOWN.ordinal() );
|
newFacades[ForgeDirection.DOWN.ordinal()] = this.storage.getFacade( ForgeDirection.DOWN.ordinal() );
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.integration.modules;
|
package appeng.integration.modules;
|
||||||
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
@@ -32,18 +33,20 @@ import mods.immibis.core.api.multipart.IPartContainer;
|
|||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
|
import appeng.api.parts.IPartItem;
|
||||||
import appeng.core.AELog;
|
import appeng.core.AELog;
|
||||||
import appeng.integration.BaseModule;
|
import appeng.integration.BaseModule;
|
||||||
import appeng.integration.abstraction.IImmibisMicroblocks;
|
import appeng.integration.abstraction.IImmibisMicroblocks;
|
||||||
|
|
||||||
|
|
||||||
public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblocks
|
public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblocks
|
||||||
{
|
{
|
||||||
|
|
||||||
public static ImmibisMicroblocks instance;
|
public static ImmibisMicroblocks INSTANCE;
|
||||||
|
|
||||||
boolean canConvertTiles = false;
|
private boolean canConvertTiles = false;
|
||||||
|
|
||||||
private Class MicroblockAPIUtils;
|
private Class<?> MicroblockAPIUtils;
|
||||||
private Method mergeIntoMicroblockContainer;
|
private Method mergeIntoMicroblockContainer;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -60,7 +63,7 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
|||||||
int.class, int.class, int.class, int.class, Block.class, int.class );
|
int.class, int.class, int.class, int.class, Block.class, int.class );
|
||||||
this.canConvertTiles = true;
|
this.canConvertTiles = true;
|
||||||
}
|
}
|
||||||
catch (Throwable t)
|
catch ( Throwable t )
|
||||||
{
|
{
|
||||||
AELog.error( t );
|
AELog.error( t );
|
||||||
}
|
}
|
||||||
@@ -73,13 +76,15 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean leaveParts(TileEntity te)
|
public boolean leaveParts( TileEntity te )
|
||||||
{
|
{
|
||||||
if ( te instanceof IMultipartTile )
|
if ( te instanceof IMultipartTile )
|
||||||
{
|
{
|
||||||
ICoverSystem ci = ((IMultipartTile) te).getCoverSystem();
|
ICoverSystem ci = ( ( IMultipartTile ) te ).getCoverSystem();
|
||||||
if ( ci != null )
|
if ( ci != null )
|
||||||
|
{
|
||||||
ci.convertToContainerBlock();
|
ci.convertToContainerBlock();
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -87,17 +92,18 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPartHost getOrCreateHost(EntityPlayer player, int side, TileEntity te)
|
public IPartHost getOrCreateHost( EntityPlayer player, int side, TileEntity te )
|
||||||
{
|
{
|
||||||
if ( te instanceof IMultipartTile && this.canConvertTiles )
|
final World w = te.getWorldObj();
|
||||||
{
|
final int x = te.xCoord;
|
||||||
Block blk = AEApi.instance().blocks().blockMultiPart.block();
|
final int y = te.yCoord;
|
||||||
ItemStack what = AEApi.instance().blocks().blockMultiPart.stack( 1 );
|
final int z = te.zCoord;
|
||||||
|
final boolean isPartItem = player != null && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IPartItem;
|
||||||
|
|
||||||
World w = te.getWorldObj();
|
if ( te instanceof IMultipartTile && this.canConvertTiles && isPartItem )
|
||||||
int x = te.xCoord;
|
{
|
||||||
int y = te.yCoord;
|
final Block blk = AEApi.instance().blocks().blockMultiPart.block();
|
||||||
int z = te.zCoord;
|
final ItemStack what = AEApi.instance().blocks().blockMultiPart.stack( 1 );
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -105,17 +111,17 @@ public class ImmibisMicroblocks extends BaseModule implements IImmibisMicroblock
|
|||||||
// int.class, int.class, int.class, int.class, Block.class, int.class );
|
// int.class, int.class, int.class, int.class, Block.class, int.class );
|
||||||
this.mergeIntoMicroblockContainer.invoke( null, what, player, w, x, y, z, side, blk, 0 );
|
this.mergeIntoMicroblockContainer.invoke( null, what, player, w, x, y, z, side, blk, 0 );
|
||||||
}
|
}
|
||||||
catch (Throwable e)
|
catch ( Throwable e )
|
||||||
{
|
{
|
||||||
this.canConvertTiles = false;
|
this.canConvertTiles = false;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
TileEntity tx = w.getTileEntity( x, y, z );
|
|
||||||
if ( tx instanceof IPartHost )
|
|
||||||
return (IPartHost) tx;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final TileEntity tx = w.getTileEntity( x, y, z );
|
||||||
|
if ( tx instanceof IPartHost )
|
||||||
|
return ( IPartHost ) tx;
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
|||||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.definitions.Items;
|
||||||
import appeng.api.parts.IFacadePart;
|
import appeng.api.parts.IFacadePart;
|
||||||
import appeng.api.parts.IPartHost;
|
import appeng.api.parts.IPartHost;
|
||||||
import appeng.api.parts.IPartItem;
|
import appeng.api.parts.IPartItem;
|
||||||
@@ -92,11 +93,16 @@ public class PartPlacement
|
|||||||
if ( te instanceof IPartHost && this.wasCanceled )
|
if ( te instanceof IPartHost && this.wasCanceled )
|
||||||
event.setCanceled( true );
|
event.setCanceled( true );
|
||||||
}
|
}
|
||||||
else if ( event.entityPlayer != null )
|
else
|
||||||
{
|
{
|
||||||
ItemStack held = event.entityPlayer.getHeldItem();
|
ItemStack held = event.entityPlayer.getHeldItem();
|
||||||
boolean supportedItem = AEApi.instance().items().itemMemoryCard.sameAsStack( held )
|
final Items items = AEApi.instance().items();
|
||||||
|| AEApi.instance().items().itemColorApplicator.sameAsStack( held );
|
|
||||||
|
final boolean sameAsMemoryCard = items.itemMemoryCard != null && items.itemMemoryCard.sameAsStack( held );
|
||||||
|
final boolean sameAsColorApp = items.itemColorApplicator != null && items.itemColorApplicator.sameAsStack( held );
|
||||||
|
|
||||||
|
final boolean supportedItem = sameAsMemoryCard || sameAsColorApp;
|
||||||
|
|
||||||
if ( event.entityPlayer.isSneaking() && held != null && supportedItem )
|
if ( event.entityPlayer.isSneaking() && held != null && supportedItem )
|
||||||
{
|
{
|
||||||
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
|
NetworkHandler.instance.sendToServer( new PacketClick( event.x, event.y, event.z, event.face, 0, 0, 0 ) );
|
||||||
|
|||||||
@@ -18,29 +18,52 @@
|
|||||||
|
|
||||||
package appeng.recipes.game;
|
package appeng.recipes.game;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.inventory.InventoryCrafting;
|
import net.minecraft.inventory.InventoryCrafting;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.item.crafting.IRecipe;
|
import net.minecraft.item.crafting.IRecipe;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
|
import com.google.common.base.Optional;
|
||||||
|
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.util.AEItemDefinition;
|
import appeng.api.util.AEItemDefinition;
|
||||||
import appeng.items.parts.ItemFacade;
|
import appeng.items.parts.ItemFacade;
|
||||||
|
|
||||||
|
|
||||||
public class FacadeRecipe implements IRecipe
|
public class FacadeRecipe implements IRecipe
|
||||||
{
|
{
|
||||||
|
|
||||||
private final AEItemDefinition anchor = AEApi.instance().parts().partCableAnchor;
|
private final Optional<AEItemDefinition> maybeAnchor;
|
||||||
private final ItemFacade facade = (ItemFacade) AEApi.instance().items().itemFacade.item();
|
private final Optional<AEItemDefinition> maybeFacade;
|
||||||
|
|
||||||
private ItemStack getOutput(InventoryCrafting inv, boolean createFacade)
|
public FacadeRecipe()
|
||||||
{
|
{
|
||||||
if ( inv.getStackInSlot( 0 ) == null && inv.getStackInSlot( 2 ) == null && inv.getStackInSlot( 6 ) == null && inv.getStackInSlot( 8 ) == null )
|
this.maybeFacade = Optional.fromNullable( AEApi.instance().items().itemFacade );
|
||||||
|
this.maybeAnchor = Optional.fromNullable( AEApi.instance().parts().partCableAnchor );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches( InventoryCrafting inv, World w )
|
||||||
|
{
|
||||||
|
return this.getOutput( inv, false ) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ItemStack getOutput( IInventory inv, boolean createFacade )
|
||||||
|
{
|
||||||
|
if ( this.maybeAnchor.isPresent() && this.maybeFacade.isPresent() && inv.getStackInSlot( 0 ) == null && inv.getStackInSlot( 2 ) == null && inv.getStackInSlot( 6 ) == null && inv.getStackInSlot( 8 ) == null )
|
||||||
{
|
{
|
||||||
if ( this.anchor.sameAsStack( inv.getStackInSlot( 1 ) ) && this.anchor.sameAsStack( inv.getStackInSlot( 3 ) ) && this.anchor.sameAsStack( inv.getStackInSlot( 5 ) )
|
final AEItemDefinition anchorDefinition = this.maybeAnchor.get();
|
||||||
&& this.anchor.sameAsStack( inv.getStackInSlot( 7 ) ) )
|
final AEItemDefinition facadeDefinition = this.maybeFacade.get();
|
||||||
|
|
||||||
|
if ( anchorDefinition.sameAsStack( inv.getStackInSlot( 1 ) ) && anchorDefinition.sameAsStack( inv.getStackInSlot( 3 ) ) && anchorDefinition.sameAsStack( inv.getStackInSlot( 5 ) ) && anchorDefinition.sameAsStack( inv.getStackInSlot( 7 ) ) )
|
||||||
{
|
{
|
||||||
ItemStack facades = this.facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
|
final Item itemDefinition = facadeDefinition.item();
|
||||||
|
final ItemFacade facade = (ItemFacade) itemDefinition;
|
||||||
|
|
||||||
|
ItemStack facades = facade.createFacadeForItem( inv.getStackInSlot( 4 ), !createFacade );
|
||||||
if ( facades != null && createFacade )
|
if ( facades != null && createFacade )
|
||||||
facades.stackSize = 4;
|
facades.stackSize = 4;
|
||||||
return facades;
|
return facades;
|
||||||
@@ -50,13 +73,7 @@ public class FacadeRecipe implements IRecipe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matches(InventoryCrafting inv, World w)
|
public ItemStack getCraftingResult( InventoryCrafting inv )
|
||||||
{
|
|
||||||
return this.getOutput( inv, false ) != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ItemStack getCraftingResult(InventoryCrafting inv)
|
|
||||||
{
|
{
|
||||||
return this.getOutput( inv, true );
|
return this.getOutput( inv, true );
|
||||||
}
|
}
|
||||||
@@ -72,5 +89,4 @@ public class FacadeRecipe implements IRecipe
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user