Add view cells to wireless terminal

This commit is contained in:
D-Cysteine committed 2021-08-06 03:07:26 -06:00
1 parent 468c44193d
commit 1fa536e0a8
5 files changed
+62 -5

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
aeversion=rv3
aechannel=beta
aebuild=53-GTNH
aebuild=54-GTNH
#KEEP V6 FOR MOD SUPPORT
aegroup=appeng
aebasename=appliedenergistics2
@@ -46,6 +46,7 @@ import appeng.core.AELog;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.me.helpers.ChannelPowerSrc;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
@@ -236,7 +237,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
this.updatePowerStatus();
final boolean oldAccessible = this.canAccessViewCells;
this.canAccessViewCells = this.hasAccess( SecurityPermissions.BUILD, false );
this.canAccessViewCells =
this.host instanceof WirelessTerminalGuiObject
|| this.hasAccess( SecurityPermissions.BUILD, false );
if( this.canAccessViewCells != oldAccessible )
{
for( int y = 0; y < 5; y++ )
@@ -26,6 +26,7 @@ import appeng.api.config.PowerMultiplier;
import appeng.api.features.ILocatable;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.implementations.tiles.IWirelessAccessPoint;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridHost;
@@ -44,14 +45,16 @@ import appeng.api.util.AECableType;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.items.contents.WirelessTerminalViewCells;
import appeng.tile.networking.TileWireless;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware, IViewCellStorage
{
private final ItemStack effectiveItem;
@@ -65,6 +68,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
private double sqRange = Double.MAX_VALUE;
private double myRange = Double.MAX_VALUE;
private final int inventorySlot;
private final WirelessTerminalViewCells viewCells;
public WirelessTerminalGuiObject( final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z )
{
@@ -73,6 +77,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
this.myPlayer = ep;
this.wth = wh;
this.inventorySlot = x;
this.viewCells = new WirelessTerminalViewCells( is );
ILocatable obj = null;
@@ -377,4 +382,9 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
return this.inventorySlot;
}
@Override
public IInventory getViewCellStorage()
{
return this.viewCells;
}
}
@@ -0,0 +1,44 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.items.contents;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.util.Platform;
import net.minecraft.item.ItemStack;
public class WirelessTerminalViewCells extends AppEngInternalInventory
{
private final ItemStack is;
public WirelessTerminalViewCells( final ItemStack is )
{
super( null, 5 );
this.is = is;
this.readFromNBT( Platform.openNbtData( is ), "viewCell" );
}
@Override
public void markDirty()
{
this.writeToNBT( Platform.openNbtData( is ), "viewCell" );
}
}
@@ -151,9 +151,9 @@ public class AppEngInternalInventory implements IInventory, Iterable<ItemStack>
}
this.getTileEntity().onChangeInventory( this, slot, InvOperation.setInventorySlotContents, removed, added );
this.markDirty();
}
this.markDirty();
}
@Override