From ca64bacd17ee847c1193f04803132e1007d2393d Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Mon, 24 Feb 2014 21:55:09 -0600 Subject: [PATCH] Moved Facade Registration to Init. Removed Urainum Drop Ammo. Storage Cells can now be dismantled and re-assembled. Removed IC2 P2P Logging. --- integration/modules/BC.java | 13 ++++----- integration/modules/IC2.java | 3 +- items/materials/MaterialType.java | 6 ++++ items/storage/ItemBasicStorageCell.java | 37 +++++++++++++++++++++++++ parts/p2p/PartP2PIC2Power.java | 4 --- 5 files changed, 51 insertions(+), 12 deletions(-) diff --git a/integration/modules/BC.java b/integration/modules/BC.java index b5b79dbea..5afc2e47d 100644 --- a/integration/modules/BC.java +++ b/integration/modules/BC.java @@ -180,6 +180,12 @@ public class BC extends BaseModule implements IBC AEApi.instance().partHelper().registerNewLayer( "appeng.api.parts.layers.LayerIPipeConnection", "buildcraft.api.transport.IPipeConnection" ); AEApi.instance().registries().externalStorage().addExternalStorageInterface( new BCPipeHandler() ); + + Blocks b = AEApi.instance().blocks(); + addFacade( b.blockFluix.stack( 1 ) ); + addFacade( b.blockQuartz.stack( 1 ) ); + addFacade( b.blockQuartzChiseled.stack( 1 ) ); + addFacade( b.blockQuartzPiller.stack( 1 ) ); } @Override @@ -187,13 +193,6 @@ public class BC extends BaseModule implements IBC { registerPowerP2P(); registerItemP2P(); - - Blocks b = AEApi.instance().blocks(); - addFacade( b.blockFluix.stack( 1 ) ); - addFacade( b.blockQuartz.stack( 1 ) ); - addFacade( b.blockQuartzChiseled.stack( 1 ) ); - addFacade( b.blockQuartzPiller.stack( 1 ) ); - registerLiquidsP2P(); } diff --git a/integration/modules/IC2.java b/integration/modules/IC2.java index 0c51398d3..ed9637e6e 100644 --- a/integration/modules/IC2.java +++ b/integration/modules/IC2.java @@ -38,7 +38,8 @@ public class IC2 implements IIntegrationModule, IIC2 reg.addNewAttunement( getItem( "detectorCableItem" ), TunnelType.IC2_POWER ); reg.addNewAttunement( getItem( "splitterCableItem" ), TunnelType.IC2_POWER ); - AEApi.instance().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 ); + // this is gone? + // AEApi.instance().registries().matterCannon().registerAmmo( getItem( "uraniumDrop" ), 238.0289 ); } @Override diff --git a/items/materials/MaterialType.java b/items/materials/MaterialType.java index 2a0f803c7..72886eee7 100644 --- a/items/materials/MaterialType.java +++ b/items/materials/MaterialType.java @@ -3,6 +3,7 @@ package appeng.items.materials; import java.util.EnumSet; import net.minecraft.entity.Entity; +import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import net.minecraftforge.oredict.OreDictionary; import appeng.core.AppEng; @@ -92,6 +93,11 @@ public enum MaterialType features.add( AEFeature.DuplicateItems ); } + public ItemStack stack(int size) + { + return new ItemStack( ItemMaterial.instance, size, damageValue ); + } + public EnumSet getFeature() { return features; diff --git a/items/storage/ItemBasicStorageCell.java b/items/storage/ItemBasicStorageCell.java index 2643610b7..afca46edd 100644 --- a/items/storage/ItemBasicStorageCell.java +++ b/items/storage/ItemBasicStorageCell.java @@ -4,8 +4,11 @@ import java.util.EnumSet; import java.util.List; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import appeng.api.AEApi; import appeng.api.config.FuzzyMode; import appeng.api.implementations.items.IItemGroup; @@ -13,6 +16,7 @@ import appeng.api.implementations.items.IStorageCell; import appeng.api.storage.IMEInventory; import appeng.api.storage.StorageChannel; import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; import appeng.core.features.AEFeature; import appeng.core.localization.GuiText; import appeng.items.AEBaseItem; @@ -21,6 +25,7 @@ import appeng.items.contents.CellUpgrades; import appeng.items.materials.MaterialType; import appeng.me.storage.CellInventory; import appeng.me.storage.CellInventoryHandler; +import appeng.util.InventoryAdaptor; import appeng.util.Platform; public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup @@ -166,4 +171,36 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II return true; } + @Override + public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) + { + if ( player.isSneaking() ) + { + if ( Platform.isClient() ) + return false; + + InventoryPlayer pinv = player.inventory; + IMEInventory inv = AEApi.instance().registries().cell().getCellInventory( stack, StorageChannel.ITEMS ); + if ( inv != null && pinv.getCurrentItem() == stack ) + { + InventoryAdaptor ia = InventoryAdaptor.getAdaptor( pinv, ForgeDirection.UNKNOWN ); + IItemList list = inv.getAvailableItems( StorageChannel.ITEMS.createList() ); + if ( list.isEmpty() && ia != null ) + { + pinv.setInventorySlotContents( pinv.currentItem, null ); + + ItemStack extraA = ia.addItems( AEApi.instance().materials().materialEmptyStorageCell.stack( 1 ) ); + ItemStack extraB = ia.addItems( component.stack( 1 ) ); + + if ( extraA != null ) + player.dropPlayerItemWithRandomChoice( extraA, false ); + if ( extraB != null ) + player.dropPlayerItemWithRandomChoice( extraB, false ); + + return true; + } + } + } + return false; + } } diff --git a/parts/p2p/PartP2PIC2Power.java b/parts/p2p/PartP2PIC2Power.java index 568731751..da860f944 100644 --- a/parts/p2p/PartP2PIC2Power.java +++ b/parts/p2p/PartP2PIC2Power.java @@ -9,7 +9,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; import appeng.api.config.TunnelType; -import appeng.core.AELog; import appeng.me.GridAccessException; import appeng.me.cache.helpers.TunnelCollection; import appeng.util.Platform; @@ -108,7 +107,6 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i @Override public double injectEnergyUnits(ForgeDirection directionFrom, double amount) { - AELog.info( "INJECT: " + amount ); TunnelCollection outs; try { @@ -148,7 +146,6 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i @Override public double getOfferedEnergy() { - AELog.info( "getOfferedEnergy: " + OutputPacket ); if ( output ) return OutputPacket; return 0; @@ -157,7 +154,6 @@ public class PartP2PIC2Power extends PartP2PTunnel implements i @Override public void drawEnergy(double amount) { - AELog.info( "drawEnergy: " + amount ); OutputPacket -= amount; }