Fixed a bug with shift clicking.
Added Quartz Knife Gui. You can now make name presses with the quartz knife. Added Inscriber Recipes. Fixed Bug with Spatial Dim Registrations.
This commit is contained in:
@@ -254,7 +254,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if ( !(cs.isPlayerSide()) && cs instanceof SlotFake )
|
||||
{
|
||||
if ( Platform.isSameItem( dest, tis ) )
|
||||
if ( Platform.isSameItemPrecise( dest, tis ) )
|
||||
return null;
|
||||
else if ( dest == null )
|
||||
{
|
||||
@@ -282,7 +282,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
ItemStack t = d.getStack();
|
||||
|
||||
if ( tis != null && Platform.isSameItem( tis, t ) ) // t.isItemEqual(tis))
|
||||
if ( tis != null && Platform.isSameItemPrecise( tis, t ) ) // t.isItemEqual(tis))
|
||||
{
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if ( maxSize > d.getSlotStackLimit() )
|
||||
@@ -328,7 +328,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
ItemStack t = d.getStack();
|
||||
|
||||
if ( tis != null && Platform.isSameItem( t, tis ) )
|
||||
if ( tis != null && Platform.isSameItemPrecise( t, tis ) )
|
||||
{
|
||||
int maxSize = t.getMaxStackSize();
|
||||
if ( d.getSlotStackLimit() < maxSize )
|
||||
@@ -536,7 +536,7 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
ais.setStackSize( myItem.getMaxStackSize() );
|
||||
|
||||
InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player.inventory, ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||
myItem.stackSize = (int) ais.getStackSize();
|
||||
myItem = adp.simulateAdd( myItem );
|
||||
|
||||
@@ -561,7 +561,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
if ( isg.stackSize >= isg.getMaxStackSize() )
|
||||
liftQty = 0;
|
||||
if ( !Platform.isSameItem( slotItem.getItemStack(), isg ) )
|
||||
if ( !Platform.isSameItemPrecise( slotItem.getItemStack(), isg ) )
|
||||
liftQty = 0;
|
||||
}
|
||||
|
||||
@@ -662,14 +662,15 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
if ( slotItem != null )
|
||||
{
|
||||
for (int slotNum = 0; slotNum < player.inventory.getSizeInventory(); slotNum++)
|
||||
int playerInv = 9 * 4;
|
||||
for (int slotNum = 0; slotNum < playerInv; slotNum++)
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ItemStack myItem = ais.getItemStack();
|
||||
|
||||
ais.setStackSize( myItem.getMaxStackSize() );
|
||||
|
||||
InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player.inventory, ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor adp = InventoryAdaptor.getAdaptor( player, ForgeDirection.UNKNOWN );
|
||||
myItem.stackSize = (int) ais.getStackSize();
|
||||
myItem = adp.simulateAdd( myItem );
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
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.nbt.NBTTagCompound;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.QuartzKnifeOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.IAEAppEngInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngInventory, IInventory
|
||||
{
|
||||
|
||||
QuartzKnifeObj toolInv;
|
||||
|
||||
AppEngInternalInventory inSlot = new AppEngInternalInventory( this, 1 );
|
||||
SlotRestrictedInput metals;
|
||||
QuartzKnifeOutput output;
|
||||
String myName = "";
|
||||
|
||||
public void setName(String value)
|
||||
{
|
||||
myName = value;
|
||||
}
|
||||
|
||||
public ContainerQuartzKnife(InventoryPlayer ip, QuartzKnifeObj te) {
|
||||
super( ip, null, null );
|
||||
toolInv = te;
|
||||
|
||||
addSlotToContainer( metals = new SlotRestrictedInput( PlaceableItemType.METAL_INGOTS, inSlot, 0, 94, 44 ) );
|
||||
addSlotToContainer( output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ) );
|
||||
|
||||
lockPlayerInventorySlot( ip.currentItem );
|
||||
|
||||
bindPlayerInventory( ip, 0, 184 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( currentItem != toolInv.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( toolInv.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, toolInv.getItemStack() );
|
||||
else
|
||||
isContainerValid = false;
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
if ( inSlot.getStackInSlot( 0 ) != null )
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice( inSlot.getStackInSlot( 0 ), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int var1)
|
||||
{
|
||||
ItemStack input = inSlot.getStackInSlot( 0 );
|
||||
if ( input == null )
|
||||
return null;
|
||||
|
||||
if ( SlotRestrictedInput.isMetalIngot( input ) )
|
||||
{
|
||||
if ( myName.length() > 0 )
|
||||
{
|
||||
ItemStack name = AEApi.instance().materials().materialNamePress.stack( 1 );
|
||||
NBTTagCompound c = Platform.openNbtData( name );
|
||||
c.setString( "InscribeName", myName );
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int var1, int var2)
|
||||
{
|
||||
ItemStack is = getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
if ( makePlate() )
|
||||
return is;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean makePlate()
|
||||
{
|
||||
if ( inSlot.decrStackSize( 0, 1 ) != null )
|
||||
{
|
||||
ItemStack item = toolInv.getItemStack();
|
||||
item.damageItem( 1, getPlayerInv().player );
|
||||
|
||||
if ( item.stackSize == 0 )
|
||||
{
|
||||
getPlayerInv().mainInventory[getPlayerInv().currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int var1)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int var1, ItemStack var2)
|
||||
{
|
||||
if ( var2 == null )
|
||||
makePlate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName()
|
||||
{
|
||||
return "Quartz Knife Output";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer var1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int var1, ItemStack var2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public class QuartzKnifeOutput extends SlotOutput
|
||||
{
|
||||
|
||||
public QuartzKnifeOutput(IInventory a, int b, int c, int d, int i) {
|
||||
super( a, b, c, d, i );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
package appeng.container.slot;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityFurnace;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.IAppEngApi;
|
||||
import appeng.api.crafting.ICraftingPatternMAC;
|
||||
@@ -15,6 +17,7 @@ import appeng.api.implementations.items.ISpatialStorageCell;
|
||||
import appeng.api.implementations.items.IStorageComponent;
|
||||
import appeng.api.implementations.items.IUpgradeModule;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.recipes.handlers.Inscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class SlotRestrictedInput extends AppEngSlot
|
||||
@@ -22,10 +25,17 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
public enum PlaceableItemType
|
||||
{
|
||||
STORAGE_CELLS(15), ORE(1 * 16 + 15), STORAGE_COMPONENT(3 * 16 + 15), WIRELESS_TERMINAL(4 * 16 + 15), TRASH(5 * 16 + 15), VALID_ENCODED_PATTERN_W_OUPUT(
|
||||
7 * 16 + 15), ENCODED_PATTERN_W_OUTPUT(7 * 16 + 15), ENCODED_PATTERN(7 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15), RANGE_BOOSTER(
|
||||
6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15), WORKBENCH_CELL(15), BIOMETRIC_CARD(
|
||||
14 * 16 + 15), VIEWCELL(4 * 16 + 14);
|
||||
STORAGE_CELLS(15), ORE(1 * 16 + 15), STORAGE_COMPONENT(3 * 16 + 15),
|
||||
|
||||
WIRELESS_TERMINAL(4 * 16 + 15), TRASH(5 * 16 + 15), VALID_ENCODED_PATTERN_W_OUPUT(7 * 16 + 15), ENCODED_PATTERN_W_OUTPUT(7 * 16 + 15),
|
||||
|
||||
ENCODED_PATTERN(7 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15),
|
||||
|
||||
RANGE_BOOSTER(6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15),
|
||||
|
||||
FUEL(12 * 16 + 15), UPGRADES(13 * 16 + 15), WORKBENCH_CELL(15), BIOMETRIC_CARD(14 * 16 + 15), VIEWCELL(4 * 16 + 14),
|
||||
|
||||
INSCRIBER_PLATE(2 * 16 + 14), INSCRIBER_INPUT(3 * 16 + 14), METAL_INGOTS(3 * 16 + 14);
|
||||
|
||||
public final int IIcon;
|
||||
|
||||
@@ -127,6 +137,27 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
case INSCRIBER_PLATE:
|
||||
|
||||
for (ItemStack is : Inscriber.plates)
|
||||
if ( Platform.isSameItemPrecise( is, i ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
case INSCRIBER_INPUT:
|
||||
|
||||
for (ItemStack is : Inscriber.inputs)
|
||||
if ( Platform.isSameItemPrecise( is, i ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
case METAL_INGOTS:
|
||||
|
||||
return isMetalIngot( i );
|
||||
|
||||
case VIEWCELL:
|
||||
return AEApi.instance().items().itemViewCell.sameAs( i );
|
||||
case ORE:
|
||||
@@ -166,4 +197,21 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static public boolean isMetalIngot(ItemStack i)
|
||||
{
|
||||
if ( Platform.isSameItemPrecise( i, new ItemStack( Items.iron_ingot ) ) )
|
||||
return true;
|
||||
|
||||
for (String name : new String[] { "Copper", "Tin", "Obsidian", "Iron", "Lead", "Bronze", "Brass", "Nickel", "Aluminium" })
|
||||
{
|
||||
for (ItemStack ingot : OreDictionary.getOres( "ingot" + name ))
|
||||
{
|
||||
if ( Platform.isSameItemPrecise( i, ingot ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user