Tweaked Terminal Gui to use smaller textures.

Crafting Terminal Added, ( incomplete )
Moved FMP Cut-able Registration to Init.
Upgrades now drop when parts break.
TE -> TE3 pulverizer api.
This commit is contained in:
AlgorithmX2 2014-02-04 20:44:54 -06:00
parent 01684cf7c7
commit f8e6a426ce
12 changed files with 132 additions and 16 deletions

View file

@ -0,0 +1,28 @@
package appeng.client.gui.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.storage.IStorageMonitorable;
import appeng.container.implementations.ContainerCraftingTerm;
import appeng.core.localization.GuiText;
public class GuiCraftingTerm extends GuiMEMonitorable
{
public GuiCraftingTerm(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
super( inventoryPlayer, te, new ContainerCraftingTerm( inventoryPlayer, te ) );
reservedSpace = 73;
}
protected String getBackground()
{
return "guis/crafting.png";
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawFG( offsetX, offsetY, mouseX, mouseY );
fontRenderer.drawString( GuiText.CraftingTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
}
}

View file

@ -35,6 +35,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
int xoffset = 9;
int perRow = 9;
int reservedSpace = 0;
int lowerTextureOffset = 0;
int rows = 0;
int maxRows = Integer.MAX_VALUE;
@ -83,7 +84,8 @@ public class GuiMEMonitorable extends AEBaseMEGui
{
int NEI = 0;
int top = 4;
int extraSpace = height - 114 - NEI - top - reservedSpace;
int magicNumber = 114 + 1;
int extraSpace = height - magicNumber - NEI - top - reservedSpace;
rows = (int) Math.floor( extraSpace / 18 );
if ( rows > maxRows )
@ -106,7 +108,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
// extra slots : 72
// slot 18
this.ySize = 114 + rows * 18 + reservedSpace;
this.ySize = magicNumber + rows * 18 + reservedSpace;
this.guiTop = top;
buttonList.add( new GuiImgButton( this.guiLeft - 18, guiTop + 8, Settings.SORT_BY, Configuration.instance.settings.getSetting( Settings.SORT_BY ) ) );
@ -127,7 +129,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
if ( s instanceof AppEngSlot )
{
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 4;
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 5;
}
}
}
@ -176,7 +178,7 @@ public class GuiMEMonitorable extends AEBaseMEGui
for (int x = 0; x < rows; x++)
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18, 0, 106, x_width, 98 + reservedSpace );
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18 + lowerTextureOffset, 0, 106 - 18 - 18, x_width, 99 + reservedSpace - lowerTextureOffset );
searchField.drawTextBox();
}

View file

@ -16,7 +16,7 @@ public class GuiSecurity extends GuiMEMonitorable
public GuiSecurity(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
reservedSpace = 32;
reservedSpace = 33;
xSize += 50;
}
@ -27,7 +27,7 @@ public class GuiSecurity extends GuiMEMonitorable
{
super.initGui();
int top = this.guiTop + this.ySize - 114;
int top = this.guiTop + this.ySize - 116;
buttonList.add( inject = new GuiToggleButton( this.guiLeft + 56 + 18 * 0, top, 11 * 16 + 0, 12 * 16 + 0, SecurityPermissions.INJECT
.getUnlocalizedName(), SecurityPermissions.INJECT.getUnlocalizedTip() ) );
@ -92,7 +92,7 @@ public class GuiSecurity extends GuiMEMonitorable
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
{
super.drawFG( offsetX, offsetY, mouseX, mouseY );
fontRenderer.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 3 - reservedSpace, 4210752 );
fontRenderer.drawString( GuiText.SecurityCardEditor.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 );
}
}

View file

@ -0,0 +1,24 @@
package appeng.container.implementations;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.storage.IStorageMonitorable;
import appeng.container.slot.SlotNormal;
import appeng.container.slot.SlotOutput;
import appeng.parts.reporting.PartCraftingTerminal;
public class ContainerCraftingTerm extends ContainerMEMonitorable
{
PartCraftingTerminal ct;
SlotNormal craftingSlots[] = new SlotNormal[9];
SlotOutput outputSlot;
public ContainerCraftingTerm(InventoryPlayer ip, IStorageMonitorable montiorable) {
super( ip, montiorable, false );
ct = (PartCraftingTerminal) montiorable;
bindPlayerInventory( ip, 0, 0 );
}
}

View file

