reformatted all src files (#141)
This commit is contained in:
@@ -19,133 +19,114 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.helpers.DualityInterface;
|
||||
import appeng.helpers.IInterfaceHost;
|
||||
import appeng.util.Platform;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
|
||||
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost
|
||||
{
|
||||
public class ContainerInterface extends ContainerUpgradeable implements IOptionalSlotHost {
|
||||
|
||||
private final DualityInterface myDuality;
|
||||
private final DualityInterface myDuality;
|
||||
|
||||
@GuiSync( 3 )
|
||||
public YesNo bMode = YesNo.NO;
|
||||
@GuiSync(3)
|
||||
public YesNo bMode = YesNo.NO;
|
||||
|
||||
@GuiSync( 4 )
|
||||
public YesNo iTermMode = YesNo.YES;
|
||||
@GuiSync(4)
|
||||
public YesNo iTermMode = YesNo.YES;
|
||||
|
||||
@GuiSync( 7 )
|
||||
public int patternExpansions = 0;
|
||||
@GuiSync(7)
|
||||
public int patternExpansions = 0;
|
||||
|
||||
public ContainerInterface( final InventoryPlayer ip, final IInterfaceHost te )
|
||||
{
|
||||
super( ip, te.getInterfaceDuality().getHost() );
|
||||
public ContainerInterface(final InventoryPlayer ip, final IInterfaceHost te) {
|
||||
super(ip, te.getInterfaceDuality().getHost());
|
||||
|
||||
this.myDuality = te.getInterfaceDuality();
|
||||
this.myDuality = te.getInterfaceDuality();
|
||||
|
||||
for (int row = 0 ; row < 4 ; ++row)
|
||||
{
|
||||
for( int x = 0; x < 9; x++ )
|
||||
{
|
||||
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality
|
||||
.getPatterns(), this, x + row * 9, 8 + 18 * x, 97 + ( 18 * row ), row, this.getInventoryPlayer() ).setStackLimit( 1 ) );
|
||||
}
|
||||
}
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new OptionalSlotRestrictedInput(SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality
|
||||
.getPatterns(), this, x + row * 9, 8 + 18 * x, 97 + (18 * row), row, this.getInventoryPlayer()).setStackLimit(1));
|
||||
}
|
||||
}
|
||||
|
||||
for( int x = 0; x < DualityInterface.NUMBER_OF_CONFIG_SLOTS; x++ )
|
||||
{
|
||||
this.addSlotToContainer( new SlotFake( this.myDuality.getConfig(), x, 8 + 18 * x, 35 ) );
|
||||
}
|
||||
for (int x = 0; x < DualityInterface.NUMBER_OF_CONFIG_SLOTS; x++) {
|
||||
this.addSlotToContainer(new SlotFake(this.myDuality.getConfig(), x, 8 + 18 * x, 35));
|
||||
}
|
||||
|
||||
for( int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++ )
|
||||
{
|
||||
this.addSlotToContainer( new SlotNormal( this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18 ) );
|
||||
}
|
||||
}
|
||||
for (int x = 0; x < DualityInterface.NUMBER_OF_STORAGE_SLOTS; x++) {
|
||||
this.addSlotToContainer(new SlotNormal(this.myDuality.getStorage(), x, 8 + 18 * x, 35 + 18));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight()
|
||||
{
|
||||
return 256;
|
||||
}
|
||||
@Override
|
||||
protected int getHeight() {
|
||||
return 256;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
this.setupUpgrades();
|
||||
}
|
||||
@Override
|
||||
protected void setupConfig() {
|
||||
this.setupUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled( final int idx )
|
||||
{
|
||||
return myDuality.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION) >= idx;
|
||||
}
|
||||
@Override
|
||||
public boolean isSlotEnabled(final int idx) {
|
||||
return myDuality.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION) >= idx;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.verifyPermissions(SecurityPermissions.BUILD, false);
|
||||
|
||||
if (patternExpansions != getPatternUpgrades())
|
||||
{
|
||||
patternExpansions = getPatternUpgrades();
|
||||
this.myDuality.dropExcessPatterns();
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
if (patternExpansions != getPatternUpgrades()) {
|
||||
patternExpansions = getPatternUpgrades();
|
||||
this.myDuality.dropExcessPatterns();
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate( final String field, final Object oldValue, final Object newValue ) {
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
if ( Platform.isClient() && field.equals("patternExpansions"))
|
||||
this.myDuality.dropExcessPatterns();
|
||||
}
|
||||
@Override
|
||||
public void onUpdate(final String field, final Object oldValue, final Object newValue) {
|
||||
super.onUpdate(field, oldValue, newValue);
|
||||
if (Platform.isClient() && field.equals("patternExpansions"))
|
||||
this.myDuality.dropExcessPatterns();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadSettingsFromHost( final IConfigManager cm )
|
||||
{
|
||||
this.setBlockingMode( (YesNo) cm.getSetting( Settings.BLOCK ) );
|
||||
this.setInterfaceTerminalMode( (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL ) );
|
||||
}
|
||||
@Override
|
||||
protected void loadSettingsFromHost(final IConfigManager cm) {
|
||||
this.setBlockingMode((YesNo) cm.getSetting(Settings.BLOCK));
|
||||
this.setInterfaceTerminalMode((YesNo) cm.getSetting(Settings.INTERFACE_TERMINAL));
|
||||
}
|
||||
|
||||
public YesNo getBlockingMode()
|
||||
{
|
||||
return this.bMode;
|
||||
}
|
||||
public YesNo getBlockingMode() {
|
||||
return this.bMode;
|
||||
}
|
||||
|
||||
private void setBlockingMode( final YesNo bMode )
|
||||
{
|
||||
this.bMode = bMode;
|
||||
}
|
||||
private void setBlockingMode(final YesNo bMode) {
|
||||
this.bMode = bMode;
|
||||
}
|
||||
|
||||
public YesNo getInterfaceTerminalMode()
|
||||
{
|
||||
return this.iTermMode;
|
||||
}
|
||||
public YesNo getInterfaceTerminalMode() {
|
||||
return this.iTermMode;
|
||||
}
|
||||
|
||||
private void setInterfaceTerminalMode( final YesNo iTermMode )
|
||||
{
|
||||
this.iTermMode = iTermMode;
|
||||
}
|
||||
private void setInterfaceTerminalMode(final YesNo iTermMode) {
|
||||
this.iTermMode = iTermMode;
|
||||
}
|
||||
|
||||
public int getPatternUpgrades()
|
||||
{
|
||||
return this.myDuality.getInstalledUpgrades( Upgrades.PATTERN_EXPANSION );
|
||||
}
|
||||
public int getPatternUpgrades() {
|
||||
return this.myDuality.getInstalledUpgrades(Upgrades.PATTERN_EXPANSION);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user