Wireless block no uses placed side to orient, this is more natural for it instead of the place based version.
Added Wireless Encoder Gui to the Security Term Security Term now only accepts Biometric Cards in the config slot. Added Wireless Block. Added Wireless Terminal. Fixed Crash when loading world settings. Configure slot of Security Block now drops on destruction.
This commit is contained in:
+39
-27
@@ -12,6 +12,7 @@ import net.minecraftforge.client.MinecraftForgeClient;
|
|||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
import appeng.api.util.IOrientable;
|
import appeng.api.util.IOrientable;
|
||||||
import appeng.api.util.IOrientableBlock;
|
import appeng.api.util.IOrientableBlock;
|
||||||
|
import appeng.block.networking.BlockWireless;
|
||||||
import appeng.client.render.ItemRenderer;
|
import appeng.client.render.ItemRenderer;
|
||||||
import appeng.me.helpers.IGridProxyable;
|
import appeng.me.helpers.IGridProxyable;
|
||||||
import appeng.tile.AEBaseTile;
|
import appeng.tile.AEBaseTile;
|
||||||
@@ -47,36 +48,47 @@ public class AEBaseItemBlock extends ItemBlock
|
|||||||
|
|
||||||
if ( blockType.hasBlockTileEntity() )
|
if ( blockType.hasBlockTileEntity() )
|
||||||
{
|
{
|
||||||
up = ForgeDirection.UP;
|
if ( blockType instanceof BlockWireless )
|
||||||
|
|
||||||
byte rotation = (byte) (MathHelper.floor_double( (double) ((player.rotationYaw * 4F) / 360F) + 2.5D ) & 3);
|
|
||||||
|
|
||||||
switch (rotation)
|
|
||||||
{
|
{
|
||||||
default:
|
forward = ForgeDirection.getOrientation( side );
|
||||||
case 0:
|
if ( forward == ForgeDirection.UP || forward == ForgeDirection.DOWN )
|
||||||
forward = ForgeDirection.SOUTH;
|
up = ForgeDirection.SOUTH;
|
||||||
break;
|
else
|
||||||
case 1:
|
up = ForgeDirection.UP;
|
||||||
forward = ForgeDirection.WEST;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
forward = ForgeDirection.NORTH;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
forward = ForgeDirection.EAST;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
up = ForgeDirection.UP;
|
||||||
|
|
||||||
if ( player.rotationPitch > 65 )
|
byte rotation = (byte) (MathHelper.floor_double( (double) ((player.rotationYaw * 4F) / 360F) + 2.5D ) & 3);
|
||||||
{
|
|
||||||
up = forward.getOpposite();
|
switch (rotation)
|
||||||
forward = ForgeDirection.UP;
|
{
|
||||||
}
|
default:
|
||||||
else if ( player.rotationPitch < -65 )
|
case 0:
|
||||||
{
|
forward = ForgeDirection.SOUTH;
|
||||||
up = forward.getOpposite();
|
break;
|
||||||
forward = ForgeDirection.DOWN;
|
case 1:
|
||||||
|
forward = ForgeDirection.WEST;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
forward = ForgeDirection.NORTH;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
forward = ForgeDirection.EAST;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( player.rotationPitch > 65 )
|
||||||
|
{
|
||||||
|
up = forward.getOpposite();
|
||||||
|
forward = ForgeDirection.UP;
|
||||||
|
}
|
||||||
|
else if ( player.rotationPitch < -65 )
|
||||||
|
{
|
||||||
|
up = forward.getOpposite();
|
||||||
|
forward = ForgeDirection.DOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -123,7 +123,8 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||||||
{
|
{
|
||||||
if ( s instanceof AppEngSlot )
|
if ( s instanceof AppEngSlot )
|
||||||
{
|
{
|
||||||
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 4;
|
if ( ((AppEngSlot) s).xDisplayPosition < 197 )
|
||||||
|
((AppEngSlot) s).yDisplayPosition = ((AppEngSlot) s).defY + ySize - 78 - 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,13 +164,16 @@ public class GuiMEMonitorable extends AEBaseMEGui
|
|||||||
@Override
|
@Override
|
||||||
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY)
|
||||||
{
|
{
|
||||||
|
int x_width = 197;
|
||||||
|
|
||||||
bindTexture( getBackground() );
|
bindTexture( getBackground() );
|
||||||
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, xSize, 18 );
|
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, x_width, 18 );
|
||||||
|
this.drawTexturedModalRect( offsetX + x_width, offsetY, x_width, 0, 46, 128 );
|
||||||
|
|
||||||
for (int x = 0; x < rows; x++)
|
for (int x = 0; x < rows; x++)
|
||||||
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, xSize, 18 );
|
this.drawTexturedModalRect( offsetX, offsetY + 18 + x * 18, 0, 18, x_width, 18 );
|
||||||
|
|
||||||
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18, 0, 106, xSize, 98 + reservedSpace );
|
this.drawTexturedModalRect( offsetX, offsetY + 16 + rows * 18, 0, 106, x_width, 98 + reservedSpace );
|
||||||
|
|
||||||
searchField.drawTextBox();
|
searchField.drawTextBox();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class GuiSecurity extends GuiMEMonitorable
|
|||||||
public GuiSecurity(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
public GuiSecurity(InventoryPlayer inventoryPlayer, IStorageMonitorable te) {
|
||||||
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
|
super( inventoryPlayer, te, new ContainerSecurity( inventoryPlayer, te ) );
|
||||||
reservedSpace = 32;
|
reservedSpace = 32;
|
||||||
|
xSize += 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuiToggleButton inject, extract, craft, build, security;
|
GuiToggleButton inject, extract, craft, build, security;
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import appeng.util.Platform;
|
|||||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||||
{
|
{
|
||||||
|
|
||||||
|
double powerMultiplier = 0.5;
|
||||||
IPortableCell civ;
|
IPortableCell civ;
|
||||||
|
|
||||||
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell montiorable) {
|
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell montiorable) {
|
||||||
@@ -49,7 +50,7 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
|||||||
ticks++;
|
ticks++;
|
||||||
if ( ticks > 10 )
|
if ( ticks > 10 )
|
||||||
{
|
{
|
||||||
civ.extractAEPower( 0.5 * (double) ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
civ.extractAEPower( powerMultiplier * (double) ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||||
ticks = 0;
|
ticks = 0;
|
||||||
}
|
}
|
||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
|
|||||||
@@ -1,31 +1,62 @@
|
|||||||
package appeng.container.implementations;
|
package appeng.container.implementations;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.EntityPlayerMP;
|
||||||
import net.minecraft.entity.player.InventoryPlayer;
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
import net.minecraft.inventory.ICrafting;
|
import net.minecraft.inventory.ICrafting;
|
||||||
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.implementations.items.IBiometricCard;
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
import appeng.api.storage.IStorageMonitorable;
|
import appeng.api.storage.IStorageMonitorable;
|
||||||
import appeng.container.slot.SlotNormal;
|
import appeng.container.slot.SlotOutput;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput;
|
||||||
|
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||||
|
import appeng.tile.inventory.AppEngInternalInventory;
|
||||||
|
import appeng.tile.inventory.IAEAppEngInventory;
|
||||||
|
import appeng.tile.inventory.InvOperation;
|
||||||
import appeng.tile.misc.TileSecurity;
|
import appeng.tile.misc.TileSecurity;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
public class ContainerSecurity extends ContainerMEMonitorable
|
public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppEngInventory
|
||||||
{
|
{
|
||||||
|
|
||||||
SlotNormal configSlot;
|
SlotRestrictedInput configSlot;
|
||||||
|
|
||||||
|
AppEngInternalInventory wirelessEncoder = new AppEngInternalInventory( this, 2 );
|
||||||
|
|
||||||
|
SlotRestrictedInput wirelessIn;
|
||||||
|
SlotOutput wirelessOut;
|
||||||
|
|
||||||
|
TileSecurity securityBox;
|
||||||
|
|
||||||
public ContainerSecurity(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
public ContainerSecurity(InventoryPlayer ip, IStorageMonitorable montiorable) {
|
||||||
super( ip, montiorable, false );
|
super( ip, montiorable, false );
|
||||||
|
|
||||||
addSlotToContainer( configSlot = new SlotNormal( ((TileSecurity) montiorable).configSlot, 0, 37, -32 ) );
|
securityBox = (TileSecurity) montiorable;
|
||||||
|
|
||||||
|
addSlotToContainer( configSlot = new SlotRestrictedInput( PlaceableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -32 ) );
|
||||||
|
|
||||||
|
addSlotToContainer( wirelessIn = new SlotRestrictedInput( PlaceableItemType.WIRELESS_TERMINAL, wirelessEncoder, 0, 212, 10 ) );
|
||||||
|
addSlotToContainer( wirelessOut = new SlotOutput( wirelessEncoder, 1, 212, 68, -1 ) );
|
||||||
|
|
||||||
bindPlayerInventory( ip, 0, 0 );
|
bindPlayerInventory( ip, 0, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
public int security = 0;
|
public int security = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onContainerClosed(EntityPlayer player)
|
||||||
|
{
|
||||||
|
if ( wirelessIn.getHasStack() )
|
||||||
|
player.dropPlayerItem( wirelessIn.getStack() );
|
||||||
|
|
||||||
|
if ( wirelessOut.getHasStack() )
|
||||||
|
player.dropPlayerItem( wirelessOut.getStack() );
|
||||||
|
}
|
||||||
|
|
||||||
public void toggleSetting(String value, EntityPlayer player)
|
public void toggleSetting(String value, EntityPlayer player)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -89,4 +120,39 @@ public class ContainerSecurity extends ContainerMEMonitorable
|
|||||||
super.detectAndSendChanges();
|
super.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveChanges()
|
||||||
|
{
|
||||||
|
// :P
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||||
|
{
|
||||||
|
if ( !wirelessOut.getHasStack() )
|
||||||
|
{
|
||||||
|
if ( wirelessIn.getHasStack() )
|
||||||
|
{
|
||||||
|
ItemStack term = wirelessIn.getStack().copy();
|
||||||
|
IWirelessTermHandler h = AEApi.instance().registries().wireless().getWirelessTerminalHandler( term );
|
||||||
|
|
||||||
|
if ( h != null )
|
||||||
|
{
|
||||||
|
h.setEncryptionKey( term, "" + securityBox.securityKey, "" );
|
||||||
|
|
||||||
|
wirelessIn.putStack( null );
|
||||||
|
wirelessOut.putStack( term );
|
||||||
|
|
||||||
|
// update the two slots in question...
|
||||||
|
for (int i = 0; i < this.crafters.size(); ++i)
|
||||||
|
{
|
||||||
|
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||||
|
((EntityPlayerMP) icrafting).sendSlotContents( this, wirelessIn.slotNumber, wirelessIn.getStack() );
|
||||||
|
((EntityPlayerMP) icrafting).sendSlotContents( this, wirelessOut.slotNumber, wirelessOut.getStack() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import appeng.api.AEApi;
|
|||||||
import appeng.api.IAppEngApi;
|
import appeng.api.IAppEngApi;
|
||||||
import appeng.api.crafting.ICraftingPatternMAC;
|
import appeng.api.crafting.ICraftingPatternMAC;
|
||||||
import appeng.api.implementations.ICraftingPatternItem;
|
import appeng.api.implementations.ICraftingPatternItem;
|
||||||
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
import appeng.api.implementations.items.ISpatialStorageCell;
|
import appeng.api.implementations.items.ISpatialStorageCell;
|
||||||
import appeng.api.implementations.items.IStorageComponent;
|
import appeng.api.implementations.items.IStorageComponent;
|
||||||
import appeng.api.implementations.items.IUpgradeModule;
|
import appeng.api.implementations.items.IUpgradeModule;
|
||||||
@@ -23,7 +24,8 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||||||
{
|
{
|
||||||
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(
|
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(
|
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);
|
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);
|
||||||
|
|
||||||
public final int icon;
|
public final int icon;
|
||||||
|
|
||||||
@@ -141,6 +143,8 @@ public class SlotRestrictedInput extends AppEngSlot
|
|||||||
return true;
|
return true;
|
||||||
case WIRELESS_TERMINAL:
|
case WIRELESS_TERMINAL:
|
||||||
return AEApi.instance().registries().wireless().isWirelessTerminal( i );
|
return AEApi.instance().registries().wireless().isWirelessTerminal( i );
|
||||||
|
case BIOMETRIC_CARD:
|
||||||
|
return i.getItem() instanceof IBiometricCard;
|
||||||
case UPGRADES:
|
case UPGRADES:
|
||||||
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType( i ) != null;
|
return i.getItem() instanceof IUpgradeModule && ((IUpgradeModule) i.getItem()).getType( i ) != null;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import appeng.api.definitions.Blocks;
|
|||||||
import appeng.api.definitions.Items;
|
import appeng.api.definitions.Items;
|
||||||
import appeng.api.definitions.Materials;
|
import appeng.api.definitions.Materials;
|
||||||
import appeng.api.definitions.Parts;
|
import appeng.api.definitions.Parts;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.api.networking.energy.IEnergyGrid;
|
import appeng.api.networking.energy.IEnergyGrid;
|
||||||
import appeng.api.networking.pathing.IPathingGrid;
|
import appeng.api.networking.pathing.IPathingGrid;
|
||||||
import appeng.api.networking.security.ISecurityGrid;
|
import appeng.api.networking.security.ISecurityGrid;
|
||||||
@@ -38,6 +39,7 @@ import appeng.block.networking.BlockCreativeEnergyCell;
|
|||||||
import appeng.block.networking.BlockDenseEnergyCell;
|
import appeng.block.networking.BlockDenseEnergyCell;
|
||||||
import appeng.block.networking.BlockEnergyAcceptor;
|
import appeng.block.networking.BlockEnergyAcceptor;
|
||||||
import appeng.block.networking.BlockEnergyCell;
|
import appeng.block.networking.BlockEnergyCell;
|
||||||
|
import appeng.block.networking.BlockWireless;
|
||||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||||
import appeng.block.qnb.BlockQuantumRing;
|
import appeng.block.qnb.BlockQuantumRing;
|
||||||
import appeng.block.solids.BlockFluix;
|
import appeng.block.solids.BlockFluix;
|
||||||
@@ -89,6 +91,7 @@ import appeng.items.tools.powered.ToolChargedStaff;
|
|||||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||||
import appeng.items.tools.powered.ToolMassCannon;
|
import appeng.items.tools.powered.ToolMassCannon;
|
||||||
import appeng.items.tools.powered.ToolPortableCell;
|
import appeng.items.tools.powered.ToolPortableCell;
|
||||||
|
import appeng.items.tools.powered.ToolWirelessTerminal;
|
||||||
import appeng.items.tools.quartz.ToolQuartzAxe;
|
import appeng.items.tools.quartz.ToolQuartzAxe;
|
||||||
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
import appeng.items.tools.quartz.ToolQuartzCuttingKnife;
|
||||||
import appeng.items.tools.quartz.ToolQuartzHoe;
|
import appeng.items.tools.quartz.ToolQuartzHoe;
|
||||||
@@ -220,7 +223,7 @@ public class Registration
|
|||||||
blocks.blockGrindStone = addFeature( BlockGrinder.class );
|
blocks.blockGrindStone = addFeature( BlockGrinder.class );
|
||||||
blocks.blockCrankHandle = addFeature( BlockCrank.class );
|
blocks.blockCrankHandle = addFeature( BlockCrank.class );
|
||||||
// blocks.blockInscriber = addFeature( BlockInscriber.class );
|
// blocks.blockInscriber = addFeature( BlockInscriber.class );
|
||||||
// blocks.blockWireless = addFeature( BlockWireless.class );
|
blocks.blockWireless = addFeature( BlockWireless.class );
|
||||||
blocks.blockTinyTNT = addFeature( BlockTinyTNT.class );
|
blocks.blockTinyTNT = addFeature( BlockTinyTNT.class );
|
||||||
|
|
||||||
// blocks.blockQuartzCrystalizer = addFeature( BlockQuartzCrystalizer.class );
|
// blocks.blockQuartzCrystalizer = addFeature( BlockQuartzCrystalizer.class );
|
||||||
@@ -286,7 +289,7 @@ public class Registration
|
|||||||
items.itemMemoryCard = addFeature( ToolMemoryCard.class );
|
items.itemMemoryCard = addFeature( ToolMemoryCard.class );
|
||||||
items.itemChargedStaff = addFeature( ToolChargedStaff.class );
|
items.itemChargedStaff = addFeature( ToolChargedStaff.class );
|
||||||
items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
|
items.itemEntropyManipulator = addFeature( ToolEntropyManipulator.class );
|
||||||
// items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
|
items.itemWirelessTerminal = addFeature( ToolWirelessTerminal.class );
|
||||||
items.itemNetworkTool = addFeature( ToolNetworkTool.class );
|
items.itemNetworkTool = addFeature( ToolNetworkTool.class );
|
||||||
items.itemPortableCell = addFeature( ToolPortableCell.class );
|
items.itemPortableCell = addFeature( ToolPortableCell.class );
|
||||||
items.itemBiometricCard = addFeature( ToolBiometricCard.class );
|
items.itemBiometricCard = addFeature( ToolBiometricCard.class );
|
||||||
@@ -477,6 +480,8 @@ public class Registration
|
|||||||
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
Upgrades.INVERTER.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 1 );
|
||||||
Upgrades.SPEED.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 4 );
|
Upgrades.SPEED.registerItem( AEApi.instance().items().itemMassCannon.stack( 1 ), 4 );
|
||||||
|
|
||||||
|
AEApi.instance().registries().wireless().registerWirelessHandler( (IWirelessTermHandler) AEApi.instance().items().itemWirelessTerminal.item() );
|
||||||
|
|
||||||
if ( Configuration.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
if ( Configuration.instance.isFeatureEnabled( AEFeature.ChestLoot ) )
|
||||||
{
|
{
|
||||||
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
ChestGenHooks d = ChestGenHooks.getInfo( ChestGenHooks.MINESHAFT_CORRIDOR );
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ public class WorldSettings extends Configuration
|
|||||||
public int getPlayerID(String username)
|
public int getPlayerID(String username)
|
||||||
{
|
{
|
||||||
ConfigCategory playerList = this.getCategory( "players" );
|
ConfigCategory playerList = this.getCategory( "players" );
|
||||||
if ( playerList == null )
|
if ( playerList == null || username == null || username.length() == 0 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
Property prop = playerList.get( username );
|
Property prop = playerList.get( username );
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ public class WirelessRegistry implements IWirelessTermRegistery
|
|||||||
@Override
|
@Override
|
||||||
public void registerWirelessHandler(IWirelessTermHandler handler)
|
public void registerWirelessHandler(IWirelessTermHandler handler)
|
||||||
{
|
{
|
||||||
handlers.add( handler );
|
if ( handler != null )
|
||||||
|
handlers.add( handler );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.util.StatCollector;
|
import net.minecraft.util.StatCollector;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
|
import appeng.api.features.IWirelessTermHandler;
|
||||||
import appeng.core.features.AEFeature;
|
import appeng.core.features.AEFeature;
|
||||||
import appeng.core.localization.GuiText;
|
import appeng.core.localization.GuiText;
|
||||||
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
import appeng.items.tools.powered.powersink.AEBasePoweredItem;
|
||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
import cpw.mods.fml.common.network.Player;
|
||||||
|
|
||||||
public class ToolWirelessTerminal extends AEBasePoweredItem
|
public class ToolWirelessTerminal extends AEBasePoweredItem implements IWirelessTermHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
@@ -35,12 +37,14 @@ public class ToolWirelessTerminal extends AEBasePoweredItem
|
|||||||
@Override
|
@Override
|
||||||
public void addInformation(ItemStack i, EntityPlayer p, List l, boolean b)
|
public void addInformation(ItemStack i, EntityPlayer p, List l, boolean b)
|
||||||
{
|
{
|
||||||
|
super.addInformation( i, p, l, b );
|
||||||
|
|
||||||
if ( i.hasTagCompound() )
|
if ( i.hasTagCompound() )
|
||||||
{
|
{
|
||||||
NBTTagCompound tag = Platform.openNbtData( i );
|
NBTTagCompound tag = Platform.openNbtData( i );
|
||||||
if ( tag != null )
|
if ( tag != null )
|
||||||
{
|
{
|
||||||
String encKey = tag.getString( "encKey" );
|
String encKey = tag.getString( "encryptionKey" );
|
||||||
|
|
||||||
if ( encKey == null || encKey == "" )
|
if ( encKey == null || encKey == "" )
|
||||||
l.add( GuiText.Unlinked.getLocal() );
|
l.add( GuiText.Unlinked.getLocal() );
|
||||||
@@ -52,4 +56,37 @@ public class ToolWirelessTerminal extends AEBasePoweredItem
|
|||||||
l.add( StatCollector.translateToLocal( "AppEng.GuiITooltip.Unlinked" ) );
|
l.add( StatCollector.translateToLocal( "AppEng.GuiITooltip.Unlinked" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canHandle(ItemStack is)
|
||||||
|
{
|
||||||
|
return AEApi.instance().items().itemWirelessTerminal.sameAs( is );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean usePower(Player player, float amount, ItemStack is)
|
||||||
|
{
|
||||||
|
return this.extractAEPower( is, amount ) >= amount - 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasPower(Player player, ItemStack is)
|
||||||
|
{
|
||||||
|
return getAECurrentPower( is ) > 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getEncryptionKey(ItemStack item)
|
||||||
|
{
|
||||||
|
NBTTagCompound tag = Platform.openNbtData( item );
|
||||||
|
return tag.getString( "encryptionKey" );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setEncryptionKey(ItemStack item, String encKey, String name)
|
||||||
|
{
|
||||||
|
NBTTagCompound tag = Platform.openNbtData( item );
|
||||||
|
tag.setString( "encryptionKey", encKey );
|
||||||
|
tag.setString( "name", name );
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ import net.minecraft.item.ItemStack;
|
|||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.ForgeDirection;
|
import net.minecraftforge.common.ForgeDirection;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import appeng.api.AEApi;
|
import appeng.api.AEApi;
|
||||||
import appeng.api.config.SecurityPermissions;
|
import appeng.api.config.SecurityPermissions;
|
||||||
|
import appeng.api.events.LocatableEventAnnounce;
|
||||||
|
import appeng.api.events.LocatableEventAnnounce.LocatableEvent;
|
||||||
|
import appeng.api.features.ILocatable;
|
||||||
import appeng.api.features.IPlayerRegistry;
|
import appeng.api.features.IPlayerRegistry;
|
||||||
import appeng.api.implementations.items.IBiometricCard;
|
import appeng.api.implementations.items.IBiometricCard;
|
||||||
import appeng.api.networking.GridFlags;
|
import appeng.api.networking.GridFlags;
|
||||||
@@ -41,7 +45,7 @@ import appeng.tile.inventory.InvOperation;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
|
|
||||||
public class TileSecurity extends AENetworkTile implements IStorageMonitorable, IAEAppEngInventory
|
public class TileSecurity extends AENetworkTile implements IStorageMonitorable, IAEAppEngInventory, ILocatable
|
||||||
{
|
{
|
||||||
|
|
||||||
private static int diffrence = 0;
|
private static int diffrence = 0;
|
||||||
@@ -64,6 +68,9 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
@Override
|
@Override
|
||||||
public void getDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
|
public void getDrops(World w, int x, int y, int z, ArrayList<ItemStack> drops)
|
||||||
{
|
{
|
||||||
|
if ( !configSlot.isEmpty() )
|
||||||
|
drops.add( configSlot.getStackInSlot( 0 ) );
|
||||||
|
|
||||||
for (IAEItemStack ais : inventory.storedItems)
|
for (IAEItemStack ais : inventory.storedItems)
|
||||||
drops.add( ais.getItemStack() );
|
drops.add( ais.getItemStack() );
|
||||||
}
|
}
|
||||||
@@ -78,13 +85,17 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
{
|
{
|
||||||
super.onReady();
|
super.onReady();
|
||||||
if ( Platform.isServer() )
|
if ( Platform.isServer() )
|
||||||
|
{
|
||||||
isActive = true;
|
isActive = true;
|
||||||
|
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Register ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChunkUnload()
|
public void onChunkUnload()
|
||||||
{
|
{
|
||||||
super.onChunkUnload();
|
super.onChunkUnload();
|
||||||
|
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,6 +103,7 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
public void invalidate()
|
public void invalidate()
|
||||||
{
|
{
|
||||||
super.invalidate();
|
super.invalidate();
|
||||||
|
MinecraftForge.EVENT_BUS.post( new LocatableEventAnnounce( this, LocatableEvent.Unregister ) );
|
||||||
isActive = false;
|
isActive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,4 +264,10 @@ public class TileSecurity extends AENetworkTile implements IStorageMonitorable,
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getLocatableSerial()
|
||||||
|
{
|
||||||
|
return securityKey;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package appeng.tile.networking;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
|
||||||
import net.minecraft.inventory.IInventory;
|
import net.minecraft.inventory.IInventory;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@@ -34,9 +35,17 @@ public class TileWireless extends AENetworkInvTile
|
|||||||
|
|
||||||
public TileWireless() {
|
public TileWireless() {
|
||||||
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
gridProxy.setFlags( GridFlags.REQUIRE_CHANNEL );
|
||||||
|
gridProxy.setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
|
||||||
addNewHandler( new TileWirelessHandler() );
|
addNewHandler( new TileWirelessHandler() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setOrientation(ForgeDirection inForward, ForgeDirection inUp)
|
||||||
|
{
|
||||||
|
super.setOrientation( inForward, inUp );
|
||||||
|
gridProxy.setValidSides( EnumSet.of( getForward().getOpposite() ) );
|
||||||
|
}
|
||||||
|
|
||||||
@MENetworkEventSubscribe
|
@MENetworkEventSubscribe
|
||||||
public void chanRender(MENetworkChannelsChanged c)
|
public void chanRender(MENetworkChannelsChanged c)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user