Merge pull request #734 from yueh/feature-formation-plane-drop-blocks
Formation plane can now drop blocks as items
This commit is contained in:
commit
c10c809c9e
8 changed files with 118 additions and 69 deletions
|
@ -23,35 +23,37 @@
|
||||||
|
|
||||||
package appeng.api.config;
|
package appeng.api.config;
|
||||||
|
|
||||||
|
|
||||||
import java.util.EnumSet;
|
import java.util.EnumSet;
|
||||||
|
|
||||||
|
|
||||||
public enum Settings
|
public enum Settings
|
||||||
{
|
{
|
||||||
LEVEL_EMITTER_MODE(EnumSet.allOf( LevelEmitterMode.class )),
|
LEVEL_EMITTER_MODE( EnumSet.allOf( LevelEmitterMode.class ) ),
|
||||||
|
|
||||||
REDSTONE_EMITTER(EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL )), REDSTONE_CONTROLLED(EnumSet.allOf( RedstoneMode.class )),
|
REDSTONE_EMITTER( EnumSet.of( RedstoneMode.HIGH_SIGNAL, RedstoneMode.LOW_SIGNAL ) ), REDSTONE_CONTROLLED( EnumSet.allOf( RedstoneMode.class ) ),
|
||||||
|
|
||||||
CONDENSER_OUTPUT(EnumSet.allOf( CondenserOutput.class )),
|
CONDENSER_OUTPUT( EnumSet.allOf( CondenserOutput.class ) ),
|
||||||
|
|
||||||
POWER_UNITS(EnumSet.allOf( PowerUnits.class )), ACCESS(EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE )),
|
POWER_UNITS( EnumSet.allOf( PowerUnits.class ) ), ACCESS( EnumSet.of( AccessRestriction.READ_WRITE, AccessRestriction.READ, AccessRestriction.WRITE ) ),
|
||||||
|
|
||||||
SORT_DIRECTION(EnumSet.allOf( SortDir.class )), SORT_BY(EnumSet.allOf( SortOrder.class )),
|
SORT_DIRECTION( EnumSet.allOf( SortDir.class ) ), SORT_BY( EnumSet.allOf( SortOrder.class ) ),
|
||||||
|
|
||||||
SEARCH_TOOLTIPS(EnumSet.of( YesNo.YES, YesNo.NO )), VIEW_MODE(EnumSet.allOf( ViewItems.class )), SEARCH_MODE(EnumSet.allOf( SearchBoxMode.class )),
|
SEARCH_TOOLTIPS( EnumSet.of( YesNo.YES, YesNo.NO ) ), VIEW_MODE( EnumSet.allOf( ViewItems.class ) ), SEARCH_MODE( EnumSet.allOf( SearchBoxMode.class ) ),
|
||||||
|
|
||||||
ACTIONS(EnumSet.allOf( ActionItems.class )), IO_DIRECTION(EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT )),
|
ACTIONS( EnumSet.allOf( ActionItems.class ) ), IO_DIRECTION( EnumSet.of( RelativeDirection.LEFT, RelativeDirection.RIGHT ) ),
|
||||||
|
|
||||||
BLOCK(EnumSet.of( YesNo.YES, YesNo.NO )), OPERATION_MODE(EnumSet.allOf( OperationMode.class )),
|
BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) ), OPERATION_MODE( EnumSet.allOf( OperationMode.class ) ),
|
||||||
|
|
||||||
FULLNESS_MODE(EnumSet.allOf( FullnessMode.class )), CRAFT_ONLY(EnumSet.of( YesNo.YES, YesNo.NO )),
|
FULLNESS_MODE( EnumSet.allOf( FullnessMode.class ) ), CRAFT_ONLY( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
FUZZY_MODE(EnumSet.allOf( FuzzyMode.class )), LEVEL_TYPE(EnumSet.allOf( LevelType.class )),
|
FUZZY_MODE( EnumSet.allOf( FuzzyMode.class ) ), LEVEL_TYPE( EnumSet.allOf( LevelType.class ) ),
|
||||||
|
|
||||||
TERMINAL_STYLE(EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL )), COPY_MODE(EnumSet.allOf( CopyMode.class )),
|
TERMINAL_STYLE( EnumSet.of( TerminalStyle.TALL, TerminalStyle.SMALL ) ), COPY_MODE( EnumSet.allOf( CopyMode.class ) ),
|
||||||
|
|
||||||
INTERFACE_TERMINAL(EnumSet.of( YesNo.YES, YesNo.NO )), CRAFT_VIA_REDSTONE(EnumSet.of( YesNo.YES, YesNo.NO )),
|
INTERFACE_TERMINAL( EnumSet.of( YesNo.YES, YesNo.NO ) ), CRAFT_VIA_REDSTONE( EnumSet.of( YesNo.YES, YesNo.NO ) ),
|
||||||
|
|
||||||
STORAGE_FILTER(EnumSet.allOf( StorageFilter.class ));
|
STORAGE_FILTER( EnumSet.allOf( StorageFilter.class ) ), PLACE_BLOCK( EnumSet.of( YesNo.YES, YesNo.NO ) );
|
||||||
|
|
||||||
private final EnumSet values;
|
private final EnumSet values;
|
||||||
|
|
||||||
|
@ -60,7 +62,8 @@ public enum Settings
|
||||||
return this.values;
|
return this.values;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Settings(EnumSet set) {
|
private Settings( EnumSet set )
|
||||||
|
{
|
||||||
if ( set == null || set.isEmpty() )
|
if ( set == null || set.isEmpty() )
|
||||||
throw new RuntimeException( "Invalid configuration." );
|
throw new RuntimeException( "Invalid configuration." );
|
||||||
this.values = set;
|
this.values = set;
|
||||||
|
|
|
@ -18,59 +18,79 @@
|
||||||
|
|
||||||
package appeng.client.gui.implementations;
|
package appeng.client.gui.implementations;
|
||||||
|
|
||||||
|
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
|
||||||
import net.minecraft.client.gui.GuiButton;
|
import net.minecraft.client.gui.GuiButton;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
|
||||||
import appeng.api.config.FuzzyMode;
|
import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
import appeng.client.gui.widgets.GuiImgButton;
|
import appeng.client.gui.widgets.GuiImgButton;
|
||||||
import appeng.client.gui.widgets.GuiTabButton;
|
import appeng.client.gui.widgets.GuiTabButton;
|
||||||
import appeng.container.implementations.ContainerFormationPlane;
|
import appeng.container.implementations.ContainerFormationPlane;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.core.sync.GuiBridge;
|
import appeng.core.sync.GuiBridge;
|
||||||
import appeng.core.sync.network.NetworkHandler;
|
import appeng.core.sync.network.NetworkHandler;
|
||||||
|
import appeng.core.sync.packets.PacketConfigButton;
|
||||||
import appeng.core.sync.packets.PacketSwitchGuis;
|
import appeng.core.sync.packets.PacketSwitchGuis;
|
||||||
import appeng.parts.automation.PartFormationPlane;
|
import appeng.parts.automation.PartFormationPlane;
|
||||||
|
|
||||||
|
|
||||||
public class GuiFormationPlane extends GuiUpgradeable
|
public class GuiFormationPlane extends GuiUpgradeable
|
||||||
{
|
{
|
||||||
|
|
||||||
GuiTabButton priority;
|
GuiTabButton priority;
|
||||||
|
GuiImgButton placeMode;
|
||||||
|
|
||||||
public GuiFormationPlane(InventoryPlayer inventoryPlayer, PartFormationPlane te) {
|
public GuiFormationPlane( InventoryPlayer inventoryPlayer, PartFormationPlane te )
|
||||||
|
{
|
||||||
super( new ContainerFormationPlane( inventoryPlayer, te ) );
|
super( new ContainerFormationPlane( inventoryPlayer, te ) );
|
||||||
this.ySize = 251;
|
this.ySize = 251;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawFG( int offsetX, int offsetY, int mouseX, int mouseY )
|
||||||
{
|
{
|
||||||
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
|
this.fontRendererObj.drawString( this.getGuiDisplayName( GuiText.FormationPlane.getLocal() ), 8, 6, 4210752 );
|
||||||
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
this.fontRendererObj.drawString( GuiText.inventory.getLocal(), 8, this.ySize - 96 + 3, 4210752 );
|
||||||
|
|
||||||
if ( this.fuzzyMode != null )
|
if ( this.fuzzyMode != null )
|
||||||
this.fuzzyMode.set( this.cvb.fzMode );
|
this.fuzzyMode.set( this.cvb.fzMode );
|
||||||
|
|
||||||
|
if ( this.placeMode != null )
|
||||||
|
this.placeMode.set( ( ( ContainerFormationPlane ) this.cvb ).placeMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addButtons()
|
protected void addButtons()
|
||||||
{
|
{
|
||||||
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
this.placeMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 28, Settings.PLACE_BLOCK, YesNo.YES );
|
||||||
|
this.fuzzyMode = new GuiImgButton( this.guiLeft - 18, this.guiTop + 48, Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||||
|
|
||||||
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
this.buttonList.add( this.priority = new GuiTabButton( this.guiLeft + 154, this.guiTop, 2 + 4 * 16, GuiText.Priority.getLocal(), itemRender ) );
|
||||||
|
|
||||||
|
this.buttonList.add( this.placeMode );
|
||||||
this.buttonList.add( this.fuzzyMode );
|
this.buttonList.add( this.fuzzyMode );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void actionPerformed(GuiButton btn)
|
protected void actionPerformed( GuiButton btn )
|
||||||
{
|
{
|
||||||
super.actionPerformed( btn );
|
super.actionPerformed( btn );
|
||||||
|
|
||||||
|
boolean backwards = Mouse.isButtonDown( 1 );
|
||||||
|
|
||||||
if ( btn == this.priority )
|
if ( btn == this.priority )
|
||||||
{
|
{
|
||||||
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
NetworkHandler.instance.sendToServer( new PacketSwitchGuis( GuiBridge.GUI_PRIORITY ) );
|
||||||
}
|
}
|
||||||
|
else if ( btn == this.placeMode )
|
||||||
|
{
|
||||||
|
NetworkHandler.instance.sendToServer( new PacketConfigButton( this.placeMode.getSetting(), backwards ) );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -155,6 +155,9 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||||
|
|
||||||
this.registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsNo );
|
this.registerApp( 16 * 3 + 5, Settings.STORAGE_FILTER, StorageFilter.EXTRACTABLE_ONLY, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsNo );
|
||||||
this.registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsYes );
|
this.registerApp( 16 * 3 + 6, Settings.STORAGE_FILTER, StorageFilter.NONE, ButtonToolTips.ReportInaccessibleItems, ButtonToolTips.ReportInaccessibleItemsYes );
|
||||||
|
|
||||||
|
this.registerApp( 16 * 14, Settings.PLACE_BLOCK, YesNo.YES, ButtonToolTips.BlockPlacement, ButtonToolTips.BlockPlacementYes );
|
||||||
|
this.registerApp( 16 * 14 + 1, Settings.PLACE_BLOCK, YesNo.NO, ButtonToolTips.BlockPlacement, ButtonToolTips.BlockPlacementNo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,7 +365,6 @@ public class GuiImgButton extends GuiButton implements ITooltip
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static class ButtonAppearance
|
private static class ButtonAppearance
|
||||||
{
|
{
|
||||||
public int index;
|
public int index;
|
||||||
|
|
|
@ -26,18 +26,25 @@ import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
|
import appeng.container.guisync.GuiSync;
|
||||||
import appeng.container.slot.OptionalSlotFakeTypeOnly;
|
import appeng.container.slot.OptionalSlotFakeTypeOnly;
|
||||||
import appeng.container.slot.SlotFakeTypeOnly;
|
import appeng.container.slot.SlotFakeTypeOnly;
|
||||||
import appeng.container.slot.SlotRestrictedInput;
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
import appeng.parts.automation.PartFormationPlane;
|
import appeng.parts.automation.PartFormationPlane;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class ContainerFormationPlane extends ContainerUpgradeable
|
public class ContainerFormationPlane extends ContainerUpgradeable
|
||||||
{
|
{
|
||||||
|
|
||||||
final PartFormationPlane storageBus;
|
final PartFormationPlane storageBus;
|
||||||
|
|
||||||
public ContainerFormationPlane(InventoryPlayer ip, PartFormationPlane te) {
|
@GuiSync( 6 )
|
||||||
|
public YesNo placeMode;
|
||||||
|
|
||||||
|
public ContainerFormationPlane( InventoryPlayer ip, PartFormationPlane te )
|
||||||
|
{
|
||||||
super( ip, te );
|
super( ip, te );
|
||||||
this.storageBus = te;
|
this.storageBus = te;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +68,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSlotEnabled(int idx)
|
public boolean isSlotEnabled( int idx )
|
||||||
{
|
{
|
||||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||||
|
|
||||||
|
@ -75,9 +82,9 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||||
int yo = 23 + 6;
|
int yo = 23 + 6;
|
||||||
|
|
||||||
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
||||||
for (int y = 0; y < 7; y++)
|
for ( int y = 0; y < 7; y++ )
|
||||||
{
|
{
|
||||||
for (int x = 0; x < 9; x++)
|
for ( int x = 0; x < 9; x++ )
|
||||||
{
|
{
|
||||||
if ( y < 2 )
|
if ( y < 2 )
|
||||||
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||||
|
@ -87,11 +94,11 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||||
}
|
}
|
||||||
|
|
||||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
|
||||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
|
||||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
|
||||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
|
||||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer )).setNotDraggable() );
|
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ) ).setNotDraggable() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -101,7 +108,8 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||||
|
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
{
|
{
|
||||||
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
this.fzMode = ( FuzzyMode ) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||||
|
this.placeMode = ( YesNo ) this.upgradeable.getConfigManager().getSetting( Settings.PLACE_BLOCK );
|
||||||
}
|
}
|
||||||
|
|
||||||
this.standardDetectAndSendChanges();
|
this.standardDetectAndSendChanges();
|
||||||
|
|
|
@ -18,8 +18,10 @@
|
||||||
|
|
||||||
package appeng.core.localization;
|
package appeng.core.localization;
|
||||||
|
|
||||||
|
|
||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
|
|
||||||
|
|
||||||
public enum ButtonToolTips
|
public enum ButtonToolTips
|
||||||
{
|
{
|
||||||
PowerUnits, IOMode, CondenserOutput, RedstoneMode, MatchingFuzzy,
|
PowerUnits, IOMode, CondenserOutput, RedstoneMode, MatchingFuzzy,
|
||||||
|
@ -54,15 +56,19 @@ public enum ButtonToolTips
|
||||||
|
|
||||||
Stash, StashDesc, Encode, EncodeDescription, Substitutions, SubstitutionsOn, SubstitutionsOff, SubstitutionsDesc, CraftOnly, CraftEither,
|
Stash, StashDesc, Encode, EncodeDescription, Substitutions, SubstitutionsOn, SubstitutionsOff, SubstitutionsDesc, CraftOnly, CraftEither,
|
||||||
|
|
||||||
Craft, Mod, DoesntDespawn, EmitterMode, CraftViaRedstone, EmitWhenCrafting, ReportInaccessibleItems, ReportInaccessibleItemsYes, ReportInaccessibleItemsNo;
|
Craft, Mod, DoesntDespawn, EmitterMode, CraftViaRedstone, EmitWhenCrafting, ReportInaccessibleItems, ReportInaccessibleItemsYes, ReportInaccessibleItemsNo,
|
||||||
|
|
||||||
|
BlockPlacement, BlockPlacementYes, BlockPlacementNo;
|
||||||
|
|
||||||
final String root;
|
final String root;
|
||||||
|
|
||||||
ButtonToolTips() {
|
ButtonToolTips()
|
||||||
|
{
|
||||||
this.root = "gui.tooltips.appliedenergistics2";
|
this.root = "gui.tooltips.appliedenergistics2";
|
||||||
}
|
}
|
||||||
|
|
||||||
ButtonToolTips(String r) {
|
ButtonToolTips( String r )
|
||||||
|
{
|
||||||
this.root = r;
|
this.root = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
package appeng.parts.automation;
|
package appeng.parts.automation;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -51,6 +52,7 @@ import appeng.api.config.FuzzyMode;
|
||||||
import appeng.api.config.IncludeExclude;
|
import appeng.api.config.IncludeExclude;
|
||||||
import appeng.api.config.Settings;
|
import appeng.api.config.Settings;
|
||||||
import appeng.api.config.Upgrades;
|
import appeng.api.config.Upgrades;
|
||||||
|
import appeng.api.config.YesNo;
|
||||||
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
import appeng.api.networking.events.MENetworkCellArrayUpdate;
|
||||||
import appeng.api.networking.events.MENetworkChannelsChanged;
|
import appeng.api.networking.events.MENetworkChannelsChanged;
|
||||||
import appeng.api.networking.events.MENetworkEventSubscribe;
|
import appeng.api.networking.events.MENetworkEventSubscribe;
|
||||||
|
@ -80,6 +82,7 @@ import appeng.util.Platform;
|
||||||
import appeng.util.prioitylist.FuzzyPriorityList;
|
import appeng.util.prioitylist.FuzzyPriorityList;
|
||||||
import appeng.util.prioitylist.PrecisePriorityList;
|
import appeng.util.prioitylist.PrecisePriorityList;
|
||||||
|
|
||||||
|
|
||||||
public class PartFormationPlane extends PartUpgradeable implements ICellContainer, IPriorityHost, IMEInventory<IAEItemStack>
|
public class PartFormationPlane extends PartUpgradeable implements ICellContainer, IPriorityHost, IMEInventory<IAEItemStack>
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -89,14 +92,16 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS );
|
final MEInventoryHandler myHandler = new MEInventoryHandler( this, StorageChannel.ITEMS );
|
||||||
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
|
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
|
||||||
|
|
||||||
public PartFormationPlane(ItemStack is) {
|
public PartFormationPlane( ItemStack is )
|
||||||
|
{
|
||||||
super( PartFormationPlane.class, is );
|
super( PartFormationPlane.class, is );
|
||||||
this.settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
this.settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||||
|
this.settings.registerSetting( Settings.PLACE_BLOCK, YesNo.YES );
|
||||||
this.updateHandler();
|
this.updateHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onPartActivate(EntityPlayer player, Vec3 pos)
|
public boolean onPartActivate( EntityPlayer player, Vec3 pos )
|
||||||
{
|
{
|
||||||
if ( !player.isSneaking() )
|
if ( !player.isSneaking() )
|
||||||
{
|
{
|
||||||
|
@ -117,7 +122,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IInventory getInventoryByName(String name)
|
public IInventory getInventoryByName( String name )
|
||||||
{
|
{
|
||||||
if ( name.equals( "config" ) )
|
if ( name.equals( "config" ) )
|
||||||
return this.Config;
|
return this.Config;
|
||||||
|
@ -127,7 +132,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@MENetworkEventSubscribe
|
@MENetworkEventSubscribe
|
||||||
public void powerRender(MENetworkPowerStatusChange c)
|
public void powerRender( MENetworkPowerStatusChange c )
|
||||||
{
|
{
|
||||||
boolean currentActive = this.proxy.isActive();
|
boolean currentActive = this.proxy.isActive();
|
||||||
if ( this.wasActive != currentActive )
|
if ( this.wasActive != currentActive )
|
||||||
|
@ -139,7 +144,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@MENetworkEventSubscribe
|
@MENetworkEventSubscribe
|
||||||
public void updateChannels(MENetworkChannelsChanged changedChannels)
|
public void updateChannels( MENetworkChannelsChanged changedChannels )
|
||||||
{
|
{
|
||||||
boolean currentActive = this.proxy.isActive();
|
boolean currentActive = this.proxy.isActive();
|
||||||
if ( this.wasActive != currentActive )
|
if ( this.wasActive != currentActive )
|
||||||
|
@ -151,8 +156,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
public void renderInventory( IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||||
|
@ -166,8 +171,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
@SideOnly( Side.CLIENT )
|
||||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
public void renderStatic( int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer )
|
||||||
{
|
{
|
||||||
int minX = 1;
|
int minX = 1;
|
||||||
int minY = 1;
|
int minY = 1;
|
||||||
|
@ -191,7 +196,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||||
maxY = 16;
|
maxY = 16;
|
||||||
|
|
||||||
boolean isActive = (this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) == (this.POWERED_FLAG | this.CHANNEL_FLAG);
|
boolean isActive = ( this.clientFlags & ( this.POWERED_FLAG | this.CHANNEL_FLAG ) ) == ( this.POWERED_FLAG | this.CHANNEL_FLAG );
|
||||||
|
|
||||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||||
|
@ -211,18 +216,18 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
this.renderLights( x, y, z, rh, renderer );
|
this.renderLights( x, y, z, rh, renderer );
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isTransitionPlane(TileEntity blockTileEntity, ForgeDirection side)
|
private boolean isTransitionPlane( TileEntity blockTileEntity, ForgeDirection side )
|
||||||
{
|
{
|
||||||
if ( blockTileEntity instanceof IPartHost )
|
if ( blockTileEntity instanceof IPartHost )
|
||||||
{
|
{
|
||||||
IPart p = ((IPartHost) blockTileEntity).getPart( side );
|
IPart p = ( ( IPartHost ) blockTileEntity ).getPart( side );
|
||||||
return p instanceof PartFormationPlane;
|
return p instanceof PartFormationPlane;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getBoxes(IPartCollisionHelper bch)
|
public void getBoxes( IPartCollisionHelper bch )
|
||||||
{
|
{
|
||||||
int minX = 1;
|
int minX = 1;
|
||||||
int minY = 1;
|
int minY = 1;
|
||||||
|
@ -265,7 +270,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
|
public List<IMEInventoryHandler> getCellArray( StorageChannel channel )
|
||||||
{
|
{
|
||||||
if ( this.proxy.isActive() && channel == StorageChannel.ITEMS )
|
if ( this.proxy.isActive() && channel == StorageChannel.ITEMS )
|
||||||
{
|
{
|
||||||
|
@ -277,14 +282,14 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
public void updateSetting( IConfigManager manager, Enum settingName, Enum newValue )
|
||||||
{
|
{
|
||||||
this.updateHandler();
|
this.updateHandler();
|
||||||
this.host.markForSave();
|
this.host.markForSave();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setPriority(int newValue)
|
public void setPriority( int newValue )
|
||||||
{
|
{
|
||||||
this.priority = newValue;
|
this.priority = newValue;
|
||||||
this.host.markForSave();
|
this.host.markForSave();
|
||||||
|
@ -292,7 +297,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
public void onChangeInventory( IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack )
|
||||||
{
|
{
|
||||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||||
|
|
||||||
|
@ -315,7 +320,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||||
|
|
||||||
int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
||||||
for (int x = 0; x < this.Config.getSizeInventory() && x < slotsToUse; x++)
|
for ( int x = 0; x < this.Config.getSizeInventory() && x < slotsToUse; x++ )
|
||||||
{
|
{
|
||||||
IAEItemStack is = this.Config.getAEStackInSlot( x );
|
IAEItemStack is = this.Config.getAEStackInSlot( x );
|
||||||
if ( is != null )
|
if ( is != null )
|
||||||
|
@ -323,7 +328,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||||
this.myHandler.myPartitionList = new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
this.myHandler.myPartitionList = new FuzzyPriorityList( priorityList, ( FuzzyMode ) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
||||||
else
|
else
|
||||||
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
||||||
|
|
||||||
|
@ -331,14 +336,14 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
{
|
{
|
||||||
this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||||
}
|
}
|
||||||
catch (GridAccessException e)
|
catch ( GridAccessException e )
|
||||||
{
|
{
|
||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeToNBT(NBTTagCompound data)
|
public void writeToNBT( NBTTagCompound data )
|
||||||
{
|
{
|
||||||
super.writeToNBT( data );
|
super.writeToNBT( data );
|
||||||
this.Config.writeToNBT( data, "config" );
|
this.Config.writeToNBT( data, "config" );
|
||||||
|
@ -346,7 +351,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound data)
|
public void readFromNBT( NBTTagCompound data )
|
||||||
{
|
{
|
||||||
super.readFromNBT( data );
|
super.readFromNBT( data );
|
||||||
this.Config.readFromNBT( data, "config" );
|
this.Config.readFromNBT( data, "config" );
|
||||||
|
@ -355,13 +360,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAEItemStack extractItems(IAEItemStack request, Actionable mode, BaseActionSource src)
|
public IAEItemStack extractItems( IAEItemStack request, Actionable mode, BaseActionSource src )
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IItemList<IAEItemStack> getAvailableItems(IItemList<IAEItemStack> out)
|
public IItemList<IAEItemStack> getAvailableItems( IItemList<IAEItemStack> out )
|
||||||
{
|
{
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -379,7 +384,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void blinkCell(int slot)
|
public void blinkCell( int slot )
|
||||||
{
|
{
|
||||||
// :P
|
// :P
|
||||||
}
|
}
|
||||||
|
@ -399,11 +404,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
public IAEItemStack injectItems( IAEItemStack input, Actionable type, BaseActionSource src )
|
||||||
{
|
{
|
||||||
if ( this.blocked || input == null || input.getStackSize() <= 0 )
|
if ( this.blocked || input == null || input.getStackSize() <= 0 )
|
||||||
return input;
|
return input;
|
||||||
|
|
||||||
|
YesNo placeBlock = ( YesNo ) this.getConfigManager().getSetting( Settings.PLACE_BLOCK );
|
||||||
|
|
||||||
ItemStack is = input.getItemStack();
|
ItemStack is = input.getItemStack();
|
||||||
Item i = is.getItem();
|
Item i = is.getItem();
|
||||||
|
|
||||||
|
@ -420,17 +427,17 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
|
|
||||||
if ( w.getBlock( x, y, z ).isReplaceable( w, x, y, z ) )
|
if ( w.getBlock( x, y, z ).isReplaceable( w, x, y, z ) )
|
||||||
{
|
{
|
||||||
if ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem
|
if ( placeBlock == YesNo.YES && ( i instanceof ItemBlock || i instanceof IPlantable || i instanceof ItemSkull || i instanceof ItemFirework || i instanceof IPartItem
|
||||||
|| i instanceof ItemReed )
|
|| i instanceof ItemReed ) )
|
||||||
{
|
{
|
||||||
EntityPlayer player = Platform.getPlayer( (WorldServer) w );
|
EntityPlayer player = Platform.getPlayer( ( WorldServer ) w );
|
||||||
Platform.configurePlayer( player, side, this.tile );
|
Platform.configurePlayer( player, side, this.tile );
|
||||||
|
|
||||||
if ( i instanceof ItemFirework )
|
if ( i instanceof ItemFirework )
|
||||||
{
|
{
|
||||||
Chunk c = w.getChunkFromBlockCoords( x, z );
|
Chunk c = w.getChunkFromBlockCoords( x, z );
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (List Z : c.entityLists)
|
for ( List Z : c.entityLists )
|
||||||
sum += Z.size();
|
sum += Z.size();
|
||||||
if ( sum > 32 )
|
if ( sum > 32 )
|
||||||
return input;
|
return input;
|
||||||
|
@ -473,7 +480,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
worked = true;
|
worked = true;
|
||||||
Chunk c = w.getChunkFromBlockCoords( x, z );
|
Chunk c = w.getChunkFromBlockCoords( x, z );
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (List Z : c.entityLists)
|
for ( List Z : c.entityLists )
|
||||||
sum += Z.size();
|
sum += Z.size();
|
||||||
|
|
||||||
if ( sum < AEConfig.instance.formationPlaneEntityLimit )
|
if ( sum < AEConfig.instance.formationPlaneEntityLimit )
|
||||||
|
@ -481,12 +488,12 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
if ( type == Actionable.MODULATE )
|
if ( type == Actionable.MODULATE )
|
||||||
{
|
{
|
||||||
|
|
||||||
is.stackSize = (int) maxStorage;
|
is.stackSize = ( int ) maxStorage;
|
||||||
EntityItem ei = new EntityItem( w, // w
|
EntityItem ei = new EntityItem( w, // w
|
||||||
((side.offsetX != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetX * -0.3 + x, // spawn
|
( ( side.offsetX != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetX * -0.3 + x, // spawn
|
||||||
((side.offsetY != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetY * -0.3 + y, // spawn
|
( ( side.offsetY != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetY * -0.3 + y, // spawn
|
||||||
((side.offsetZ != 0 ? 0.0 : 0.7) * (Platform.getRandomFloat() - 0.5f)) + 0.5 + side.offsetZ * -0.3 + z, // spawn
|
( ( side.offsetZ != 0 ? 0.0 : 0.7 ) * ( Platform.getRandomFloat() - 0.5f ) ) + 0.5 + side.offsetZ * -0.3 + z, // spawn
|
||||||
is.copy() );
|
is.copy() );
|
||||||
|
|
||||||
Entity result = ei;
|
Entity result = ei;
|
||||||
|
|
||||||
|
@ -531,7 +538,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void saveChanges(IMEInventory cellInventory)
|
public void saveChanges( IMEInventory cellInventory )
|
||||||
{
|
{
|
||||||
// nope!
|
// nope!
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,6 +288,9 @@ gui.tooltips.appliedenergistics2.EmitWhenCrafting=Emit Redstone while item is cr
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Report Inaccessible Items
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItems=Report Inaccessible Items
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Yes: Items that cannot be extracted will be visible.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsYes=Yes: Items that cannot be extracted will be visible.
|
||||||
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=No: Only extractable items will be visible.
|
gui.tooltips.appliedenergistics2.ReportInaccessibleItemsNo=No: Only extractable items will be visible.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacement=Block Placement
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementYes=Blocks will be placed as block.
|
||||||
|
gui.tooltips.appliedenergistics2.BlockPlacementNo=Blocks will be dropped as item.
|
||||||
|
|
||||||
gui.appliedenergistics2.units.appliedenergstics=AE
|
gui.appliedenergistics2.units.appliedenergstics=AE
|
||||||
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
gui.appliedenergistics2.units.buildcraft=Minecraft Joules
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 12 KiB |
Loading…
Reference in a new issue