@ -37,7 +37,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
securityBox = (TileSecurity) montiorable;
addSlotToContainer( configSlot = new SlotRestrictedInput( PlaceableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -32 ) );
addSlotToContainer( configSlot = new SlotRestrictedInput( PlaceableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -33 ) );
addSlotToContainer( wirelessIn = new SlotRestrictedInput( PlaceableItemType.WIRELESS_TERMINAL, wirelessEncoder, 0, 212, 10 ) );
addSlotToContainer( wirelessOut = new SlotOutput( wirelessEncoder, 1, 212, 68, -1 ) );
@ -50,6 +50,8 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
@Override
public void onContainerClosed(EntityPlayer player)
{
super.onContainerClosed( player );
if ( wirelessIn.getHasStack() )
player.dropPlayerItem( wirelessIn.getStack() );

View file

@ -23,6 +23,8 @@ public enum GuiText
SecurityCardEditor, NoPermissions, WirelessTerminal, Wireless,
CraftingTerminal,
METunnel, ItemTunnel, RedstoneTunnel, MJTunnel, EUTunnel, FluidTunnel;
String root;

View file

@ -31,6 +31,7 @@ import appeng.container.ContainerOpenContext;
import appeng.container.implementations.ContainerCellWorkbench;
import appeng.container.implementations.ContainerChest;
import appeng.container.implementations.ContainerCondenser;
import appeng.container.implementations.ContainerCraftingTerm;
import appeng.container.implementations.ContainerDrive;
import appeng.container.implementations.ContainerGrinder;
import appeng.container.implementations.ContainerIOPort;
@ -53,6 +54,7 @@ import appeng.helpers.IPriorityHost;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.parts.automation.PartLevelEmitter;
import appeng.parts.misc.PartStorageBus;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.server.AccessType;
import appeng.tile.grindstone.TileGrinder;
import appeng.tile.misc.TileCellWorkbench;
@ -108,6 +110,8 @@ public enum GuiBridge implements IGuiHandler
GUI_SECURITY(ContainerSecurity.class, TileSecurity.class, false, SecurityPermissions.SECURITY),
GUI_CRAFTING_TERMINAL(ContainerCraftingTerm.class, PartCraftingTerminal.class, false, SecurityPermissions.CRAFT),
// extends (Container/Gui) + Bus
GUI_LEVELEMITTER(ContainerLevelEmitter.class, PartLevelEmitter.class, false, SecurityPermissions.BUILD),

View file

@ -65,16 +65,14 @@ public class FMP implements IIntegrationModule, IPartFactory, IPartConverter, IF
@Override
public void Init() throws Throwable
{
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartz.block() );
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartzPiller.block() );
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartzChiseled.block() );
}
@Override
public void PostInit() throws Throwable
{
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartz.block() );
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartzPiller.block() );
BlockMicroMaterial.createAndRegister( AEApi.instance().blocks().blockQuartzChiseled.block() );
PartRegistry reg[] = PartRegistry.values();
String data[] = new String[reg.length];

View file

@ -2,12 +2,14 @@ package appeng.integration.modules;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import appeng.api.AEApi;
import appeng.integration.IIntegrationModule;
import appeng.integration.abstraction.ITE;
import cofh.api.transport.IItemConduit;
import cpw.mods.fml.common.event.FMLInterModComms;
public class TE implements IIntegrationModule, ITE
{
@ -38,7 +40,14 @@ public class TE implements IIntegrationModule, ITE
private void pulverizer(ItemStack in, ItemStack out)
{
thermalexpansion.api.crafting.CraftingManagers.pulverizerManager.addRecipe( 320, in, out );
NBTTagCompound toSend = new NBTTagCompound();
toSend.setInteger( "energy", 3200 );
toSend.setCompoundTag( "input", new NBTTagCompound() );
toSend.setCompoundTag( "primaryOutput", new NBTTagCompound() );
in.writeToNBT( toSend.getCompoundTag( "input" ) );
out.writeToNBT( toSend.getCompoundTag( "primaryOutput" ) );
FMLInterModComms.sendMessage( "ThermalExpansion", "PulverizerRecipe", toSend );
}
@Override

View file

@ -1,5 +1,7 @@
package appeng.parts.automation;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.api.config.RedstoneMode;
@ -29,6 +31,14 @@ public class PartUpgradeable extends PartBasicState implements ISegmentedInvento
return 4;
}
@Override
public void getDrops(List<ItemStack> drops, boolean wrenched)
{
for (ItemStack is : upgrades)
if ( is != null )
drops.add( is );
}
public void writeToNBT(net.minecraft.nbt.NBTTagCompound extra)
{
super.writeToNBT( extra );

View file

@ -1,11 +1,28 @@
package appeng.parts.reporting;
import java.util.List;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.client.texture.CableBusTextures;
import appeng.core.sync.GuiBridge;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
public class PartCraftingTerminal extends PartMonitor
public class PartCraftingTerminal extends PartTerminal implements IAEAppEngInventory
{
AppEngInternalInventory craftingGrid = new AppEngInternalInventory( this, 9 );
@Override
public void getDrops(List<ItemStack> drops, boolean wrenched)
{
for (ItemStack is : craftingGrid)
if ( is != null )
drops.add( is );
}
public PartCraftingTerminal(ItemStack is) {
super( PartCraftingTerminal.class, is );
frontBright = CableBusTextures.PartCraftingTerm_Bright;
@ -14,4 +31,15 @@ public class PartCraftingTerminal extends PartMonitor
frontSolid = CableBusTextures.PartCraftingTerm_Solid;
}
public GuiBridge getGui()
{
return GuiBridge.GUI_CRAFTING_TERMINAL;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
{
// :)
}
}

View file

@ -14,6 +14,10 @@ import appeng.util.Platform;
public class PartTerminal extends PartMonitor implements IStorageMonitorable
{
public PartTerminal(Class clz, ItemStack is) {
super( clz, is );
}
public PartTerminal(ItemStack is) {
super( PartTerminal.class, is );
frontBright = CableBusTextures.PartTerminal_Bright;
@ -22,6 +26,11 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable
frontSolid = CableBusTextures.PartTerminal_Solid;
}
public GuiBridge getGui()
{
return GuiBridge.GUI_ME;
}
@Override
public boolean onActivate(EntityPlayer player, Vec3 pos)
{
@ -31,7 +40,7 @@ public class PartTerminal extends PartMonitor implements IStorageMonitorable
return true;
if ( proxy.isActive() )
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_ME );
Platform.openGUI( player, getHost().getTile(), side, getGui() );
else
{
if ( proxy.isPowered() )