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:
@@ -0,0 +1,75 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerQuartzKnife;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
|
||||
public class GuiQuartzKnife extends AEBaseGui
|
||||
{
|
||||
|
||||
GuiTextField name;
|
||||
|
||||
public GuiQuartzKnife(InventoryPlayer inventoryPlayer, QuartzKnifeObj te) {
|
||||
super( new ContainerQuartzKnife( inventoryPlayer, te ) );
|
||||
this.ySize = 184;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui()
|
||||
{
|
||||
super.initGui();
|
||||
|
||||
name = new GuiTextField( fontRendererObj, this.guiLeft + 24, this.guiTop + 32, 79, fontRendererObj.FONT_HEIGHT );
|
||||
name.setEnableBackgroundDrawing( false );
|
||||
name.setMaxStringLength( 32 );
|
||||
name.setTextColor( 0xFFFFFF );
|
||||
name.setVisible( true );
|
||||
name.setFocused( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
bindTexture( "guis/quartzknife.png" );
|
||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, ySize );
|
||||
name.drawTextBox();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void keyTyped(char character, int key)
|
||||
{
|
||||
if ( name.textboxKeyTyped( character, key ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
String Out = name.getText();
|
||||
((ContainerQuartzKnife) inventorySlots).setName( Out );
|
||||
NetworkHandler.instance.sendToServer( new PacketValueConfig( "QuartzKnife.Name", Out ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.keyTyped( character, key );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||
{
|
||||
fontRendererObj.drawString( GuiText.QuartzCuttingKnife.getLocal(), 8, 6, 4210752 );
|
||||
fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, ySize - 96 + 3, 4210752 );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ import appeng.recipes.RecipeHandler;
|
||||
import appeng.recipes.game.ShapedRecipe;
|
||||
import appeng.recipes.game.ShapelessRecipe;
|
||||
import appeng.recipes.handlers.Grind;
|
||||
import appeng.recipes.handlers.Inscriber;
|
||||
import appeng.recipes.handlers.Macerator;
|
||||
import appeng.recipes.handlers.Pulverizer;
|
||||
import appeng.recipes.handlers.Shaped;
|
||||
@@ -176,6 +177,7 @@ public class Registration
|
||||
recipeRegistery.addNewCraftHandler( "macerator", Macerator.class );
|
||||
|
||||
recipeRegistery.addNewCraftHandler( "smelt", Smelt.class );
|
||||
recipeRegistery.addNewCraftHandler( "inscriber", Inscriber.class );
|
||||
|
||||
recipeRegistery.addNewCraftHandler( "shaped", Shaped.class );
|
||||
recipeRegistery.addNewCraftHandler( "shapeless", Shapeless.class );
|
||||
|
||||
+19
-7
@@ -39,6 +39,12 @@ public class WorldSettings extends Configuration
|
||||
compass = new CompassService( AEFolder );
|
||||
(new Thread( compass, "AE Compass Service" )).start();
|
||||
|
||||
for (int dimID : get( "DimensionManager", "StorageCells", new int[0] ).getIntList())
|
||||
{
|
||||
storageCellDims.add( dimID );
|
||||
DimensionManager.registerDimension( dimID, AEConfig.instance.storageProviderID );
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
lastGridStorage = Long.parseLong( get( "Counters", "lastGridStorage", 0 ).getString() );
|
||||
@@ -51,6 +57,19 @@ public class WorldSettings extends Configuration
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
save();
|
||||
|
||||
for (Integer dimID : storageCellDims)
|
||||
DimensionManager.unregisterDimension( dimID );
|
||||
|
||||
storageCellDims.clear();
|
||||
|
||||
compass.kill();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
List<Integer> storageCellDims = new ArrayList();
|
||||
|
||||
public void addStorageCellDim(int newDim)
|
||||
@@ -118,13 +137,6 @@ public class WorldSettings extends Configuration
|
||||
save();
|
||||
}
|
||||
|
||||
public void shutdown()
|
||||
{
|
||||
save();
|
||||
compass.kill();
|
||||
instance = null;
|
||||
}
|
||||
|
||||
private WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap();
|
||||
|
||||
public WorldCoord getStoredSize(int dim)
|
||||
|
||||
@@ -44,6 +44,7 @@ import appeng.container.implementations.ContainerNetworkStatus;
|
||||
import appeng.container.implementations.ContainerNetworkTool;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.container.implementations.ContainerQNB;
|
||||
import appeng.container.implementations.ContainerQuartzKnife;
|
||||
import appeng.container.implementations.ContainerSecurity;
|
||||
import appeng.container.implementations.ContainerSkyChest;
|
||||
import appeng.container.implementations.ContainerSpatialIOPort;
|
||||
@@ -55,6 +56,7 @@ import appeng.container.implementations.ContainerWirelessTerm;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.helpers.IPriorityHost;
|
||||
import appeng.helpers.WirelessTerminalGuiObject;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.parts.automation.PartFormationPlane;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
@@ -100,6 +102,8 @@ public enum GuiBridge implements IGuiHandler
|
||||
|
||||
GUI_NETWORK_TOOL(ContainerNetworkTool.class, INetworkTool.class, true, null),
|
||||
|
||||
GUI_QUARTZ_KNIFE(ContainerQuartzKnife.class, QuartzKnifeObj.class, true, null),
|
||||
|
||||
GUI_DRIVE(ContainerDrive.class, TileDrive.class, false, SecurityPermissions.BUILD),
|
||||
|
||||
GUI_VIBRATIONCHAMBER(ContainerVibrationChamber.class, TileVibrationChamber.class, false, null),
|
||||
|
||||
@@ -17,6 +17,7 @@ import appeng.api.util.IConfigureableObject;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerLevelEmitter;
|
||||
import appeng.container.implementations.ContainerPriority;
|
||||
import appeng.container.implementations.ContainerQuartzKnife;
|
||||
import appeng.container.implementations.ContainerSecurity;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
@@ -40,7 +41,13 @@ public class PacketValueConfig extends AppEngPacket
|
||||
{
|
||||
Container c = player.openContainer;
|
||||
|
||||
if ( Name.equals( "TileSecurity.ToggleOption" ) && c instanceof ContainerSecurity )
|
||||
if ( Name.equals( "QuartzKnife.Name" ) && c instanceof ContainerQuartzKnife )
|
||||
{
|
||||
ContainerQuartzKnife qk = (ContainerQuartzKnife) c;
|
||||
qk.setName( Value );
|
||||
return;
|
||||
}
|
||||
else if ( Name.equals( "TileSecurity.ToggleOption" ) && c instanceof ContainerSecurity )
|
||||
{
|
||||
ContainerSecurity sc = (ContainerSecurity) c;
|
||||
sc.toggleSetting( Value, player );
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package appeng.items.contents;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
|
||||
public class QuartzKnifeObj implements IGuiItemObject
|
||||
{
|
||||
|
||||
final ItemStack is;
|
||||
|
||||
public QuartzKnifeObj(ItemStack o) {
|
||||
is = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack()
|
||||
{
|
||||
return is;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
@@ -77,15 +78,21 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
|
||||
public void addInformation(ItemStack is, EntityPlayer player, List details, boolean moar)
|
||||
{
|
||||
super.addInformation( par1ItemStack, par2EntityPlayer, par3List, par4 );
|
||||
super.addInformation( is, player, details, moar );
|
||||
|
||||
MaterialType mt = getTypeByStack( par1ItemStack );
|
||||
MaterialType mt = getTypeByStack( is );
|
||||
if ( mt == null )
|
||||
return;
|
||||
|
||||
Upgrades u = getType( par1ItemStack );
|
||||
if ( mt == MaterialType.NamePress )
|
||||
{
|
||||
NBTTagCompound c = Platform.openNbtData( is );
|
||||
details.add( c.getString( "InscribeName" ) );
|
||||
}
|
||||
|
||||
Upgrades u = getType( is );
|
||||
if ( u != null )
|
||||
{
|
||||
List<String> textList = new LinkedList();
|
||||
@@ -113,7 +120,7 @@ public class ItemMaterial extends AEBaseItem implements IStorageComponent, IUpgr
|
||||
Pattern p = Pattern.compile( "(\\d+)[^\\d]" );
|
||||
SlightlyBetterSort s = new SlightlyBetterSort( p );
|
||||
Collections.sort( textList, s );
|
||||
par3List.addAll( textList );
|
||||
details.addAll( textList );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,11 +2,19 @@ package appeng.items.tools.quartz;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.QuartzKnifeObj;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolQuartzCuttingKnife extends AEBaseItem
|
||||
public class ToolQuartzCuttingKnife extends AEBaseItem implements IGuiItem
|
||||
{
|
||||
|
||||
public ToolQuartzCuttingKnife(AEFeature type) {
|
||||
@@ -34,6 +42,23 @@ public class ToolQuartzCuttingKnife extends AEBaseItem
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack it, World w, EntityPlayer p)
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
p.swingItem();
|
||||
return it;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int s, float hitx, float hity, float hitz)
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
Platform.openGUI( p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_QUARTZ_KNIFE );
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getContainerItem(ItemStack itemStack)
|
||||
{
|
||||
@@ -41,4 +66,10 @@ public class ToolQuartzCuttingKnife extends AEBaseItem
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(ItemStack is, World world, int x, int y, int z)
|
||||
{
|
||||
return new QuartzKnifeObj( is );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
package appeng.recipes.handlers;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.exceptions.MissingIngredientError;
|
||||
import appeng.api.exceptions.RecipeError;
|
||||
import appeng.api.exceptions.RegistrationError;
|
||||
import appeng.api.recipes.ICraftHandler;
|
||||
import appeng.api.recipes.IIngredient;
|
||||
import appeng.recipes.RecipeHandler;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class Inscriber implements ICraftHandler, IWebsiteSeralizer
|
||||
{
|
||||
|
||||
public static HashSet<ItemStack> plates = new HashSet();
|
||||
public static HashSet<ItemStack> inputs = new HashSet();
|
||||
|
||||
IIngredient imprintable;
|
||||
|
||||
IIngredient plateA;
|
||||
IIngredient plateB;
|
||||
|
||||
IIngredient output;
|
||||
|
||||
@Override
|
||||
public void setup(List<List<IIngredient>> input, List<List<IIngredient>> output) throws RecipeError
|
||||
{
|
||||
if ( output.size() == 1 && output.get( 0 ).size() == 1 )
|
||||
{
|
||||
if ( input.size() == 1 && input.get( 0 ).size() > 1 )
|
||||
{
|
||||
imprintable = input.get( 0 ).get( 0 );
|
||||
|
||||
plateA = input.get( 0 ).get( 1 );
|
||||
|
||||
if ( input.get( 0 ).size() > 2 )
|
||||
plateB = input.get( 0 ).get( 2 );
|
||||
|
||||
this.output = output.get( 0 ).get( 0 );
|
||||
}
|
||||
else
|
||||
throw new RecipeError( "Inscriber recipes cannot have rows, and must have more then one input." );
|
||||
}
|
||||
else
|
||||
throw new RecipeError( "Inscriber recipes must produce a single output." );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
if ( imprintable != null )
|
||||
for (ItemStack s : imprintable.getItemStackSet())
|
||||
inputs.add( s );
|
||||
|
||||
if ( plateA != null )
|
||||
for (ItemStack s : plateA.getItemStackSet())
|
||||
plates.add( s );
|
||||
|
||||
if ( plateB != null )
|
||||
for (ItemStack s : plateB.getItemStackSet())
|
||||
plates.add( s );
|
||||
|
||||
// TODO: REAL REGISTRATION
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canCraft(ItemStack reqOutput) throws RegistrationError, MissingIngredientError
|
||||
{
|
||||
return Platform.isSameItemPrecise( output.getItemStack(), reqOutput );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern(RecipeHandler h)
|
||||
{
|
||||
String o = "inscriber " + output.getQty() + "\n";
|
||||
|
||||
o += h.getName( output ) + "\n";
|
||||
|
||||
if ( plateB != null )
|
||||
o += h.getName( plateB ) + "\n";
|
||||
|
||||
o += h.getName( plateA );
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user