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,8 +23,10 @@
|
||||||
|
|
||||||
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 ) ),
|
||||||
|
@ -51,7 +53,7 @@ public enum Settings
|
||||||
|
|
||||||
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,26 +18,34 @@
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -50,15 +58,20 @@ public class GuiFormationPlane extends GuiUpgradeable
|
||||||
|
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,10 +80,17 @@ public class GuiFormationPlane extends GuiUpgradeable
|
||||||
{
|
{
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -102,6 +109,7 @@ 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,9 +92,11 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +409,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||||
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,8 +427,8 @@ 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 );
|
||||||
|
|
|
@ -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