Add Super Wireless Kit (#734)
Co-authored-by: lordIcocain <62835225+lordIcocain@users.noreply.github.com> Co-authored-by: Maya <10861407+serenibyss@users.noreply.github.com> Co-authored-by: Martin Robertz <dream-master@gmx.net> Co-authored-by: NeOzay <colpaert.benoit@gmail.com> Co-authored-by: Ethryan <3237986+Ethryan@users.noreply.github.com> Co-authored-by: NeOzay <69015205+NeOzay@users.noreply.github.com> Co-authored-by: PLASMAchicken <plasmachickenmc@gmail.com> Co-authored-by: Kogepan229 <kogepan25629@gmail.com>
No files matched your search
@@ -7,11 +7,13 @@ dependencies {
|
||||
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:2.1.16:dev')
|
||||
compileOnlyApi('com.github.GTNewHorizons:EnderCore:0.5.12:dev') {transitive = false}
|
||||
compileOnly("com.github.GTNewHorizons:Postea:1.2.5:dev")
|
||||
compileOnly('com.github.GTNewHorizons:ThaumicTinkerer:2.12.19:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ForestryMC:4.11.12:dev') {transitive = false} // required to compile CraftingV2Tests.java now
|
||||
compileOnly('com.github.GTNewHorizons:ForgeMultipart:1.7.3:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:GT5-Unofficial:5.09.52.411:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:ModularUI2:2.3.58-1.7.10:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:Jabba:1.5.18:dev') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.7.1:api') {transitive = false}
|
||||
compileOnly('com.github.GTNewHorizons:OpenComputers:1.12.28-GTNH:api') {transitive = false}
|
||||
@@ -45,6 +47,7 @@ dependencies {
|
||||
//runtimeOnlyNonPublishable('curse.maven:thermal-foundation-222880:2388753')
|
||||
//runtimeOnlyNonPublishable('curse.maven:thermal-expansion-69163:2388759')
|
||||
|
||||
runtimeOnlyNonPublishable("com.github.GTNewHorizons:Postea:1.2.5:dev")
|
||||
runtimeOnlyNonPublishable('com.github.GTNewHorizons:waila:1.19.22:dev') {transitive = false}
|
||||
|
||||
//Uncomment if you need to test chunkloading and warps/homes
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package appeng.api.config;
|
||||
|
||||
import appeng.core.localization.Localization;
|
||||
import appeng.core.localization.WirelessMessages;
|
||||
|
||||
public enum AdvancedWirelessToolMode implements Localization {
|
||||
|
||||
Queueing,
|
||||
Binding,
|
||||
QueueingLine,
|
||||
BindingLine;
|
||||
|
||||
@Override
|
||||
public String getUnlocalized() {
|
||||
return switch (this) {
|
||||
case Binding -> WirelessMessages.AdvancedBinding.getUnlocalized();
|
||||
case Queueing -> WirelessMessages.AdvancedQueueing.getUnlocalized();
|
||||
case BindingLine -> WirelessMessages.AdvancedBindingLine.getUnlocalized();
|
||||
case QueueingLine -> WirelessMessages.AdvancedQueueingLine.getUnlocalized();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import java.util.EnumSet;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VisualisationModes;
|
||||
|
||||
public enum Settings {
|
||||
|
||||
LEVEL_EMITTER_MODE(EnumSet.allOf(LevelEmitterMode.class)),
|
||||
@@ -88,6 +90,8 @@ public enum Settings {
|
||||
|
||||
INTERFACE_TERMINAL_SECTION_ORDER(EnumSet.allOf(StringOrder.class)),
|
||||
|
||||
NETWORK_VISUALISER(EnumSet.allOf(VisualisationModes.class)),
|
||||
|
||||
CRAFTING_ALLOW(EnumSet.allOf(CraftingAllow.class)),
|
||||
|
||||
PAUSE_WHEN_HOLDING_SHIFT(EnumSet.of(YesNo.YES, YesNo.NO)),
|
||||
@@ -96,7 +100,15 @@ public enum Settings {
|
||||
|
||||
INSERT_ORDER(EnumSet.of(YesNo.YES, YesNo.NO)),
|
||||
|
||||
CELL_HEALTH_SORT(EnumSet.allOf(HealthSortOrder.class));
|
||||
CELL_HEALTH_SORT(EnumSet.allOf(HealthSortOrder.class)),
|
||||
|
||||
WIRELESS_TOOL_MODE(EnumSet.allOf(WirelessToolMode.class)),
|
||||
|
||||
ADVANCED_WIRELESS_TOOL_MODE(EnumSet.allOf(AdvancedWirelessToolMode.class)),
|
||||
|
||||
WIRELESS_TOOL_GROUP_BY(EnumSet.allOf(WirelessToolGroupBy.class)),
|
||||
|
||||
WIRELESS_TOOL_HIDE_BOUNDED(EnumSet.of(YesNo.YES, YesNo.NO));
|
||||
|
||||
private final EnumSet<? extends Enum<?>> values;
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package appeng.api.config;
|
||||
|
||||
public enum WirelessToolGroupBy {
|
||||
Single,
|
||||
Color,
|
||||
Network
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package appeng.api.config;
|
||||
|
||||
import appeng.core.localization.Localization;
|
||||
import appeng.core.localization.WirelessMessages;
|
||||
|
||||
public enum WirelessToolMode implements Localization {
|
||||
|
||||
Simple,
|
||||
Advanced,
|
||||
Super;
|
||||
|
||||
@Override
|
||||
public String getUnlocalized() {
|
||||
return switch (this) {
|
||||
case Simple -> WirelessMessages.Simple.getUnlocalized();
|
||||
case Advanced -> WirelessMessages.Advanced.getUnlocalized();
|
||||
case Super -> WirelessMessages.Super.getUnlocalized();
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -53,6 +53,8 @@ public class Blocks {
|
||||
|
||||
public AEItemDefinition blockInscriber;
|
||||
|
||||
public AEItemDefinition blockAdvancedInscriber;
|
||||
|
||||
public AEItemDefinition blockWireless;
|
||||
|
||||
public AEItemDefinition blockCharger;
|
||||
|
||||
@@ -91,6 +91,8 @@ public interface IBlocks {
|
||||
|
||||
ITileDefinition inscriber();
|
||||
|
||||
ITileDefinition advancedInscriber();
|
||||
|
||||
ITileDefinition wireless();
|
||||
|
||||
ITileDefinition charger();
|
||||
@@ -205,4 +207,10 @@ public interface IBlocks {
|
||||
ITileDefinition paint();
|
||||
|
||||
ITileDefinition patternsOptimizationMatrix();
|
||||
|
||||
ITileDefinition wirelessConnector();
|
||||
|
||||
ITileDefinition wirelessHub();
|
||||
|
||||
ITileDefinition crystalGrowthChamber();
|
||||
}
|
||||
@@ -120,4 +120,8 @@ public interface IItems {
|
||||
AEColoredItemDefinition coloredPaintBall();
|
||||
|
||||
AEColoredItemDefinition coloredLumenPaintBall();
|
||||
|
||||
IItemDefinition toolNetworkVisualiser();
|
||||
|
||||
IItemDefinition toolWirelessKit();
|
||||
}
|
||||
@@ -28,6 +28,6 @@ public interface IGuiItem {
|
||||
}
|
||||
|
||||
default IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return null;
|
||||
return getGuiObject(is, world, x, y, z);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.core.localization.GuiText;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
/**
|
||||
* Represents a location in the Minecraft Universe
|
||||
*/
|
||||
@@ -113,6 +116,37 @@ public class DimensionalCoord extends WorldCoord {
|
||||
return list;
|
||||
}
|
||||
|
||||
public void writeToPacket(final ByteBuf data) {
|
||||
data.writeInt(this.x);
|
||||
data.writeInt(this.y);
|
||||
data.writeInt(this.z);
|
||||
data.writeInt(this.dimId);
|
||||
}
|
||||
|
||||
public static void writeListToPacket(final ByteBuf data, final List<DimensionalCoord> list) {
|
||||
data.writeInt(list == null ? 0 : list.size());
|
||||
if (list == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (final DimensionalCoord coord : list) {
|
||||
coord.writeToPacket(data);
|
||||
}
|
||||
}
|
||||
|
||||
public static DimensionalCoord readFromPacket(final ByteBuf data) {
|
||||
return new DimensionalCoord(data.readInt(), data.readInt(), data.readInt(), data.readInt());
|
||||
}
|
||||
|
||||
public static List<DimensionalCoord> readAsListPacket(final ByteBuf data) {
|
||||
final int count = data.readInt();
|
||||
final List<DimensionalCoord> list = new ArrayList<>(count);
|
||||
for (int i = 0; i < count; i++) {
|
||||
list.add(readFromPacket(data));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "dimension=" + this.dimId + ", " + super.toString();
|
||||
@@ -129,4 +163,20 @@ public class DimensionalCoord extends WorldCoord {
|
||||
public int getDimension() {
|
||||
return dimId;
|
||||
}
|
||||
|
||||
public String getGuiText() {
|
||||
return GuiText.GuiDimensionalCoord.getLocal(this.x, this.y, this.z, this.dimId);
|
||||
}
|
||||
|
||||
public String getGuiTextNoDim() {
|
||||
return GuiText.GuiDimensionalCoordNoDim.getLocal(this.x, this.y, this.z);
|
||||
}
|
||||
|
||||
public String getGuiTextShort() {
|
||||
return GuiText.GuiDimensionalCoordShort.getLocal(this.x, this.y, this.z, this.dimId);
|
||||
}
|
||||
|
||||
public String getGuiTextShortNoDim() {
|
||||
return GuiText.GuiDimensionalCoordShortNoDim.getLocal(this.x, this.y, this.z);
|
||||
}
|
||||
}
|
||||
@@ -80,15 +80,13 @@ public class NamedDimensionalCoord extends DimensionalCoord {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToPacket(final ByteBuf data) {
|
||||
data.writeInt(this.x);
|
||||
data.writeInt(this.y);
|
||||
data.writeInt(this.z);
|
||||
data.writeInt(this.dimId);
|
||||
super.writeToPacket(data);
|
||||
ByteBufUtils.writeUTF8String(data, this.name == null ? "" : this.name);
|
||||
}
|
||||
|
||||
public static void writeListToPacket(final ByteBuf data, final List<NamedDimensionalCoord> list) {
|
||||
public static void writeListToPacketNamed(final ByteBuf data, final List<NamedDimensionalCoord> list) {
|
||||
data.writeInt(list == null ? 0 : list.size());
|
||||
if (list == null) {
|
||||
return;
|
||||
@@ -100,12 +98,7 @@ public class NamedDimensionalCoord extends DimensionalCoord {
|
||||
}
|
||||
|
||||
public static NamedDimensionalCoord readFromPacket(final ByteBuf data) {
|
||||
return new NamedDimensionalCoord(
|
||||
data.readInt(),
|
||||
data.readInt(),
|
||||
data.readInt(),
|
||||
data.readInt(),
|
||||
ByteBufUtils.readUTF8String(data));
|
||||
return new NamedDimensionalCoord(DimensionalCoord.readFromPacket(data), ByteBufUtils.readUTF8String(data));
|
||||
}
|
||||
|
||||
public static List<NamedDimensionalCoord> readAsListFromPacket(final ByteBuf data) {
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.client.texture.FlippableIcon;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileAdvancedInscriber;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockAdvancedInscriber extends AEBaseTileBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon topIcon;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIconOn;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon sideIconOff;
|
||||
|
||||
public BlockAdvancedInscriber() {
|
||||
super(Material.iron);
|
||||
|
||||
this.setTileEntity(TileAdvancedInscriber.class);
|
||||
this.setFeature(EnumSet.of(AEFeature.Inscriber));
|
||||
this.setHardness(1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(final IIconRegister iconRegistry) {
|
||||
this.topIcon = iconRegistry.registerIcon("appliedenergistics2:BlockAdvancedInscriberTop");
|
||||
this.sideIconOn = iconRegistry.registerIcon("appliedenergistics2:BlockAdvancedInscriberSideOn");
|
||||
this.sideIconOff = iconRegistry.registerIcon("appliedenergistics2:BlockAdvancedInscriberSideOff");
|
||||
|
||||
final FlippableIcon top = new FlippableIcon(this.topIcon);
|
||||
final FlippableIcon side = new FlippableIcon(this.sideIconOff);
|
||||
this.blockIcon = this.topIcon;
|
||||
this.getRendererInstance().updateIcons(top, top, side, side, side, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(final int direction, final int metadata) {
|
||||
if (direction == ForgeDirection.UP.ordinal() || direction == ForgeDirection.DOWN.ordinal()) {
|
||||
return this.topIcon;
|
||||
}
|
||||
return metadata == 1 ? this.sideIconOn : this.sideIconOff;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World w, final int x, final int y, final int z, final EntityPlayer p,
|
||||
final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (p.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final TileAdvancedInscriber tile = this.getTileEntity(w, x, y, z);
|
||||
if (tile != null) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(p, tile, ForgeDirection.getOrientation(side), GuiBridge.GUI_ADVANCED_INSCRIBER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package appeng.block.misc;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.tile.misc.TileCrystalGrowthChamber;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockCrystalGrowthChamber extends AEBaseTileBlock {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon off;
|
||||
|
||||
public BlockCrystalGrowthChamber() {
|
||||
super(Material.iron);
|
||||
setTileEntity(TileCrystalGrowthChamber.class);
|
||||
setFeature(EnumSet.of(AEFeature.Core));
|
||||
setHardness(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onActivated(final World w, final int x, final int y, final int z, final EntityPlayer p,
|
||||
final int side, final float hitX, final float hitY, final float hitZ) {
|
||||
if (p.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final TileCrystalGrowthChamber tg = getTileEntity(w, x, y, z);
|
||||
if (tg != null) {
|
||||
if (Platform.isServer()) {
|
||||
Platform.openGUI(p, tg, ForgeDirection.getOrientation(side), GuiBridge.GUI_CRYSTAL_GROWTH_CHAMBER);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void registerBlockIcons(final IIconRegister ir) {
|
||||
super.registerBlockIcons(ir);
|
||||
off = ir.registerIcon("appliedenergistics2:CrystalGrowthChamber/main_off");
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int direction, int metadata) {
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) {
|
||||
if (w.getBlockMetadata(x, y, z) == 0) {
|
||||
return off;
|
||||
}
|
||||
return blockIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTextureName() {
|
||||
return "appliedenergistics2:CrystalGrowthChamber/main_on";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorBlack;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorBlue;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorBrown;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorCyan;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorGreen;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorGrey;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorLightBlue;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorLightGrey;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorLime;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorMagenta;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorOrange;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorPink;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorPurple;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorRed;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorTransparent;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorWhite;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessConnectorYellow;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.IOrientable;
|
||||
import appeng.block.AEBaseTileBlock;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.helpers.NullRotation;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import appeng.tile.networking.TileWirelessConnector;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockWirelessConnector extends AEBaseTileBlock {
|
||||
|
||||
public BlockWirelessConnector() {
|
||||
super(Material.iron);
|
||||
this.hasSubtypes = true;
|
||||
this.setTileEntity(TileWirelessConnector.class);
|
||||
this.setFeature(EnumSet.of(AEFeature.Core));
|
||||
setHardness(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) {
|
||||
ItemStack is = new ItemStack(this);
|
||||
if (world.getTileEntity(x, y, z) instanceof TileWirelessBase twc) {
|
||||
if (twc.getColor() != AEColor.Transparent) {
|
||||
is.setItemDamage(twc.getColor().ordinal() + 1);
|
||||
}
|
||||
}
|
||||
ArrayList<ItemStack> arr = new ArrayList<>();
|
||||
arr.add(is);
|
||||
return arr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack is, EntityPlayer p, List<String> lines, boolean advancedItemTooltips) {
|
||||
if (is.getItemDamage() == 0) {
|
||||
lines.add(AEColor.Transparent.toString());
|
||||
} else {
|
||||
lines.add(AEColor.values()[is.getItemDamage() - 1].toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getCheckedSubBlocks(Item item, CreativeTabs tabs, List<ItemStack> itemStacks) {
|
||||
for (int i = 0; i < AEColor.values().length; i++) {
|
||||
itemStacks.add(new ItemStack(this, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z, EntityPlayer player) {
|
||||
ItemStack is = new ItemStack(this);
|
||||
if (world.getTileEntity(x, y, z) instanceof TileWirelessBase twc) {
|
||||
AEColor color = twc.getColor();
|
||||
if (color != AEColor.Transparent) {
|
||||
is.setItemDamage(color.ordinal() + 1);
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World w, int x, int y, int z, EntityLivingBase player, ItemStack is) {
|
||||
int damage = is.getItemDamage();
|
||||
if (damage > 0) {
|
||||
if (w.getTileEntity(x, y, z) instanceof TileWirelessBase twc) {
|
||||
twc.recolourBlock(ForgeDirection.UNKNOWN, AEColor.values()[damage - 1], (EntityPlayer) player);
|
||||
w.setBlockMetadataWithNotify(x, y, z, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
super.onBlockPlacedBy(w, x, y, z, player, is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World w, int x, int y, int z, Block a, int b) {
|
||||
if (w.getTileEntity(x, y, z) instanceof TileWirelessBase twc) twc.doUnlink();
|
||||
super.breakBlock(w, x, y, z, a, b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IOrientable getOrientable(final IBlockAccess w, final int x, final int y, final int z) {
|
||||
return new NullRotation();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderStateByMeta(final int metadata) {
|
||||
this.getRendererInstance().setTemporaryRenderIcon(this.getIcon(0, metadata));
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int direction, int metadata) {
|
||||
return switch (metadata) {
|
||||
case 1 -> WirelessConnectorWhite.getOnIcon();
|
||||
case 2 -> WirelessConnectorOrange.getOnIcon();
|
||||
case 3 -> WirelessConnectorMagenta.getOnIcon();
|
||||
case 4 -> WirelessConnectorLightBlue.getOnIcon();
|
||||
case 5 -> WirelessConnectorYellow.getOnIcon();
|
||||
case 6 -> WirelessConnectorLime.getOnIcon();
|
||||
case 7 -> WirelessConnectorPink.getOnIcon();
|
||||
case 8 -> WirelessConnectorGrey.getOnIcon();
|
||||
case 9 -> WirelessConnectorLightGrey.getOnIcon();
|
||||
case 10 -> WirelessConnectorCyan.getOnIcon();
|
||||
case 11 -> WirelessConnectorPurple.getOnIcon();
|
||||
case 12 -> WirelessConnectorBlue.getOnIcon();
|
||||
case 13 -> WirelessConnectorBrown.getOnIcon();
|
||||
case 14 -> WirelessConnectorGreen.getOnIcon();
|
||||
case 15 -> WirelessConnectorRed.getOnIcon();
|
||||
case 16 -> WirelessConnectorBlack.getOnIcon();
|
||||
default -> WirelessConnectorTransparent.getOnIcon();
|
||||
};
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) {
|
||||
if (w.getBlockMetadata(x, y, z) == 0) {
|
||||
return switch (((TileWirelessConnector) Objects.requireNonNull(this.getTileEntity(w, x, y, z)))
|
||||
.getColor()) {
|
||||
case White -> WirelessConnectorWhite.getOffIcon();
|
||||
case Orange -> WirelessConnectorOrange.getOffIcon();
|
||||
case Magenta -> WirelessConnectorMagenta.getOffIcon();
|
||||
case LightBlue -> WirelessConnectorLightBlue.getOffIcon();
|
||||
case Yellow -> WirelessConnectorYellow.getOffIcon();
|
||||
case Lime -> WirelessConnectorLime.getOffIcon();
|
||||
case Pink -> WirelessConnectorPink.getOffIcon();
|
||||
case Gray -> WirelessConnectorGrey.getOffIcon();
|
||||
case LightGray -> WirelessConnectorLightGrey.getOffIcon();
|
||||
case Cyan -> WirelessConnectorCyan.getOffIcon();
|
||||
case Purple -> WirelessConnectorPurple.getOffIcon();
|
||||
case Blue -> WirelessConnectorBlue.getOffIcon();
|
||||
case Brown -> WirelessConnectorBrown.getOffIcon();
|
||||
case Green -> WirelessConnectorGreen.getOffIcon();
|
||||
case Red -> WirelessConnectorRed.getOffIcon();
|
||||
case Black -> WirelessConnectorBlack.getOffIcon();
|
||||
default -> WirelessConnectorTransparent.getOffIcon();
|
||||
};
|
||||
} else {
|
||||
return switch (((TileWirelessConnector) w.getTileEntity(x, y, z)).getColor()) {
|
||||
case White -> WirelessConnectorWhite.getOnIcon();
|
||||
case Orange -> WirelessConnectorOrange.getOnIcon();
|
||||
case Magenta -> WirelessConnectorMagenta.getOnIcon();
|
||||
case LightBlue -> WirelessConnectorLightBlue.getOnIcon();
|
||||
case Yellow -> WirelessConnectorYellow.getOnIcon();
|
||||
case Lime -> WirelessConnectorLime.getOnIcon();
|
||||
case Pink -> WirelessConnectorPink.getOnIcon();
|
||||
case Gray -> WirelessConnectorGrey.getOnIcon();
|
||||
case LightGray -> WirelessConnectorLightGrey.getOnIcon();
|
||||
case Cyan -> WirelessConnectorCyan.getOnIcon();
|
||||
case Purple -> WirelessConnectorPurple.getOnIcon();
|
||||
case Blue -> WirelessConnectorBlue.getOnIcon();
|
||||
case Brown -> WirelessConnectorBrown.getOnIcon();
|
||||
case Green -> WirelessConnectorGreen.getOnIcon();
|
||||
case Red -> WirelessConnectorRed.getOnIcon();
|
||||
case Black -> WirelessConnectorBlack.getOnIcon();
|
||||
default -> WirelessConnectorTransparent.getOnIcon();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package appeng.block.networking;
|
||||
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubBlack;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubBlue;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubBrown;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubCyan;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubGreen;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubGrey;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubLightBlue;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubLightGrey;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubLime;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubMagenta;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubOrange;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubPink;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubPurple;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubRed;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubTransparent;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubWhite;
|
||||
import static appeng.client.texture.WirelessTextures.WirelessHubYellow;
|
||||
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import appeng.tile.networking.TileWirelessHub;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockWirelessHub extends BlockWirelessConnector {
|
||||
|
||||
public BlockWirelessHub() {
|
||||
super();
|
||||
this.setTileEntity(TileWirelessHub.class);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(int direction, int metadata) {
|
||||
return switch (metadata) {
|
||||
case 1 -> WirelessHubWhite.getOnIcon();
|
||||
case 2 -> WirelessHubOrange.getOnIcon();
|
||||
case 3 -> WirelessHubMagenta.getOnIcon();
|
||||
case 4 -> WirelessHubLightBlue.getOnIcon();
|
||||
case 5 -> WirelessHubYellow.getOnIcon();
|
||||
case 6 -> WirelessHubLime.getOnIcon();
|
||||
case 7 -> WirelessHubPink.getOnIcon();
|
||||
case 8 -> WirelessHubGrey.getOnIcon();
|
||||
case 9 -> WirelessHubLightGrey.getOnIcon();
|
||||
case 10 -> WirelessHubCyan.getOnIcon();
|
||||
case 11 -> WirelessHubPurple.getOnIcon();
|
||||
case 12 -> WirelessHubBlue.getOnIcon();
|
||||
case 13 -> WirelessHubBrown.getOnIcon();
|
||||
case 14 -> WirelessHubGreen.getOnIcon();
|
||||
case 15 -> WirelessHubRed.getOnIcon();
|
||||
case 16 -> WirelessHubBlack.getOnIcon();
|
||||
default -> WirelessHubTransparent.getOnIcon();
|
||||
};
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIcon(IBlockAccess w, int x, int y, int z, int s) {
|
||||
if (w.getBlockMetadata(x, y, z) == 0) {
|
||||
return switch (((TileWirelessHub) w.getTileEntity(x, y, z)).getColor()) {
|
||||
case White -> WirelessHubWhite.getOffIcon();
|
||||
case Orange -> WirelessHubOrange.getOffIcon();
|
||||
case Magenta -> WirelessHubMagenta.getOffIcon();
|
||||
case LightBlue -> WirelessHubLightBlue.getOffIcon();
|
||||
case Yellow -> WirelessHubYellow.getOffIcon();
|
||||
case Lime -> WirelessHubLime.getOffIcon();
|
||||
case Pink -> WirelessHubPink.getOffIcon();
|
||||
case Gray -> WirelessHubGrey.getOffIcon();
|
||||
case LightGray -> WirelessHubLightGrey.getOffIcon();
|
||||
case Cyan -> WirelessHubCyan.getOffIcon();
|
||||
case Purple -> WirelessHubPurple.getOffIcon();
|
||||
case Blue -> WirelessHubBlue.getOffIcon();
|
||||
case Brown -> WirelessHubBrown.getOffIcon();
|
||||
case Green -> WirelessHubGreen.getOffIcon();
|
||||
case Red -> WirelessHubRed.getOffIcon();
|
||||
case Black -> WirelessHubBlack.getOffIcon();
|
||||
default -> WirelessHubTransparent.getOffIcon();
|
||||
};
|
||||
} else {
|
||||
return switch (((TileWirelessHub) w.getTileEntity(x, y, z)).getColor()) {
|
||||
case White -> WirelessHubWhite.getOnIcon();
|
||||
case Orange -> WirelessHubOrange.getOnIcon();
|
||||
case Magenta -> WirelessHubMagenta.getOnIcon();
|
||||
case LightBlue -> WirelessHubLightBlue.getOnIcon();
|
||||
case Yellow -> WirelessHubYellow.getOnIcon();
|
||||
case Lime -> WirelessHubLime.getOnIcon();
|
||||
case Pink -> WirelessHubPink.getOnIcon();
|
||||
case Gray -> WirelessHubGrey.getOnIcon();
|
||||
case LightGray -> WirelessHubLightGrey.getOnIcon();
|
||||
case Cyan -> WirelessHubCyan.getOnIcon();
|
||||
case Purple -> WirelessHubPurple.getOnIcon();
|
||||
case Blue -> WirelessHubBlue.getOnIcon();
|
||||
case Brown -> WirelessHubBrown.getOnIcon();
|
||||
case Green -> WirelessHubGreen.getOnIcon();
|
||||
case Red -> WirelessHubRed.getOnIcon();
|
||||
case Black -> WirelessHubBlack.getOnIcon();
|
||||
default -> WirelessHubTransparent.getOnIcon();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,7 @@ import appeng.api.util.AEColor;
|
||||
import appeng.block.AEBaseBlock;
|
||||
import appeng.client.render.BaseBlockRender;
|
||||
import appeng.client.render.BlockPosHighlighter;
|
||||
import appeng.client.render.NetworkVisualiserRender;
|
||||
import appeng.client.render.TESRWrapper;
|
||||
import appeng.client.render.WorldRender;
|
||||
import appeng.client.render.effects.AssemblerFX;
|
||||
@@ -62,6 +63,7 @@ import appeng.client.render.previewBlocks.BlockRendererPreviewEvent;
|
||||
import appeng.client.texture.CableBusTextures;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.client.texture.ExtraItemTextures;
|
||||
import appeng.client.texture.WirelessTextures;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.CommonHelper;
|
||||
@@ -108,6 +110,7 @@ public class ClientHelper extends ServerHelper {
|
||||
public void init() {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
MinecraftForge.EVENT_BUS.register(new BlockPosHighlighter());
|
||||
MinecraftForge.EVENT_BUS.register(new NetworkVisualiserRender());
|
||||
MinecraftForge.EVENT_BUS.register(new HighlighterManager());
|
||||
MinecraftForge.EVENT_BUS.register(BlockRendererPreviewEvent.getInstance());
|
||||
FMLCommonHandler.instance().bus().register(BlockRendererPreviewEvent.getInstance());
|
||||
@@ -450,6 +453,10 @@ public class ClientHelper extends ServerHelper {
|
||||
for (final CableBusTextures cb : CableBusTextures.values()) {
|
||||
cb.registerIcon(ev.map);
|
||||
}
|
||||
|
||||
for (final WirelessTextures tw : WirelessTextures.values()) {
|
||||
tw.registerIcon(ev.map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.client.gui.widgets.GuiProgressBar;
|
||||
import appeng.client.gui.widgets.GuiProgressBar.Direction;
|
||||
import appeng.client.gui.widgets.ITooltip;
|
||||
import appeng.container.implementations.ContainerAdvancedInscriber;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.tile.misc.TileAdvancedInscriber;
|
||||
|
||||
public class GuiAdvancedInscriber extends AEBaseGui {
|
||||
|
||||
private final ContainerAdvancedInscriber container;
|
||||
private GuiProgressBar progressBar;
|
||||
private LockButton topLock;
|
||||
private LockButton bottomLock;
|
||||
|
||||
public GuiAdvancedInscriber(final InventoryPlayer inventoryPlayer, final TileAdvancedInscriber te) {
|
||||
super(new ContainerAdvancedInscriber(inventoryPlayer, te));
|
||||
this.container = (ContainerAdvancedInscriber) this.inventorySlots;
|
||||
this.ySize = 176;
|
||||
this.xSize = this.hasToolbox() ? 246 : 211;
|
||||
}
|
||||
|
||||
private boolean hasToolbox() {
|
||||
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
this.progressBar = new GuiProgressBar(
|
||||
this.container,
|
||||
"guis/inscriber.png",
|
||||
135,
|
||||
39,
|
||||
135,
|
||||
177,
|
||||
6,
|
||||
18,
|
||||
Direction.VERTICAL);
|
||||
this.buttonList.add(this.progressBar);
|
||||
|
||||
this.topLock = new LockButton(0, this.guiLeft + 34, this.guiTop + 20, "top");
|
||||
this.bottomLock = new LockButton(1, this.guiLeft + 34, this.guiTop + 66, "bottom");
|
||||
this.buttonList.add(this.topLock);
|
||||
this.buttonList.add(this.bottomLock);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
final int maxProgress = Math.max(1, this.container.getMaxProgress());
|
||||
this.progressBar.setFullMsg(this.container.getCurrentProgress() * 100 / maxProgress + "%");
|
||||
|
||||
this.fontRendererObj.drawString(
|
||||
this.getGuiDisplayName(GuiText.AdvancedInscriber.getLocal()),
|
||||
8,
|
||||
6,
|
||||
GuiColors.InscriberTitle.getColor());
|
||||
this.fontRendererObj.drawString(
|
||||
GuiText.inventory.getLocal(),
|
||||
8,
|
||||
this.ySize - 96 + 3,
|
||||
GuiColors.InscriberInventory.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
this.bindTexture("guis/inscriber.png");
|
||||
this.progressBar.xPosition = 135 + this.guiLeft;
|
||||
this.progressBar.yPosition = 39 + this.guiTop;
|
||||
|
||||
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, 176, this.ySize);
|
||||
this.bindTexture("guis/mac.png");
|
||||
this.drawTexturedModalRect(offsetX + 179, offsetY, 179, 0, 32, 104);
|
||||
|
||||
if (this.hasToolbox()) {
|
||||
this.bindTexture("guis/inscriber.png");
|
||||
this.drawTexturedModalRect(offsetX + 178, offsetY + 105, 178, this.ySize - 90, 68, 68);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(final GuiButton btn) {
|
||||
super.actionPerformed(btn);
|
||||
|
||||
try {
|
||||
if (btn == this.topLock) {
|
||||
NetworkHandler.instance.sendToServer(
|
||||
new PacketValueConfig("AdvancedInscriber.Lock", "top:" + !this.container.topLocked));
|
||||
} else if (btn == this.bottomLock) {
|
||||
NetworkHandler.instance.sendToServer(
|
||||
new PacketValueConfig("AdvancedInscriber.Lock", "bottom:" + !this.container.bottomLocked));
|
||||
}
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
|
||||
private final class LockButton extends GuiButton implements ITooltip {
|
||||
|
||||
private final String slot;
|
||||
private final ResourceLocation lockedTexture = new ResourceLocation(
|
||||
"appliedenergistics2",
|
||||
"textures/guis/advanced_inscriber_lock_on.png");
|
||||
private final ResourceLocation unlockedTexture = new ResourceLocation(
|
||||
"appliedenergistics2",
|
||||
"textures/guis/advanced_inscriber_lock_off.png");
|
||||
|
||||
private LockButton(final int id, final int x, final int y, final String slot) {
|
||||
super(id, x, y, 8, 8, "");
|
||||
this.slot = slot;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(final Minecraft minecraft, final int mouseX, final int mouseY) {
|
||||
if (!this.visible) {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
minecraft.renderEngine.bindTexture(this.isLocked() ? this.lockedTexture : this.unlockedTexture);
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
this.drawFullTexture(this.xPosition, this.yPosition, this.width, this.height);
|
||||
}
|
||||
|
||||
private void drawFullTexture(final int x, final int y, final int width, final int height) {
|
||||
final Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV(x, y + height, this.zLevel, 0, 1);
|
||||
tessellator.addVertexWithUV(x + width, y + height, this.zLevel, 1, 1);
|
||||
tessellator.addVertexWithUV(x + width, y, this.zLevel, 1, 0);
|
||||
tessellator.addVertexWithUV(x, y, this.zLevel, 0, 0);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
private boolean isLocked() {
|
||||
return this.slot.equals("top") ? GuiAdvancedInscriber.this.container.topLocked
|
||||
: GuiAdvancedInscriber.this.container.bottomLocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
if (this.isLocked()) {
|
||||
return GuiText.AdvancedInscriberLockOn.getLocal();
|
||||
}
|
||||
|
||||
return GuiText.AdvancedInscriberLockOff.getLocal() + '\n' + GuiText.AdvancedInscriberLockNote.getLocal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return this.xPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return this.yPosition;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return this.width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
return this.visible;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package appeng.client.gui.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import appeng.client.gui.AEBaseGui;
|
||||
import appeng.container.implementations.ContainerCrystalGrowthChamber;
|
||||
import appeng.container.implementations.ContainerUpgradeable;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.tile.misc.TileCrystalGrowthChamber;
|
||||
|
||||
public class GuiCrystalGrowthChamber extends AEBaseGui {
|
||||
|
||||
private final ContainerCrystalGrowthChamber cg;
|
||||
|
||||
public GuiCrystalGrowthChamber(final InventoryPlayer inventoryPlayer, final TileCrystalGrowthChamber te) {
|
||||
super(new ContainerCrystalGrowthChamber(inventoryPlayer, te));
|
||||
cg = (ContainerCrystalGrowthChamber) this.inventorySlots;
|
||||
ySize = 166;
|
||||
xSize = hasToolbox() ? 246 : 211;
|
||||
}
|
||||
|
||||
private boolean hasToolbox() {
|
||||
return ((ContainerUpgradeable) this.inventorySlots).hasToolbox();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawFG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
fontRendererObj.drawString(
|
||||
getGuiDisplayName(
|
||||
StatCollector.translateToLocal("tile.appliedenergistics2.BlockCrystalGrowthChamber.name")),
|
||||
8,
|
||||
6,
|
||||
GuiColors.ChestTitle.getColor());
|
||||
fontRendererObj
|
||||
.drawString(GuiText.inventory.getLocal(), 8, ySize - 96 + 3, GuiColors.ChestInventory.getColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
|
||||
bindTexture("guis/crystalGrowthChamber.png");
|
||||
|
||||
drawTexturedModalRect(offsetX, offsetY, 0, 0, 211 - 34, ySize);
|
||||
|
||||
if (drawUpgrades()) {
|
||||
drawTexturedModalRect(offsetX + 177, offsetY, 177, 0, 35, 14 + cg.availableUpgrades() * 18);
|
||||
}
|
||||
if (hasToolbox()) {
|
||||
drawTexturedModalRect(offsetX + 178, offsetY + ySize - 90, 178, ySize - 90, 68, 68);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean drawUpgrades() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import java.util.regex.Pattern;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
|
||||
import appeng.core.localization.GuiColors;
|
||||
|
||||
public class GuiAeButton extends GuiButton implements ITooltip {
|
||||
|
||||
private static final Pattern PATTERN_NEW_LINE = Pattern.compile("\\n", Pattern.LITERAL);
|
||||
@@ -37,16 +39,32 @@ public class GuiAeButton extends GuiButton implements ITooltip {
|
||||
int hoverState = this.getHoverState(this.field_146123_n);
|
||||
switch (hoverState) {
|
||||
case 0:
|
||||
this.drawHorizontalLine(xPosition + 2, xPosition + width - 2, yPosition + height - 2, 0xFF2C2C2C);
|
||||
this.drawHorizontalLine(
|
||||
xPosition + 2,
|
||||
xPosition + width - 2,
|
||||
yPosition + height - 2,
|
||||
GuiColors.GuiAeButtonLineBeforeUnderlineDisabled.getColor());
|
||||
break;
|
||||
case 1:
|
||||
this.drawHorizontalLine(xPosition + 2, xPosition + width - 2, yPosition + height - 2, 0xFF565656);
|
||||
this.drawHorizontalLine(
|
||||
xPosition + 2,
|
||||
xPosition + width - 2,
|
||||
yPosition + height - 2,
|
||||
GuiColors.GuiAeButtonLineBeforeUnderlineDefault.getColor());
|
||||
break;
|
||||
case 2:
|
||||
this.drawHorizontalLine(xPosition + 2, xPosition + width - 2, yPosition + height - 2, 0xFF5C669D);
|
||||
this.drawHorizontalLine(
|
||||
xPosition + 2,
|
||||
xPosition + width - 2,
|
||||
yPosition + height - 2,
|
||||
GuiColors.GuiAeButtonLineBeforeUnderlineHover.getColor());
|
||||
break;
|
||||
}
|
||||
this.drawHorizontalLine(xPosition, xPosition + width - 1, yPosition + height - 1, 0xFF000000);
|
||||
this.drawHorizontalLine(
|
||||
xPosition,
|
||||
xPosition + width - 1,
|
||||
yPosition + height - 1,
|
||||
GuiColors.GuiAeButtonUnderline.getColor());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
public class GuiCheckBox extends GuiToggleButton {
|
||||
|
||||
final double scale;
|
||||
|
||||
public GuiCheckBox(double scale, int x, int y, String DisplayName, String DisplayHint) {
|
||||
this(scale, x, y, 16 * 7 + 12, 16 * 7 + 11, DisplayName, DisplayHint);
|
||||
}
|
||||
|
||||
public GuiCheckBox(double scale, int x, int y, int iconOn, int iconOff, String DisplayName, String DisplayHint) {
|
||||
super(x, y, iconOn, iconOff, DisplayName, DisplayHint);
|
||||
this.scale = scale;
|
||||
this.xPosition = (int) Math.ceil(this.xPosition / scale);
|
||||
this.yPosition = (int) Math.ceil(this.yPosition / scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
super.drawButton(par1Minecraft, par2, par3);
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int xPos() {
|
||||
return (int) Math.ceil(this.xPosition * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int yPos() {
|
||||
return (int) Math.ceil(this.yPosition * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return (int) Math.ceil(this.width * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return (int) Math.ceil(this.height * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
return this.enabled && this.visible
|
||||
&& mouseX >= xPos()
|
||||
&& mouseY >= yPos()
|
||||
&& mouseX < xPos() + getWidth()
|
||||
&& mouseY < yPos() + getHeight();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package appeng.client.gui.widgets;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.localization.GuiColors;
|
||||
|
||||
public class GuiColorButton extends GuiAeButton {
|
||||
|
||||
private final AEColor color;
|
||||
|
||||
public GuiColorButton(int id, int xPosition, int yPosition, int width, int height, AEColor color,
|
||||
String tootipString) {
|
||||
super(id, xPosition, yPosition, width, height, "", tootipString);
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
int color;
|
||||
if (this.field_146123_n) {
|
||||
color = this.color.blackVariant - 16777216;
|
||||
} else {
|
||||
color = this.color.mediumVariant - 16777216;
|
||||
}
|
||||
drawRect(this.xPosition, this.yPosition, this.xPosition + this.width, this.yPosition + this.height, color);
|
||||
|
||||
drawVerticalLine(
|
||||
this.xPosition,
|
||||
this.yPosition,
|
||||
this.yPosition + this.height - 1,
|
||||
GuiColors.ColorButtonOutline.getColor());
|
||||
drawVerticalLine(
|
||||
this.xPosition + this.width - 1,
|
||||
this.yPosition,
|
||||
this.yPosition + this.height - 1,
|
||||
GuiColors.ColorButtonOutline.getColor());
|
||||
drawHorizontalLine(
|
||||
this.xPosition,
|
||||
this.xPosition + this.width - 1,
|
||||
this.yPosition,
|
||||
GuiColors.ColorButtonOutline.getColor());
|
||||
drawHorizontalLine(
|
||||
this.xPosition,
|
||||
this.xPosition + this.width - 1,
|
||||
this.yPosition + this.height - 1,
|
||||
GuiColors.ColorButtonOutline.getColor());
|
||||
|
||||
this.mouseDragged(mc, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
|
||||
public AEColor getColor() {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
@@ -57,6 +57,7 @@ import appeng.api.config.StorageFilter;
|
||||
import appeng.api.config.StringOrder;
|
||||
import appeng.api.config.TerminalStyle;
|
||||
import appeng.api.config.ViewItems;
|
||||
import appeng.api.config.WirelessToolGroupBy;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.client.texture.ExtraBlockTextures;
|
||||
import appeng.core.localization.ButtonToolTips;
|
||||
@@ -875,12 +876,14 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
||||
CraftingAllow.ALLOW_ALL,
|
||||
ButtonToolTips.CPUAllowMode,
|
||||
ButtonToolTips.CPUAllowAllDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 14 + 4,
|
||||
Settings.CRAFTING_ALLOW,
|
||||
CraftingAllow.ONLY_PLAYER,
|
||||
ButtonToolTips.CPUAllowMode,
|
||||
ButtonToolTips.CPUOnlyAllowPlayerDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 14 + 5,
|
||||
Settings.CRAFTING_ALLOW,
|
||||
@@ -888,6 +891,41 @@ public class GuiImgButton extends GuiButton implements ITooltip {
|
||||
ButtonToolTips.CPUAllowMode,
|
||||
ButtonToolTips.CPUOnlyAllowNonPlayerDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 7 + 8,
|
||||
Settings.WIRELESS_TOOL_GROUP_BY,
|
||||
WirelessToolGroupBy.Single,
|
||||
ButtonToolTips.WirelessToolGroupBySingleName,
|
||||
ButtonToolTips.WirelessToolGroupBySingleDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 7 + 9,
|
||||
Settings.WIRELESS_TOOL_GROUP_BY,
|
||||
WirelessToolGroupBy.Color,
|
||||
ButtonToolTips.WirelessToolGroupByColorName,
|
||||
ButtonToolTips.WirelessToolGroupByColorDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 7 + 10,
|
||||
Settings.WIRELESS_TOOL_GROUP_BY,
|
||||
WirelessToolGroupBy.Network,
|
||||
ButtonToolTips.WirelessToolGroupByNetworkName,
|
||||
ButtonToolTips.WirelessToolGroupByNetworkDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 6 + 12,
|
||||
Settings.WIRELESS_TOOL_HIDE_BOUNDED,
|
||||
YesNo.YES,
|
||||
ButtonToolTips.WirelessToolHideBoundedYesName,
|
||||
ButtonToolTips.WirelessToolHideBoundedYesDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 6 + 11,
|
||||
Settings.WIRELESS_TOOL_HIDE_BOUNDED,
|
||||
YesNo.NO,
|
||||
ButtonToolTips.WirelessToolHideBoundedNoName,
|
||||
ButtonToolTips.WirelessToolHideBoundedNoDesc);
|
||||
|
||||
this.registerApp(
|
||||
16 * 15 + 13,
|
||||
Settings.ACTIONS,
|
||||
|
||||
@@ -0,0 +1,378 @@
|
||||
package appeng.client.render;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.client.event.RenderWorldLastEvent;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.core.localization.GuiColors;
|
||||
import appeng.items.tools.ToolNetworkVisualiser;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VLink;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VLinkFlags;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VNode;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VNodeFlags;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VisualisationModes;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class NetworkVisualiserRender {
|
||||
|
||||
private static long expTime;
|
||||
private final double SIZE = 0.2d;
|
||||
private final int staticList = GL11.glGenLists(1);
|
||||
private static boolean needListRefresh = true;
|
||||
private static ArrayList<VNode> vNodeSet = new ArrayList<>();
|
||||
private static ArrayList<VLink> vLinkSet = new ArrayList<>();
|
||||
private static final Set<VLink> dense = new HashSet<>();
|
||||
private static final Set<VLink> normal = new HashSet<>();
|
||||
private static VisualisationModes mode = VisualisationModes.FULL;
|
||||
private static final Minecraft mc = Minecraft.getMinecraft();
|
||||
private static boolean renderWireless = false;
|
||||
private static final List<DimensionalCoord> wirelessConnections = new ArrayList<>();
|
||||
private static DimensionalCoord prevPos;
|
||||
|
||||
final List<VisualisationModes> renderNodesModes = Arrays.asList(
|
||||
VisualisationModes.NODES,
|
||||
VisualisationModes.FULL,
|
||||
VisualisationModes.NONUM,
|
||||
VisualisationModes.PROXY);
|
||||
|
||||
final List<VisualisationModes> renderLinksModes = Arrays.asList(
|
||||
VisualisationModes.CHANNELS,
|
||||
VisualisationModes.FULL,
|
||||
VisualisationModes.NONUM,
|
||||
VisualisationModes.P2P,
|
||||
VisualisationModes.PROXY);
|
||||
|
||||
public static void networkVisualiser(ArrayList<VNode> vNodeSetNew, ArrayList<VLink> vLinkSetNew) {
|
||||
vNodeSet = vNodeSetNew;
|
||||
vLinkSet = vLinkSetNew;
|
||||
normal.clear();
|
||||
dense.clear();
|
||||
|
||||
for (VLink link : vLinkSet) {
|
||||
if (link.flags.contains(VLinkFlags.DENSE)) {
|
||||
dense.add(link);
|
||||
} else {
|
||||
normal.add(link);
|
||||
}
|
||||
}
|
||||
needListRefresh = true;
|
||||
}
|
||||
|
||||
public static void doWirelessRender(List<DimensionalCoord> dcl) {
|
||||
wirelessConnections.clear();
|
||||
wirelessConnections.addAll(dcl);
|
||||
renderWireless = true;
|
||||
expTime = System.currentTimeMillis() + 100;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void renderNetwork(RenderWorldLastEvent ev) {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
EntityPlayerSP p = mc.thePlayer;
|
||||
double viewX = p.lastTickPosX + (p.posX - p.lastTickPosX) * ev.partialTicks;
|
||||
double viewY = p.lastTickPosY + (p.posY - p.lastTickPosY) * ev.partialTicks;
|
||||
double viewZ = p.lastTickPosZ + (p.posZ - p.lastTickPosZ) * ev.partialTicks;
|
||||
|
||||
doRenderWirelessPath(viewX, viewY, viewZ);
|
||||
|
||||
ItemStack is = mc.thePlayer.inventory.getCurrentItem();
|
||||
if (is == null || !(is.getItem() instanceof ToolNetworkVisualiser && is.hasTagCompound()
|
||||
&& is.getTagCompound().hasKey("dim")))
|
||||
return;
|
||||
|
||||
// Do not render if in a different dimension from the bound network
|
||||
VisualisationModes newMode = (VisualisationModes) ToolNetworkVisualiser.getConfigManager(is)
|
||||
.getSetting(Settings.NETWORK_VISUALISER);
|
||||
if (newMode != mode) {
|
||||
mode = newMode;
|
||||
needListRefresh = true;
|
||||
}
|
||||
int networkDim = is.getTagCompound().getInteger("dim");
|
||||
if (networkDim != mc.theWorld.provider.dimensionId) {
|
||||
return;
|
||||
}
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-viewX, -viewY, -viewZ);
|
||||
doRender(ev.partialTicks, viewX, viewY, viewZ);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void doRenderWirelessPath(double viewX, double viewY, double viewZ) {
|
||||
if (!renderWireless) return;
|
||||
|
||||
if (expTime < System.currentTimeMillis()) {
|
||||
wirelessConnections.clear();
|
||||
renderWireless = false;
|
||||
return;
|
||||
}
|
||||
|
||||
MovingObjectPosition mop = mc.objectMouseOver;
|
||||
if (mop == null || mop.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) return;
|
||||
|
||||
DimensionalCoord pos = new DimensionalCoord(mop.blockX, mop.blockY, mop.blockZ, 0);
|
||||
if (prevPos == null || !pos.isEqual(prevPos)) {
|
||||
prevPos = pos;
|
||||
expTime = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity te = mc.theWorld.getTileEntity(pos.x, pos.y, pos.z);
|
||||
|
||||
if (!(te instanceof TileWirelessBase) || wirelessConnections.isEmpty()) return;
|
||||
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(-viewX, -viewY, -viewZ);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_LINE_SMOOTH);
|
||||
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
|
||||
GL11.glLineWidth(4.0f);
|
||||
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_LINES);
|
||||
tess.setColorRGBA_F(0, 0, 1, 1);
|
||||
for (DimensionalCoord dc : wirelessConnections) {
|
||||
tess.addVertex(pos.x + 0.5d, pos.y + 0.5d, pos.z + 0.5d);
|
||||
tess.addVertex(dc.x + 0.5d, dc.y + 0.5d, dc.z + 0.5d);
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
GL11.glPopAttrib();
|
||||
GL11.glPopMatrix();
|
||||
|
||||
}
|
||||
|
||||
public void doRender(Float partialTicks, double viewX, double viewY, double viewZ) {
|
||||
GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
if (needListRefresh) {
|
||||
needListRefresh = false;
|
||||
GL11.glNewList(staticList, GL11.GL_COMPILE);
|
||||
|
||||
if (renderNodesModes.contains(mode)) renderNodes();
|
||||
|
||||
GL11.glEnable(GL11.GL_LINE_SMOOTH);
|
||||
GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST);
|
||||
|
||||
if (renderLinksModes.contains(mode)) {
|
||||
renderLinks(dense, AEConfig.instance.visualiserWidthDense);
|
||||
renderLinks(normal, AEConfig.instance.visualiserWidthNormal);
|
||||
}
|
||||
|
||||
GL11.glEndList();
|
||||
}
|
||||
|
||||
GL11.glCallList(staticList);
|
||||
|
||||
// Labels are rendered every frame because they need to face the camera
|
||||
|
||||
if (mode == VisualisationModes.FULL) {
|
||||
for (VLink link : vLinkSet) {
|
||||
if (link.channels > 0) {
|
||||
double linkX = (link.node1.x + link.node2.x) / 2d + 0.5d;
|
||||
double linkY = (link.node1.y + link.node2.y) / 2d + 0.5d;
|
||||
double linkZ = (link.node1.z + link.node2.z) / 2d + 0.5d;
|
||||
double distSq = (viewX - linkX) * (viewX - linkX) + (viewY - linkY) * (viewY - linkY)
|
||||
+ (viewZ - linkZ) * (viewZ - linkZ);
|
||||
if (distSq < 256d) { // 16 blocks
|
||||
renderFloatingText(
|
||||
String.valueOf(link.channels),
|
||||
linkX,
|
||||
linkY,
|
||||
linkZ,
|
||||
GuiColors.NetworkVisualiserFloatingText.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glPopAttrib();
|
||||
}
|
||||
|
||||
private void renderNodes() {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_QUADS);
|
||||
|
||||
for (VNode node : vNodeSet) {
|
||||
switch (mode) {
|
||||
case NODES, NONUM -> {
|
||||
if (node.flags.contains(VNodeFlags.PROXY)) continue;
|
||||
}
|
||||
|
||||
case CHANNELS, P2P -> {
|
||||
continue;
|
||||
}
|
||||
|
||||
case PROXY -> {
|
||||
if (!node.flags.contains(VNodeFlags.PROXY)) continue;
|
||||
}
|
||||
|
||||
default -> {}
|
||||
}
|
||||
|
||||
final int color;
|
||||
if (node.flags.contains(VNodeFlags.MISSING)) color = GuiColors.NetworkVisualiserNodeMissing.getColor();
|
||||
else if (node.flags.contains(VNodeFlags.DENSE)) color = GuiColors.NetworkVisualiserNodeDense.getColor();
|
||||
else if (node.flags.contains(VNodeFlags.PROXY)) color = GuiColors.NetworkVisualiserNodeProxy.getColor();
|
||||
else color = GuiColors.NetworkVisualiserNodeDefault.getColor();
|
||||
|
||||
final int alpha = (color >> 24) & 0xFF;
|
||||
final int red = (color >> 16) & 0xFF;
|
||||
final int green = (color >> 8) & 0xFF;
|
||||
final int blue = (color) & 0xFF;
|
||||
|
||||
tess.setColorRGBA(red, green, blue, alpha); // +Y
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
|
||||
tess.setColorRGBA(red / 2, green / 2, blue / 2, alpha); // -Y
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
|
||||
tess.setColorRGBA(red * 8 / 10, green * 8 / 10, blue * 8 / 10, alpha); // +/- Z
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
|
||||
tess.setColorRGBA(red * 6 / 10, green * 6 / 10, blue * 6 / 10, alpha); // +/- X
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d + SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d + SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d + SIZE, node.z + 0.5d - SIZE);
|
||||
tess.addVertex(node.x + 0.5d - SIZE, node.y + 0.5d - SIZE, node.z + 0.5d - SIZE);
|
||||
}
|
||||
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
private void renderLinks(Set<VLink> links, float width) {
|
||||
GL11.glLineWidth(width);
|
||||
Tessellator tess = Tessellator.instance;
|
||||
tess.startDrawing(GL11.GL_LINES);
|
||||
|
||||
for (VLink link : links) {
|
||||
switch (mode) {
|
||||
case NODES -> {
|
||||
continue;
|
||||
}
|
||||
|
||||
case CHANNELS, NONUM -> {
|
||||
if (link.flags.contains(VLinkFlags.PROXY)) continue;
|
||||
}
|
||||
|
||||
case P2P -> {
|
||||
if (!link.flags.contains(VLinkFlags.COMPRESSED)) continue;
|
||||
}
|
||||
|
||||
case PROXY -> {
|
||||
if (!link.flags.contains(VLinkFlags.PROXY)) continue;
|
||||
}
|
||||
|
||||
default -> {}
|
||||
}
|
||||
|
||||
final int color;
|
||||
if (link.flags.contains(VLinkFlags.COMPRESSED))
|
||||
color = GuiColors.NetworkVisualiserLinkCompressed.getColor();
|
||||
else if (link.flags.contains(VLinkFlags.DENSE)) color = GuiColors.NetworkVisualiserLinkDense.getColor();
|
||||
else if (link.flags.contains(VLinkFlags.PROXY)) color = GuiColors.NetworkVisualiserLinkProxy.getColor();
|
||||
else color = GuiColors.NetworkVisualiserLinkDefault.getColor();
|
||||
|
||||
final int alpha = (color >> 24) & 0xFF;
|
||||
final int red = (color >> 16) & 0xFF;
|
||||
final int green = (color >> 8) & 0xFF;
|
||||
final int blue = (color) & 0xFF;
|
||||
|
||||
tess.setColorRGBA(red, green, blue, alpha);
|
||||
|
||||
tess.addVertex(link.node1.x + 0.5d, link.node1.y + 0.5d, link.node1.z + 0.5d);
|
||||
tess.addVertex(link.node2.x + 0.5d, link.node2.y + 0.5d, link.node2.z + 0.5d);
|
||||
|
||||
}
|
||||
tess.draw();
|
||||
}
|
||||
|
||||
public void renderFloatingText(String text, Double x, Double y, Double z, int color) {
|
||||
RenderManager renderManager = RenderManager.instance;
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
float scale = 0.027f;
|
||||
GL11.glColor4f(1f, 1f, 1f, 0.5f);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x, y, z);
|
||||
GL11.glNormal3f(0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(-renderManager.playerViewY, 0.0f, 1.0f, 0.0f);
|
||||
GL11.glRotatef(renderManager.playerViewX, 1.0f, 0.0f, 0.0f);
|
||||
GL11.glScalef(-scale, -scale, scale);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
int yOffset = -4;
|
||||
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
tessellator.startDrawingQuads();
|
||||
int textWidth = fontRenderer.getStringWidth(text);
|
||||
int stringMiddle = textWidth / 2;
|
||||
tessellator.setColorRGBA_F(0.0f, 0.0f, 0.0f, 0.5f);
|
||||
tessellator.addVertex(-stringMiddle - 1, -1 + yOffset, 0.0d);
|
||||
tessellator.addVertex(-stringMiddle - 1, 8 + yOffset, 0.0d);
|
||||
tessellator.addVertex(stringMiddle + 1, 8 + yOffset, 0.0d);
|
||||
tessellator.addVertex(stringMiddle + 1, -1 + yOffset, 0.0d);
|
||||
tessellator.draw();
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glColor4f(1f, 1f, 1f, 0.5f);
|
||||
fontRenderer.drawString(text, -textWidth / 2, yOffset, color);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDepthMask(true);
|
||||
fontRenderer.drawString(text, -textWidth / 2, yOffset, color);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* 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.client.texture;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public enum WirelessTextures {
|
||||
|
||||
WirelessConnectorWhite("WirelessConnectorOnWhite", "WirelessConnectorOffWhite"),
|
||||
WirelessConnectorOrange("WirelessConnectorOnOrange", "WirelessConnectorOffOrange"),
|
||||
WirelessConnectorMagenta("WirelessConnectorOnMagenta", "WirelessConnectorOffMagenta"),
|
||||
WirelessConnectorLightBlue("WirelessConnectorOnLightBlue", "WirelessConnectorOffLightBlue"),
|
||||
WirelessConnectorYellow("WirelessConnectorOnYellow", "WirelessConnectorOffYellow"),
|
||||
WirelessConnectorLime("WirelessConnectorOnLime", "WirelessConnectorOffLime"),
|
||||
WirelessConnectorPink("WirelessConnectorOnPink", "WirelessConnectorOffPink"),
|
||||
WirelessConnectorGrey("WirelessConnectorOnGrey", "WirelessConnectorOffGrey"),
|
||||
WirelessConnectorLightGrey("WirelessConnectorOnLightGrey", "WirelessConnectorOffLightGrey"),
|
||||
WirelessConnectorCyan("WirelessConnectorOnCyan", "WirelessConnectorOffCyan"),
|
||||
WirelessConnectorPurple("WirelessConnectorOnPurple", "WirelessConnectorOffPurple"),
|
||||
WirelessConnectorBlue("WirelessConnectorOnBlue", "WirelessConnectorOffBlue"),
|
||||
WirelessConnectorBrown("WirelessConnectorOnBrown", "WirelessConnectorOffBrown"),
|
||||
WirelessConnectorGreen("WirelessConnectorOnGreen", "WirelessConnectorOffGreen"),
|
||||
WirelessConnectorRed("WirelessConnectorOnRed", "WirelessConnectorOffRed"),
|
||||
WirelessConnectorBlack("WirelessConnectorOnBlack", "WirelessConnectorOffBlack"),
|
||||
WirelessConnectorTransparent("WirelessConnectorOnTransparent", "WirelessConnectorOffTransparent"),
|
||||
|
||||
WirelessHubWhite("WirelessHubOnWhite", "WirelessHubOffWhite"),
|
||||
WirelessHubOrange("WirelessHubOnOrange", "WirelessHubOffOrange"),
|
||||
WirelessHubMagenta("WirelessHubOnMagenta", "WirelessHubOffMagenta"),
|
||||
WirelessHubLightBlue("WirelessHubOnLightBlue", "WirelessHubOffLightBlue"),
|
||||
WirelessHubYellow("WirelessHubOnYellow", "WirelessHubOffYellow"),
|
||||
WirelessHubLime("WirelessHubOnLime", "WirelessHubOffLime"),
|
||||
WirelessHubPink("WirelessHubOnPink", "WirelessHubOffPink"),
|
||||
WirelessHubGrey("WirelessHubOnGrey", "WirelessHubOffGrey"),
|
||||
WirelessHubLightGrey("WirelessHubOnLightGrey", "WirelessHubOffLightGrey"),
|
||||
WirelessHubCyan("WirelessHubOnCyan", "WirelessHubOffCyan"),
|
||||
WirelessHubPurple("WirelessHubOnPurple", "WirelessHubOffPurple"),
|
||||
WirelessHubBlue("WirelessHubOnBlue", "WirelessHubOffBlue"),
|
||||
WirelessHubBrown("WirelessHubOnBrown", "WirelessHubOffBrown"),
|
||||
WirelessHubGreen("WirelessHubOnGreen", "WirelessHubOffGreen"),
|
||||
WirelessHubRed("WirelessHubOnRed", "WirelessHubOffRed"),
|
||||
WirelessHubBlack("WirelessHubOnBlack", "WirelessHubOffBlack"),
|
||||
WirelessHubTransparent("WirelessHubOnTransparent", "WirelessHubOffTransparent");
|
||||
|
||||
private final String onName;
|
||||
private final String offName;
|
||||
public IIcon onIIcon;
|
||||
public IIcon offIIcon;
|
||||
|
||||
WirelessTextures(final String onName, final String offName) {
|
||||
this.onName = onName;
|
||||
this.offName = offName;
|
||||
}
|
||||
|
||||
public static ResourceLocation GuiTexture(final String string) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon getMissing() {
|
||||
return TextureUtils.getMissingBlock();
|
||||
}
|
||||
|
||||
public String getOnName() {
|
||||
return this.onName;
|
||||
}
|
||||
|
||||
public String getOffName() {
|
||||
return this.offName;
|
||||
}
|
||||
|
||||
public IIcon getOnIcon() {
|
||||
return this.onIIcon;
|
||||
}
|
||||
|
||||
public IIcon getOffIcon() {
|
||||
return this.offIIcon;
|
||||
}
|
||||
|
||||
public void registerIcon(final TextureMap map) {
|
||||
this.onIIcon = map.registerIcon("appliedenergistics2:Wireless/Block" + this.onName);
|
||||
this.offIIcon = map.registerIcon("appliedenergistics2:Wireless/Block" + this.offName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.interfaces.IProgressProvider;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.tile.misc.TileAdvancedInscriber;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerAdvancedInscriber extends ContainerUpgradeable implements IProgressProvider {
|
||||
|
||||
private final TileAdvancedInscriber tile;
|
||||
|
||||
@GuiSync(2)
|
||||
public int maxProcessingTime = -1;
|
||||
|
||||
@GuiSync(3)
|
||||
public int processingTime = -1;
|
||||
|
||||
@GuiSync(7)
|
||||
public boolean topLocked = true;
|
||||
|
||||
@GuiSync(8)
|
||||
public boolean bottomLocked = true;
|
||||
|
||||
public ContainerAdvancedInscriber(final InventoryPlayer ip, final TileAdvancedInscriber te) {
|
||||
super(ip, te);
|
||||
this.tile = te;
|
||||
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE,
|
||||
this.tile,
|
||||
TileAdvancedInscriber.SLOT_TOP,
|
||||
45,
|
||||
16,
|
||||
this.getInventoryPlayer()));
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT,
|
||||
this.tile,
|
||||
TileAdvancedInscriber.SLOT_MIDDLE,
|
||||
63,
|
||||
39,
|
||||
this.getInventoryPlayer()));
|
||||
this.addSlotToContainer(
|
||||
new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE,
|
||||
this.tile,
|
||||
TileAdvancedInscriber.SLOT_BOTTOM,
|
||||
45,
|
||||
62,
|
||||
this.getInventoryPlayer()));
|
||||
|
||||
this.addSlotToContainer(new SlotOutput(this.tile, TileAdvancedInscriber.SLOT_OUTPUT, 113, 40, -1));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight() {
|
||||
return 176;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getToolboxY() {
|
||||
return 113;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
this.standardDetectAndSendChanges();
|
||||
|
||||
if (Platform.isServer()) {
|
||||
this.maxProcessingTime = this.tile.getMaxProcessingTime();
|
||||
this.processingTime = this.tile.getProcessingTime();
|
||||
this.topLocked = this.tile.isTopLocked();
|
||||
this.bottomLocked = this.tile.isBottomLocked();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentProgress() {
|
||||
return this.processingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxProgress() {
|
||||
return this.maxProcessingTime;
|
||||
}
|
||||
|
||||
public void setLock(final String slot, final boolean locked) {
|
||||
switch (slot) {
|
||||
case "top" -> this.tile.setTopLocked(locked);
|
||||
case "bottom" -> this.tile.setBottomLocked(locked);
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import appeng.container.slot.AppEngSlot;
|
||||
import appeng.tile.misc.TileCrystalGrowthChamber;
|
||||
|
||||
public class ContainerCrystalGrowthChamber extends ContainerUpgradeable {
|
||||
|
||||
private final TileCrystalGrowthChamber ti;
|
||||
|
||||
public ContainerCrystalGrowthChamber(final InventoryPlayer ip, final TileCrystalGrowthChamber te) {
|
||||
super(ip, te);
|
||||
ti = te;
|
||||
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 9; x++) {
|
||||
this.addSlotToContainer(new AppEngSlot(ti, x + y * 9, 8 + x * 18, 17 + y * 18) {
|
||||
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack is) {
|
||||
return ti.isItemValidForSlot(0, is);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight() {
|
||||
return 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* Overridden super.setupConfig to prevent setting up the fake slots
|
||||
*/
|
||||
protected void setupConfig() {
|
||||
setupUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades() {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
@@ -99,6 +99,7 @@ public abstract class ContainerUpgradeable extends AEBaseContainer implements IO
|
||||
int size = this.tbInventory.getSize();
|
||||
// For advanced toolbox to move down a little bit
|
||||
int yBias = size == 3 ? 0 : 7;
|
||||
int toolboxY = this.getToolboxY();
|
||||
for (int v = 0; v < size; v++) {
|
||||
for (int u = 0; u < size; u++) {
|
||||
this.addSlotToContainer(
|
||||
@@ -107,7 +108,7 @@ public abstract class ContainerUpgradeable extends AEBaseContainer implements IO
|
||||
this.tbInventory,
|
||||
u + v * size,
|
||||
186 + u * 18,
|
||||
this.getHeight() - 82 - yBias + v * 18,
|
||||
toolboxY - yBias + v * 18,
|
||||
this.getInventoryPlayer())).setPlayerSide());
|
||||
}
|
||||
}
|
||||
@@ -134,50 +135,24 @@ public abstract class ContainerUpgradeable extends AEBaseContainer implements IO
|
||||
return 184;
|
||||
}
|
||||
|
||||
protected int getToolboxY() {
|
||||
return this.getHeight() - 82;
|
||||
}
|
||||
|
||||
protected void setupConfig() {
|
||||
this.setupUpgrades();
|
||||
}
|
||||
|
||||
protected void setupUpgrades() {
|
||||
final IInventory upgrades = this.getUpgradeable().getInventoryByName("upgrades");
|
||||
if (this.availableUpgrades() > 0) {
|
||||
for (int slot = 0; slot < this.availableUpgrades(); slot++) {
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
0,
|
||||
slot,
|
||||
187,
|
||||
8,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
}
|
||||
if (this.availableUpgrades() > 1) {
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
1,
|
||||
187,
|
||||
8 + 18,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
}
|
||||
if (this.availableUpgrades() > 2) {
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
2,
|
||||
187,
|
||||
8 + 18 * 2,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
}
|
||||
if (this.availableUpgrades() > 3) {
|
||||
this.addSlotToContainer(
|
||||
(new SlotRestrictedInput(
|
||||
SlotRestrictedInput.PlacableItemType.UPGRADES,
|
||||
upgrades,
|
||||
3,
|
||||
187,
|
||||
8 + 18 * 3,
|
||||
8 + 18 * slot,
|
||||
this.getInventoryPlayer())).setNotDraggable());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,497 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.WirelessToolGroupBy;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.core.sync.packets.PacketWirelessToolData;
|
||||
import appeng.helpers.WireLessToolHelper;
|
||||
import appeng.helpers.WirelessKitCommand;
|
||||
import appeng.helpers.WirelessKitCommand.PinType;
|
||||
import appeng.helpers.WirelessKitCommand.SubCommand;
|
||||
import appeng.helpers.WirelessKitCommand.WirelessKitCommands;
|
||||
import appeng.helpers.WirelessToolDataObject;
|
||||
import appeng.items.contents.WirelessKitObject;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import appeng.tile.networking.TileWirelessConnector;
|
||||
import appeng.tile.networking.TileWirelessHub;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
|
||||
public class ContainerWirelessKit extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject {
|
||||
|
||||
private final WirelessKitObject toolInv;
|
||||
private final IConfigManager clientCM;
|
||||
private IConfigManager serverCM;
|
||||
private IConfigManagerHost gui;
|
||||
private final ArrayList<WirelessToolDataObject> data = new ArrayList<>();
|
||||
private final boolean isAEStaffLoaded = Loader.isModLoaded("ae2stuff");
|
||||
|
||||
public ContainerWirelessKit(final InventoryPlayer ip, final WirelessKitObject te) {
|
||||
super(ip, te);
|
||||
this.toolInv = te;
|
||||
|
||||
this.clientCM = new ConfigManager(this);
|
||||
|
||||
this.clientCM.registerSetting(Settings.WIRELESS_TOOL_GROUP_BY, WirelessToolGroupBy.Single);
|
||||
this.clientCM.registerSetting(Settings.WIRELESS_TOOL_HIDE_BOUNDED, YesNo.NO);
|
||||
|
||||
if (Platform.isServer()) {
|
||||
this.serverCM = te.getConfigManager();
|
||||
}
|
||||
|
||||
bindPlayerInventory(ip, -1000, -1000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges() {
|
||||
if (Platform.isServer()) {
|
||||
for (final Settings set : this.serverCM.getSettings()) {
|
||||
final Enum<?> sideLocal = this.serverCM.getSetting(set);
|
||||
final Enum<?> sideRemote = this.clientCM.getSetting(set);
|
||||
|
||||
if (sideLocal != sideRemote) {
|
||||
this.clientCM.putSetting(set, sideLocal);
|
||||
for (final Object crafter : this.crafters) {
|
||||
try {
|
||||
NetworkHandler.instance.sendTo(
|
||||
new PacketValueConfig(set.name(), sideLocal.name()),
|
||||
(EntityPlayerMP) crafter);
|
||||
} catch (final IOException e) {
|
||||
AELog.debug(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final ItemStack currentItem = this.getPlayerInv().getCurrentItem();
|
||||
|
||||
if (currentItem != this.toolInv.getItemStack()) {
|
||||
if (currentItem != null) {
|
||||
if (Platform.isSameItem(this.toolInv.getItemStack(), currentItem)) {
|
||||
this.getPlayerInv()
|
||||
.setInventorySlotContents(this.getPlayerInv().currentItem, this.toolInv.getItemStack());
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
} else {
|
||||
this.setValidContainer(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getTarget() {
|
||||
return this;
|
||||
}
|
||||
|
||||
private IConfigManagerHost getGui() {
|
||||
return this.gui;
|
||||
}
|
||||
|
||||
public void setGui(@Nonnull final IConfigManagerHost gui) {
|
||||
this.gui = gui;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
|
||||
if (this.getGui() != null) {
|
||||
this.getGui().updateSetting(manager, settingName, newValue);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
if (Platform.isServer()) {
|
||||
return this.serverCM;
|
||||
}
|
||||
return this.clientCM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting p_75132_1_) {
|
||||
super.addCraftingToCrafters(p_75132_1_);
|
||||
updateData();
|
||||
}
|
||||
|
||||
public void updateData() {
|
||||
final NBTTagCompound stash = toolInv.getItemStack().getTagCompound()
|
||||
.getCompoundTag(WireLessToolHelper.NbtSuper);
|
||||
final List<DimensionalCoord> dcl = DimensionalCoord
|
||||
.readAsListFromNBT(stash.getCompoundTag(WireLessToolHelper.NbtSuperPos));
|
||||
|
||||
World w = toolInv.getWorld();
|
||||
|
||||
data.clear();
|
||||
|
||||
for (final DimensionalCoord network : dcl) {
|
||||
if (w.provider.dimensionId == network.getDimension()
|
||||
&& w.getTileEntity(network.x, network.y, network.z) instanceof IGridHost gh) {
|
||||
final IGrid grid = gh.getGridNode(ForgeDirection.UNKNOWN).getGrid();
|
||||
if (grid == null) continue;
|
||||
for (IGridNode gn : grid.getMachines(TileWirelessConnector.class)) {
|
||||
TileWirelessBase wc = (TileWirelessBase) gn.getMachine();
|
||||
data.add(wc.getDataForTool(network));
|
||||
}
|
||||
|
||||
for (IGridNode gn : gh.getGridNode(ForgeDirection.UNKNOWN).getGrid()
|
||||
.getMachines(TileWirelessHub.class)) {
|
||||
TileWirelessHub wc = (TileWirelessHub) gn.getMachine();
|
||||
data.add(wc.getDataForTool(network));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
final NBTTagCompound nbtData = new NBTTagCompound();
|
||||
nbtData.setTag(
|
||||
WireLessToolHelper.NbtSuperPins,
|
||||
stash.getTagList(WireLessToolHelper.NbtSuperPins, NBT.TAG_COMPOUND));
|
||||
nbtData.setTag(
|
||||
WireLessToolHelper.NbtSuperNames,
|
||||
stash.getTagList(WireLessToolHelper.NbtSuperNames, NBT.TAG_COMPOUND));
|
||||
|
||||
if (!nbtData.hasNoTags()) {
|
||||
for (ICrafting crafter : this.crafters) {
|
||||
final EntityPlayerMP emp = (EntityPlayerMP) crafter;
|
||||
try {
|
||||
NetworkHandler.instance.sendTo(new PacketWirelessToolData(nbtData, this.data), emp);
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void processCommand(WirelessKitCommand command) {
|
||||
World w = toolInv.getWorld();
|
||||
NBTTagCompound stash = toolInv.getItemStack().getTagCompound().getCompoundTag(WireLessToolHelper.NbtSuper);
|
||||
switch (command.command) {
|
||||
case RENAME_SINGLE, RENAME_GROUP -> {
|
||||
switch (command.subCommand.groupBy) {
|
||||
case SINGLE -> {
|
||||
final DimensionalCoord coord = command.subCommand.coord;
|
||||
if (w.getTileEntity(coord.x, coord.y, coord.z) instanceof TileWirelessBase twc) {
|
||||
twc.setCustomName(command.name);
|
||||
}
|
||||
}
|
||||
|
||||
case COLOR, NETWORK -> {
|
||||
boolean noData = true;
|
||||
final boolean isColor = command.subCommand.groupBy == PinType.COLOR;
|
||||
final NBTTagList names = stash.getTagList(WireLessToolHelper.NbtSuperNames, 10);
|
||||
for (int i = 0; i < names.tagCount(); i++) {
|
||||
final NBTTagCompound name = names.getCompoundTagAt(i);
|
||||
|
||||
if (!command.subCommand.networkPos
|
||||
.equals(DimensionalCoord.readFromNBT(name.getCompoundTag("network"))))
|
||||
continue;
|
||||
|
||||
if (isColor) {
|
||||
if (name.hasKey("color")
|
||||
&& name.getInteger("color") == command.subCommand.color.ordinal()) {
|
||||
name.setString("colorName", command.name);
|
||||
noData = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!name.hasKey("color")) {
|
||||
name.setString("networkName", command.name);
|
||||
noData = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (noData) {
|
||||
final NBTTagCompound pin = new NBTTagCompound();
|
||||
final NBTTagCompound network = new NBTTagCompound();
|
||||
command.subCommand.networkPos.writeToNBT(network);
|
||||
pin.setTag("network", network);
|
||||
|
||||
if (isColor) {
|
||||
pin.setInteger("color", command.subCommand.color.ordinal());
|
||||
pin.setString("colorName", command.name);
|
||||
} else {
|
||||
pin.setString("networkName", command.name);
|
||||
|
||||
}
|
||||
|
||||
names.appendTag(pin);
|
||||
}
|
||||
stash.setTag("names", names);
|
||||
}
|
||||
}
|
||||
|
||||
updateData();
|
||||
}
|
||||
|
||||
case PIN -> {
|
||||
final NBTTagList tgl = stash.getTagList(WireLessToolHelper.NbtSuperPins, 10);
|
||||
for (int i = 0; i < tgl.tagCount(); i++) {
|
||||
final NBTTagCompound tag = tgl.getCompoundTagAt(i);
|
||||
final boolean isColor = command.subCommand.groupBy == PinType.COLOR;
|
||||
|
||||
switch (command.subCommand.groupBy) {
|
||||
case SINGLE -> {
|
||||
if (DimensionalCoord.readFromNBT(tag.getCompoundTag("coord"))
|
||||
.equals(command.subCommand.coord)) {
|
||||
tgl.removeTag(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
case NETWORK, COLOR -> {
|
||||
if (DimensionalCoord.readFromNBT(tag.getCompoundTag("network"))
|
||||
.equals(command.subCommand.networkPos)) {
|
||||
|
||||
if (isColor && tgl.getCompoundTagAt(i).getInteger("color")
|
||||
!= command.subCommand.color.ordinal())
|
||||
continue;
|
||||
|
||||
tgl.removeTag(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (command.pin) {
|
||||
final NBTTagCompound pin = new NBTTagCompound();
|
||||
final boolean isColor = command.subCommand.groupBy == PinType.COLOR;
|
||||
|
||||
switch (command.subCommand.groupBy) {
|
||||
case SINGLE -> {
|
||||
final NBTTagCompound coord = new NBTTagCompound();
|
||||
command.subCommand.coord.writeToNBT(coord);
|
||||
pin.setTag("coord", coord);
|
||||
}
|
||||
|
||||
case NETWORK, COLOR -> {
|
||||
final NBTTagCompound networkPos = new NBTTagCompound();
|
||||
command.subCommand.networkPos.writeToNBT(networkPos);
|
||||
pin.setTag("network", networkPos);
|
||||
|
||||
if (isColor) pin.setInteger("color", command.subCommand.color.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
pin.setInteger("type", command.subCommand.groupBy.ordinal());
|
||||
tgl.appendTag(pin);
|
||||
}
|
||||
}
|
||||
case DELETE -> {
|
||||
final NBTTagList pins = stash.getTagList(WireLessToolHelper.NbtSuperPins, 10);
|
||||
|
||||
// remove pin
|
||||
for (int i = 0; i < pins.tagCount(); i++) {
|
||||
final DimensionalCoord network = DimensionalCoord
|
||||
.readFromNBT(pins.getCompoundTagAt(i).getCompoundTag("network"));
|
||||
if (network.equals(command.networkPos)) {
|
||||
pins.removeTag(i);
|
||||
}
|
||||
}
|
||||
|
||||
final List<DimensionalCoord> networks = DimensionalCoord
|
||||
.readAsListFromNBT(stash.getCompoundTag(WireLessToolHelper.NbtSuperPos));
|
||||
networks.removeIf(network -> command.networkPos.equals(network));
|
||||
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(tag, networks);
|
||||
stash.setTag(WireLessToolHelper.NbtSuperPos, tag);
|
||||
|
||||
updateData();
|
||||
}
|
||||
case RECOLOR -> {
|
||||
for (final SubCommand subCommand : command.toBindRow) {
|
||||
switch (subCommand.groupBy) {
|
||||
case SINGLE -> {
|
||||
if (w.getTileEntity(
|
||||
subCommand.coord.x,
|
||||
subCommand.coord.y,
|
||||
subCommand.coord.z) instanceof TileWirelessBase tw) {
|
||||
if (!WireLessToolHelper
|
||||
.securityCheck(tw, new PlayerSource(this.getPlayerInv().player, null)))
|
||||
continue;
|
||||
if (subCommand.coord != null)
|
||||
tw.recolourBlock(ForgeDirection.UNKNOWN, command.color, this.getPlayerInv().player);
|
||||
else tw.madChameleonRecolor();
|
||||
}
|
||||
}
|
||||
|
||||
case NETWORK, COLOR -> {
|
||||
final boolean isColor = subCommand.groupBy == PinType.COLOR;
|
||||
for (WirelessToolDataObject sd : data) {
|
||||
if (!subCommand.networkPos.equals(sd.network)) continue;
|
||||
|
||||
if (!(w.getTileEntity(sd.cord.x, sd.cord.y, sd.cord.z) instanceof TileWirelessBase tw))
|
||||
continue;
|
||||
|
||||
if (!WireLessToolHelper
|
||||
.securityCheck(tw, new PlayerSource(this.getPlayerInv().player, null)))
|
||||
continue;
|
||||
|
||||
if (isColor) if (sd.color != subCommand.color) continue;
|
||||
if (subCommand.color != null) {
|
||||
tw.recolourBlock(ForgeDirection.UNKNOWN, command.color, this.getPlayerInv().player);
|
||||
} else {
|
||||
tw.madChameleonRecolor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
updateData();
|
||||
}
|
||||
case BIND -> {
|
||||
final List<TileWirelessBase> twToBind = this.fletchConnectors(false, command.toBindRow, w);
|
||||
final List<TileWirelessBase> twTarget = this.fletchConnectors(false, command.targetRow, w);
|
||||
|
||||
WireLessToolHelper.bindRows(twToBind, twTarget, this.getPlayerInv().player);
|
||||
|
||||
// Check if network was absorbed after bind and delete it if
|
||||
final List<DimensionalCoord> networks = DimensionalCoord
|
||||
.readAsListFromNBT(stash.getCompoundTag(WireLessToolHelper.NbtSuperPos));
|
||||
final ArrayList<IGrid> gList = new ArrayList<>();
|
||||
for (DimensionalCoord dc : networks) {
|
||||
if (w.getTileEntity(dc.x, dc.y, dc.z) instanceof IGridHost gh) {
|
||||
final IGrid newG = gh.getGridNode(ForgeDirection.UNKNOWN).getGrid();
|
||||
if (newG != null) {
|
||||
if (gList.contains(newG)) {
|
||||
final WirelessKitCommand nextCommand = new WirelessKitCommand(
|
||||
WirelessKitCommands.DELETE);
|
||||
nextCommand.setNetworkPos(dc);
|
||||
processCommand(nextCommand);
|
||||
} else {
|
||||
gList.add(newG);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final WirelessKitCommand nextCommand = new WirelessKitCommand(WirelessKitCommands.DELETE);
|
||||
nextCommand.setNetworkPos(dc);
|
||||
processCommand(nextCommand);
|
||||
}
|
||||
}
|
||||
|
||||
updateData();
|
||||
}
|
||||
case UNBIND -> {
|
||||
final List<DimensionalCoord> networks = DimensionalCoord
|
||||
.readAsListFromNBT((NBTTagCompound) stash.getTag(WireLessToolHelper.NbtSuperPos));
|
||||
final ArrayList<TileWirelessBase> unbounded = this.fletchConnectors(true, command.toBindRow, w);
|
||||
|
||||
for (final TileWirelessBase tw : unbounded) {
|
||||
boolean newNetwork = true;
|
||||
for (final DimensionalCoord dc : networks) {
|
||||
if (w.getTileEntity(dc.x, dc.y, dc.z) instanceof IGridHost gh) {
|
||||
try {
|
||||
final IGrid grid = gh.getGridNode(ForgeDirection.UNKNOWN).getGrid();
|
||||
if (tw.getProxy().getGrid().equals(grid)) {
|
||||
newNetwork = false;
|
||||
break;
|
||||
}
|
||||
} catch (Exception ignored) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (newNetwork) networks.add(tw.getLocation());
|
||||
}
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(tag, networks);
|
||||
stash.setTag(WireLessToolHelper.NbtSuperPos, tag);
|
||||
|
||||
updateData();
|
||||
}
|
||||
default -> {}
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<TileWirelessBase> fletchConnectors(final boolean unbind,
|
||||
final ArrayList<WirelessKitCommand.SubCommand> list, final World w) {
|
||||
final ArrayList<TileWirelessBase> connectors = new ArrayList<>();
|
||||
for (final SubCommand subCommand : list) {
|
||||
switch (subCommand.groupBy) {
|
||||
case SINGLE -> {
|
||||
if (w.getTileEntity(
|
||||
subCommand.coord.x,
|
||||
subCommand.coord.y,
|
||||
subCommand.coord.z) instanceof TileWirelessBase wc) {
|
||||
if (unbind) {
|
||||
connectors.addAll(wc.getConnectedTiles());
|
||||
WireLessToolHelper.breakConnection(wc, new PlayerSource(this.getPlayerInv().player, null));
|
||||
}
|
||||
connectors.add(wc);
|
||||
}
|
||||
}
|
||||
case NETWORK, COLOR -> {
|
||||
final DimensionalCoord network = subCommand.networkPos;
|
||||
final boolean isColor = subCommand.groupBy == PinType.COLOR;;
|
||||
if (w.getTileEntity(network.x, network.y, network.z) instanceof IGridHost gh) {
|
||||
if (subCommand.includeConnectors) {
|
||||
for (IGridNode gn : gh.getGridNode(ForgeDirection.UNKNOWN).getGrid()
|
||||
.getMachines(TileWirelessBase.class)) {
|
||||
TileWirelessBase wc = (TileWirelessBase) gn.getMachine();
|
||||
if (!wc.isLinked()) {
|
||||
if (isColor && wc.getColor() != subCommand.color) continue;
|
||||
if (unbind) {
|
||||
connectors.addAll(wc.getConnectedTiles());
|
||||
WireLessToolHelper.breakConnection(
|
||||
wc,
|
||||
new PlayerSource(this.getPlayerInv().player, null));
|
||||
}
|
||||
connectors.add(wc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (subCommand.includeHubs) {
|
||||
for (IGridNode gn : gh.getGridNode(ForgeDirection.UNKNOWN).getGrid()
|
||||
.getMachines(TileWirelessHub.class)) {
|
||||
TileWirelessHub wc = (TileWirelessHub) gn.getMachine();
|
||||
if (wc.getFreeSlots() > 0 || unbind) {
|
||||
if (isColor && wc.getColor() != subCommand.color) continue;
|
||||
if (unbind) {
|
||||
connectors.addAll(wc.getConnectedTiles());
|
||||
WireLessToolHelper.breakConnection(
|
||||
wc,
|
||||
new PlayerSource(this.getPlayerInv().player, null));
|
||||
}
|
||||
connectors.add(wc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return connectors;
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
private double WirelessBaseRange = 16;
|
||||
private double WirelessBoosterRangeMultiplier = 1;
|
||||
private double WirelessBoosterExp = 1.5;
|
||||
private double WirelessConnectorPowerBase = 1D;
|
||||
private double WirelessConnectorPowerDistanceMultiplier = .1D;
|
||||
public float visualiserWidthDense;
|
||||
public float visualiserWidthNormal;
|
||||
public int levelEmitterDelay = 40;
|
||||
public int craftingCalculatorVersion = 2;
|
||||
public int maxCraftingSteps = 2_000_000;
|
||||
@@ -228,6 +232,15 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
.getDouble(this.WirelessBoosterRangeMultiplier);
|
||||
this.WirelessBoosterExp = this.get("wireless", "WirelessBoosterExp", this.WirelessBoosterExp)
|
||||
.getDouble(this.WirelessBoosterExp);
|
||||
this.WirelessConnectorPowerBase = this
|
||||
.get("wireless", "WirelessConnectorPowerBase", this.WirelessConnectorPowerBase)
|
||||
.getDouble(this.WirelessConnectorPowerBase);
|
||||
this.WirelessConnectorPowerDistanceMultiplier = this
|
||||
.get(
|
||||
"wireless",
|
||||
"WirelessConnectorPowerDistanceMultiplier",
|
||||
this.WirelessConnectorPowerDistanceMultiplier)
|
||||
.getDouble(this.WirelessConnectorPowerDistanceMultiplier);
|
||||
this.WirelessTerminalDrainMultiplier = this
|
||||
.get("wireless", "WirelessTerminalDrainMultiplier", this.WirelessTerminalDrainMultiplier)
|
||||
.getDouble(this.WirelessTerminalDrainMultiplier);
|
||||
@@ -367,6 +380,8 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
.getBoolean(true);
|
||||
this.MEMonitorableSmallSize = this.get("Client", "MEMonitorableSmallSize", 6).getInt(6);
|
||||
this.InterfaceTerminalSmallSize = this.get("Client", "InterfaceTerminalSmallSize", 6).getInt(6);
|
||||
this.visualiserWidthDense = (float) this.get("Client", "visualiserWidthDense", 16f).getDouble(16f);
|
||||
this.visualiserWidthNormal = (float) this.get("Client", "visualiserWidthNormal", 4f).getDouble(4f);
|
||||
|
||||
// Pin options (under Client category)
|
||||
Property pMaxCraft = this.get("Client", "maxCraftingPinRows", this.maxCraftingPinRows);
|
||||
@@ -459,6 +474,14 @@ public final class AEConfig extends Configuration implements IConfigurableObject
|
||||
+ this.WirelessCostMultiplier * Math.pow(boosters, 1 + boosters / this.WirelessHighWirelessCount);
|
||||
}
|
||||
|
||||
public double getWirelessConnectorPowerBase() {
|
||||
return this.WirelessConnectorPowerBase;
|
||||
}
|
||||
|
||||
public double getWirelessConnectorPowerDistanceMultiplier() {
|
||||
return this.WirelessConnectorPowerDistanceMultiplier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property get(final String category, final String key, final String defaultValue, final String comment,
|
||||
final Property.Type type) {
|
||||
|
||||
@@ -43,6 +43,7 @@ import appeng.util.InvTweakSortingModule;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.ThEConvertor;
|
||||
import appeng.util.ae2fcConvertor;
|
||||
import appeng.util.ae2stuffConvertor;
|
||||
import baubles.api.expanded.BaubleExpandedSlots;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
@@ -216,6 +217,8 @@ public final class AppEng {
|
||||
NetworkHandler.instance = new NetworkHandler("AE2");
|
||||
|
||||
AELog.info("Post Initialization ( ended after " + start.elapsed(TimeUnit.MILLISECONDS) + "ms )");
|
||||
|
||||
if (Platform.isPosteaLoaded) new ae2stuffConvertor().run();
|
||||
}
|
||||
|
||||
@Mod.EventHandler
|
||||
|
||||
@@ -416,6 +416,7 @@ public final class Registration {
|
||||
target.blockGrindStone = this.converter.of(source.grindStone());
|
||||
target.blockCrankHandle = this.converter.of(source.crankHandle());
|
||||
target.blockInscriber = this.converter.of(source.inscriber());
|
||||
target.blockAdvancedInscriber = this.converter.of(source.advancedInscriber());
|
||||
target.blockWireless = this.converter.of(source.wireless());
|
||||
target.blockTinyTNT = this.converter.of(source.tinyTNT());
|
||||
|
||||
@@ -776,6 +777,10 @@ public final class Registration {
|
||||
|
||||
// Inscriber
|
||||
Upgrades.SPEED.registerItem(blocks.inscriber(), 3);
|
||||
Upgrades.SPEED.registerItem(blocks.advancedInscriber(), 5);
|
||||
|
||||
// Grower
|
||||
Upgrades.SPEED.registerItem(blocks.crystalGrowthChamber(), 3);
|
||||
|
||||
for (final Item wirelessTerminalItem : items.wirelessTerminal().maybeItem().asSet()) {
|
||||
registries.wireless().registerWirelessHandler((IWirelessTermHandler) wirelessTerminalItem);
|
||||
|
||||
@@ -29,9 +29,11 @@ import appeng.block.crafting.BlockMolecularAssembler;
|
||||
import appeng.block.crafting.BlockSingularityCraftingStorage;
|
||||
import appeng.block.grindstone.BlockCrank;
|
||||
import appeng.block.grindstone.BlockGrinder;
|
||||
import appeng.block.misc.BlockAdvancedInscriber;
|
||||
import appeng.block.misc.BlockCellWorkbench;
|
||||
import appeng.block.misc.BlockCharger;
|
||||
import appeng.block.misc.BlockCondenser;
|
||||
import appeng.block.misc.BlockCrystalGrowthChamber;
|
||||
import appeng.block.misc.BlockInscriber;
|
||||
import appeng.block.misc.BlockInterface;
|
||||
import appeng.block.misc.BlockLightDetector;
|
||||
@@ -52,6 +54,8 @@ import appeng.block.networking.BlockDenseEnergyCell;
|
||||
import appeng.block.networking.BlockEnergyAcceptor;
|
||||
import appeng.block.networking.BlockEnergyCell;
|
||||
import appeng.block.networking.BlockWireless;
|
||||
import appeng.block.networking.BlockWirelessConnector;
|
||||
import appeng.block.networking.BlockWirelessHub;
|
||||
import appeng.block.qnb.BlockQuantumLinkChamber;
|
||||
import appeng.block.qnb.BlockQuantumRing;
|
||||
import appeng.block.solids.BlockFluix;
|
||||
@@ -108,6 +112,7 @@ public final class ApiBlocks implements IBlocks {
|
||||
private final ITileDefinition grindStone;
|
||||
private final ITileDefinition crankHandle;
|
||||
private final ITileDefinition inscriber;
|
||||
private final ITileDefinition advancedInscriber;
|
||||
private final ITileDefinition wireless;
|
||||
private final ITileDefinition charger;
|
||||
private final IBlockDefinition tinyTNT;
|
||||
@@ -180,6 +185,10 @@ public final class ApiBlocks implements IBlocks {
|
||||
|
||||
private final Set<IOrientableBlock> orientables;
|
||||
|
||||
private final ITileDefinition wirelessConnector;
|
||||
private final ITileDefinition wirelessHub;
|
||||
private final ITileDefinition crystalGrowthChamber;
|
||||
|
||||
public ApiBlocks(final DefinitionConstructor constructor) {
|
||||
final BlockLightDetector lightDetector = new BlockLightDetector();
|
||||
final BlockQuartzPillar quartzPillar = new BlockQuartzPillar();
|
||||
@@ -208,6 +217,7 @@ public final class ApiBlocks implements IBlocks {
|
||||
this.grindStone = constructor.registerTileDefinition(new BlockGrinder());
|
||||
this.crankHandle = constructor.registerTileDefinition(new BlockCrank());
|
||||
this.inscriber = constructor.registerTileDefinition(new BlockInscriber());
|
||||
this.advancedInscriber = constructor.registerTileDefinition(new BlockAdvancedInscriber());
|
||||
this.wireless = constructor.registerTileDefinition(new BlockWireless());
|
||||
this.charger = constructor.registerTileDefinition(new BlockCharger());
|
||||
this.tinyTNT = constructor.registerBlockDefinition(new BlockTinyTNT());
|
||||
@@ -332,6 +342,9 @@ public final class ApiBlocks implements IBlocks {
|
||||
this.chunkLoader = constructor.registerBlockDefinition(new BlockChunkloader());
|
||||
this.phantomNode = constructor.registerBlockDefinition(new BlockPhantomNode());
|
||||
this.cubeGenerator = constructor.registerBlockDefinition(new BlockCubeGenerator());
|
||||
this.wirelessConnector = constructor.registerTileDefinition(new BlockWirelessConnector());
|
||||
this.wirelessHub = constructor.registerTileDefinition(new BlockWirelessHub());
|
||||
this.crystalGrowthChamber = constructor.registerTileDefinition(new BlockCrystalGrowthChamber());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -494,6 +507,11 @@ public final class ApiBlocks implements IBlocks {
|
||||
return this.inscriber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition advancedInscriber() {
|
||||
return this.advancedInscriber;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition wireless() {
|
||||
return this.wireless;
|
||||
@@ -730,6 +748,21 @@ public final class ApiBlocks implements IBlocks {
|
||||
return this.patternOptimizationMatrix;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition wirelessConnector() {
|
||||
return this.wirelessConnector;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition wirelessHub() {
|
||||
return this.wirelessHub;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITileDefinition crystalGrowthChamber() {
|
||||
return this.crystalGrowthChamber;
|
||||
}
|
||||
|
||||
public IBlockDefinition chunkLoader() {
|
||||
return this.chunkLoader;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,9 @@ import appeng.items.tools.ToolAdvancedNetworkTool;
|
||||
import appeng.items.tools.ToolBiometricCard;
|
||||
import appeng.items.tools.ToolMemoryCard;
|
||||
import appeng.items.tools.ToolNetworkTool;
|
||||
import appeng.items.tools.ToolNetworkVisualiser;
|
||||
import appeng.items.tools.ToolPriorityCard;
|
||||
import appeng.items.tools.ToolWirelessKit;
|
||||
import appeng.items.tools.powered.ToolChargedStaff;
|
||||
import appeng.items.tools.powered.ToolColorApplicator;
|
||||
import appeng.items.tools.powered.ToolEntropyManipulator;
|
||||
@@ -123,6 +125,9 @@ public final class ApiItems implements IItems {
|
||||
private final IItemDefinition toolDebugCard;
|
||||
private final IItemDefinition toolReplicatorCard;
|
||||
|
||||
private final IItemDefinition toolNetworkVisualiser;
|
||||
private final IItemDefinition toolWirelessKit;
|
||||
|
||||
public ApiItems(final DefinitionConstructor constructor) {
|
||||
this.certusQuartzAxe = constructor.registerItemDefinition(new ToolQuartzAxe(AEFeature.CertusQuartzTools));
|
||||
this.certusQuartzHoe = constructor.registerItemDefinition(new ToolQuartzHoe(AEFeature.CertusQuartzTools));
|
||||
@@ -199,6 +204,8 @@ public final class ApiItems implements IItems {
|
||||
this.toolMeteoritePlacer = constructor.registerItemDefinition(new ToolMeteoritePlacer());
|
||||
this.toolDebugCard = constructor.registerItemDefinition(new ToolDebugCard());
|
||||
this.toolReplicatorCard = constructor.registerItemDefinition(new ToolReplicatorCard());
|
||||
this.toolNetworkVisualiser = constructor.registerItemDefinition(new ToolNetworkVisualiser());
|
||||
this.toolWirelessKit = constructor.registerItemDefinition(new ToolWirelessKit());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -451,6 +458,16 @@ public final class ApiItems implements IItems {
|
||||
return this.coloredLumenPaintBall;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition toolWirelessKit() {
|
||||
return this.toolWirelessKit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IItemDefinition toolNetworkVisualiser() {
|
||||
return this.toolNetworkVisualiser;
|
||||
}
|
||||
|
||||
public IItemDefinition paintBall() {
|
||||
return this.paintBall;
|
||||
}
|
||||
|
||||
@@ -291,7 +291,32 @@ public enum ButtonToolTips implements Localization {
|
||||
|
||||
ToggleShowHiddenInterfaces,
|
||||
ToggleShowHiddenInterfacesOnDesc,
|
||||
ToggleShowHiddenInterfacesOffDesc;
|
||||
ToggleShowHiddenInterfacesOffDesc,
|
||||
|
||||
WirelessToolGroupBySingleName,
|
||||
WirelessToolGroupBySingleDesc,
|
||||
WirelessToolGroupByNetworkName,
|
||||
WirelessToolGroupByNetworkDesc,
|
||||
WirelessToolGroupByColorName,
|
||||
WirelessToolGroupByColorDesc,
|
||||
WirelessToolHideBoundedYesName,
|
||||
WirelessToolHideBoundedYesDesc,
|
||||
WirelessToolHideBoundedNoName,
|
||||
WirelessToolHideBoundedNoDesc,
|
||||
WirelessKitPinButtonName,
|
||||
WirelessKitPinButtonDesc,
|
||||
WirelessKitMadChameleonRecolorName,
|
||||
WirelessKitMadChameleonRecolorDesc,
|
||||
WirelessKitIncludeConnectorsName,
|
||||
WirelessKitIncludeConnectorsDesc,
|
||||
WirelessKitIncludeHubsName,
|
||||
WirelessKitIncludeHubsDesc,
|
||||
WirelessKitDeleteName,
|
||||
WirelessKitDeleteDesc,
|
||||
WirelessKitBindName,
|
||||
WirelessKitBindDesc,
|
||||
WirelessKitUnbindName,
|
||||
WirelessKitUnbindDesc;
|
||||
|
||||
ButtonToolTips() {}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ package appeng.core.localization;
|
||||
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.core.AELog;
|
||||
|
||||
public enum GuiColors implements Localization {
|
||||
@@ -218,7 +219,29 @@ public enum GuiColors implements Localization {
|
||||
ReshuffleTooltipSecondary(0xAAAAAA),
|
||||
ReshuffleTooltipDimmed(0x555555),
|
||||
|
||||
ReshuffleToggleDisabledOverlay(0x80000000);
|
||||
ReshuffleToggleDisabledOverlay(0x80000000),
|
||||
|
||||
ColorButtonOutline(0xFF404040),
|
||||
|
||||
WirelessKitGood(AEColor.Lime.mediumVariant),
|
||||
WirelessKitNeutral(AEColor.Orange.mediumVariant),
|
||||
WirelessKitBad(AEColor.Red.mediumVariant),
|
||||
|
||||
NetworkVisualiserFloatingText(0xffffffff),
|
||||
NetworkVisualiserNodeMissing(0xffff0000),
|
||||
NetworkVisualiserNodeDense(0xffffff00),
|
||||
NetworkVisualiserNodeProxy(0xffffa500),
|
||||
NetworkVisualiserNodeDefault(0xff0000ff),
|
||||
|
||||
NetworkVisualiserLinkCompressed(0xffff00ff),
|
||||
NetworkVisualiserLinkDense(0xffffff00),
|
||||
NetworkVisualiserLinkProxy(0xffffa500),
|
||||
NetworkVisualiserLinkDefault(0xff0000ff),
|
||||
|
||||
GuiAeButtonUnderline(0xFF000000),
|
||||
GuiAeButtonLineBeforeUnderlineDefault(0xFF565656),
|
||||
GuiAeButtonLineBeforeUnderlineHover(0xFF5C669D),
|
||||
GuiAeButtonLineBeforeUnderlineDisabled(0xFF2C2C2C);
|
||||
|
||||
private final int color;
|
||||
|
||||
|
||||
@@ -77,6 +77,10 @@ public enum GuiText implements Localization {
|
||||
CraftingTerminal,
|
||||
FormationPlane,
|
||||
Inscriber,
|
||||
AdvancedInscriber,
|
||||
AdvancedInscriberLockOn,
|
||||
AdvancedInscriberLockOff,
|
||||
AdvancedInscriberLockNote,
|
||||
QuartzCuttingKnife,
|
||||
|
||||
PatternOptimizer,
|
||||
@@ -369,7 +373,19 @@ public enum GuiText implements Localization {
|
||||
ReshuffleReportTextColorPositive,
|
||||
ReshuffleReportTextColorNegative,
|
||||
ReshuffleReportTextColorNeutral,
|
||||
ReshuffleReportTextColorWarning,;
|
||||
ReshuffleReportTextColorWarning,
|
||||
|
||||
GuiWirelessKitColor,
|
||||
GuiWirelessKitNetwork,
|
||||
GuiWirelessKitSelfPos,
|
||||
GuiWirelessKitTargetPos,
|
||||
GuiWirelessKitChannelsUsage,
|
||||
GuiWirelessKitNameFieldDesc,
|
||||
|
||||
GuiDimensionalCoord,
|
||||
GuiDimensionalCoordShort,
|
||||
GuiDimensionalCoordNoDim,
|
||||
GuiDimensionalCoordShortNoDim;
|
||||
|
||||
private final String root;
|
||||
|
||||
|
||||
@@ -56,7 +56,16 @@ public enum PlayerMessages implements Localization {
|
||||
StorageHighlighted,
|
||||
PickBlockTerminalNotFound,
|
||||
PatternRepeaterProvider,
|
||||
PatternRepeaterAccessor;
|
||||
PatternRepeaterAccessor,
|
||||
|
||||
WirelessHighlighted,
|
||||
WirelessInOtherDim,
|
||||
|
||||
WirelessGroupHighlighted,
|
||||
WirelessGroupInOtherDim,
|
||||
WirelessHighlighterPrefix,
|
||||
WirelessHighlighterNetworkPrefix,
|
||||
WirelessHighlighterColorPrefix;
|
||||
|
||||
@Deprecated // kept for backward compat
|
||||
public IChatComponent get() {
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package appeng.core.localization;
|
||||
|
||||
public enum WirelessMessages implements Localization {
|
||||
|
||||
Security,
|
||||
DimensionMismatch,
|
||||
BoundAdvancedFilled,
|
||||
Connected,
|
||||
Disconnected,
|
||||
InvalidTarget,
|
||||
Failed,
|
||||
Cleared,
|
||||
Mode,
|
||||
ModeToggle,
|
||||
SetMode,
|
||||
|
||||
rowBindSuccess,
|
||||
rowBindInvalidSource,
|
||||
rowBindInvalidTarget,
|
||||
rowBindFailed,
|
||||
|
||||
SourceHubFull,
|
||||
TargetHubFull,
|
||||
HubToHub,
|
||||
|
||||
Simple,
|
||||
SimpleEmpty,
|
||||
SimpleBound,
|
||||
SimpleBounded,
|
||||
|
||||
Advanced,
|
||||
AdvancedNext,
|
||||
AdvancedHowToggle,
|
||||
AdvancedActivated,
|
||||
|
||||
AdvancedQueueing,
|
||||
AdvancedQueued,
|
||||
AdvancedNoConnectors,
|
||||
AdvancedQueueEmpty,
|
||||
AdvancedQueueNotEmpty,
|
||||
AdvancedQueueingHub,
|
||||
AdvancedQueueingHubQol,
|
||||
AdvancedQueueingTargetHubFull,
|
||||
|
||||
AdvancedBinding,
|
||||
AdvancedBindingHub,
|
||||
AdvancedBindingHubQol,
|
||||
AdvancedBindingEmpty,
|
||||
AdvancedBindingNotEmpty,
|
||||
|
||||
AdvancedQueueingLine,
|
||||
AdvancedBindingLine,
|
||||
AdvancedQueueingLineNotEmpty,
|
||||
|
||||
AdvancedLine1st,
|
||||
AdvancedLine2nd,
|
||||
AdvancedLineEmpty1st,
|
||||
AdvancedLineEmpty2nd,
|
||||
|
||||
AdvancedLine1stAdded,
|
||||
AdvancedLine2ndAdded,
|
||||
|
||||
AdvancedLineNotLine,
|
||||
AdvancedLineReset,
|
||||
|
||||
Super,
|
||||
SuperBound,
|
||||
SuperBoundFailed,
|
||||
SuperClear,
|
||||
SuperNetworkList,
|
||||
SuperNetwork,
|
||||
SuperNetworkListEmpty;
|
||||
|
||||
public String getUnlocalized() {
|
||||
return "item.appliedenergistics2.WirelessMessages." + this.name();
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@ import appeng.core.sync.packets.PacketMultiPart;
|
||||
import appeng.core.sync.packets.PacketNEIBookmark;
|
||||
import appeng.core.sync.packets.PacketNEIRecipe;
|
||||
import appeng.core.sync.packets.PacketNetworkStatusSelected;
|
||||
import appeng.core.sync.packets.PacketNetworkVisualiserData;
|
||||
import appeng.core.sync.packets.PacketNewStorageDimension;
|
||||
import appeng.core.sync.packets.PacketOptimizePatterns;
|
||||
import appeng.core.sync.packets.PacketPaintedEntity;
|
||||
@@ -62,6 +63,8 @@ import appeng.core.sync.packets.PacketToggleInterfaceVisibility;
|
||||
import appeng.core.sync.packets.PacketTransitionEffect;
|
||||
import appeng.core.sync.packets.PacketValueConfig;
|
||||
import appeng.core.sync.packets.PacketVirtualSlot;
|
||||
import appeng.core.sync.packets.PacketWirelessToolCommand;
|
||||
import appeng.core.sync.packets.PacketWirelessToolData;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class AppEngPacketHandlerBase {
|
||||
@@ -143,7 +146,10 @@ public class AppEngPacketHandlerBase {
|
||||
PACKET_COLOR_SELECT(PacketColorSelect.class),
|
||||
PACKET_REMOTE_RENAME(PacketRemoteRename.class),
|
||||
PACKET_SPATIAL_ACTION(PacketSpatialAction.class),
|
||||
PACKET_TOGGLE_INTERFACE_VISIBILITY(PacketToggleInterfaceVisibility.class);
|
||||
PACKET_TOGGLE_INTERFACE_VISIBILITY(PacketToggleInterfaceVisibility.class),
|
||||
PACKET_NETWORK_VISUALISER_DATA(PacketNetworkVisualiserData.class),
|
||||
PACKET_SUPER_WIRELESS_TOOL_DATA(PacketWirelessToolData.class),
|
||||
PACKET_SUPER_WIRELESS_TOOL_COMMAND(PacketWirelessToolCommand.class);
|
||||
|
||||
private final Class<? extends AppEngPacket> packetClass;
|
||||
private final Constructor<? extends AppEngPacket> packetConstructor;
|
||||
|
||||
@@ -33,6 +33,7 @@ import appeng.api.definitions.IMaterials;
|
||||
import appeng.api.exceptions.AppEngException;
|
||||
import appeng.api.features.IWirelessTermHandler;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.api.implementations.guiobjects.IPortableCell;
|
||||
import appeng.api.implementations.tiles.ICellWorkbench;
|
||||
@@ -55,6 +56,7 @@ import appeng.client.gui.GuiNull;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.ContainerOpenContext;
|
||||
import appeng.container.implementations.ContainerAdvancedInscriber;
|
||||
import appeng.container.implementations.ContainerAdvancedNetworkTool;
|
||||
import appeng.container.implementations.ContainerBusIO;
|
||||
import appeng.container.implementations.ContainerCellRestriction;
|
||||
@@ -66,6 +68,7 @@ import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.container.implementations.ContainerCraftingStatus;
|
||||
import appeng.container.implementations.ContainerCraftingTerm;
|
||||
import appeng.container.implementations.ContainerCrystalGrowthChamber;
|
||||
import appeng.container.implementations.ContainerDrive;
|
||||
import appeng.container.implementations.ContainerFormationPlane;
|
||||
import appeng.container.implementations.ContainerGrinder;
|
||||
@@ -99,6 +102,7 @@ import appeng.container.implementations.ContainerStorageBus;
|
||||
import appeng.container.implementations.ContainerStorageReshuffle;
|
||||
import appeng.container.implementations.ContainerVibrationChamber;
|
||||
import appeng.container.implementations.ContainerWireless;
|
||||
import appeng.container.implementations.ContainerWirelessKit;
|
||||
import appeng.core.stats.Achievements;
|
||||
import appeng.helpers.ICellRestriction;
|
||||
import appeng.helpers.ICustomNameObject;
|
||||
@@ -113,7 +117,9 @@ import appeng.parts.automation.PartSharedItemBus;
|
||||
import appeng.tile.crafting.TileCraftingTile;
|
||||
import appeng.tile.crafting.TileMolecularAssembler;
|
||||
import appeng.tile.grindstone.TileGrinder;
|
||||
import appeng.tile.misc.TileAdvancedInscriber;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.tile.misc.TileCrystalGrowthChamber;
|
||||
import appeng.tile.misc.TileInscriber;
|
||||
import appeng.tile.misc.TileSecurity;
|
||||
import appeng.tile.misc.TileStorageReshuffle;
|
||||
@@ -210,6 +216,8 @@ public enum GuiBridge implements IGuiHandler {
|
||||
|
||||
GUI_INSCRIBER(ContainerInscriber.class, TileInscriber.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_ADVANCED_INSCRIBER(ContainerAdvancedInscriber.class, TileAdvancedInscriber.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_CELL_WORKBENCH(ContainerCellWorkbench.class, ICellWorkbench.class, GuiHostType.WORLD, null),
|
||||
|
||||
GUI_MAC(ContainerMAC.class, TileMolecularAssembler.class, GuiHostType.WORLD, null),
|
||||
@@ -236,7 +244,12 @@ public enum GuiBridge implements IGuiHandler {
|
||||
|
||||
GUI_ORE_FILTER(ContainerOreFilter.class, IOreFilterable.class, GuiHostType.ITEM_OR_WORLD, null),
|
||||
|
||||
GUI_CELL_RESTRICTION(ContainerCellRestriction.class, ICellRestriction.class, GuiHostType.ITEM_OR_WORLD, null);
|
||||
GUI_CELL_RESTRICTION(ContainerCellRestriction.class, ICellRestriction.class, GuiHostType.ITEM_OR_WORLD, null),
|
||||
|
||||
GUI_CRYSTAL_GROWTH_CHAMBER(ContainerCrystalGrowthChamber.class, TileCrystalGrowthChamber.class, GuiHostType.WORLD,
|
||||
null),
|
||||
|
||||
GUI_SUPER_WIRELESS_KIT(ContainerWirelessKit.class, IGuiItemObject.class, GuiHostType.ITEM, null);
|
||||
|
||||
private final Class tileClass;
|
||||
private final Class containerClass;
|
||||
|
||||
@@ -62,7 +62,7 @@ public class PacketCraftingItemInterface extends AppEngPacket {
|
||||
data.writeInt(this.getPacketID());
|
||||
data.writeBoolean(false);
|
||||
data.writeBoolean(true);
|
||||
NamedDimensionalCoord.writeListToPacket(data, this.interfaceLocations);
|
||||
NamedDimensionalCoord.writeListToPacketNamed(data, this.interfaceLocations);
|
||||
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.client.render.NetworkVisualiserRender;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VLink;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VLinkFlags;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VNode;
|
||||
import appeng.items.tools.ToolNetworkVisualiser.VNodeFlags;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
public class PacketNetworkVisualiserData extends AppEngPacket {
|
||||
|
||||
private final ArrayList<VNode> vNodeSet;
|
||||
private final ArrayList<VLink> vLinkSet;
|
||||
|
||||
// automatic.
|
||||
public PacketNetworkVisualiserData(final ByteBuf stream) throws IOException {
|
||||
int vNodeCount = stream.readInt();
|
||||
int vLinkCount = stream.readInt();
|
||||
|
||||
this.vNodeSet = new ArrayList<>();
|
||||
for (int i = 0; i < vNodeCount; i++) {
|
||||
int x = stream.readInt();
|
||||
int y = stream.readInt();
|
||||
int z = stream.readInt();
|
||||
int flagsCount = stream.readInt();
|
||||
|
||||
EnumSet<VNodeFlags> flags = EnumSet.noneOf(VNodeFlags.class);
|
||||
for (int j = 0; j < flagsCount; j++) {
|
||||
int flag = stream.readInt();
|
||||
flags.add(VNodeFlags.values()[flag]);
|
||||
}
|
||||
this.vNodeSet.add(new VNode(x, y, z, flags));
|
||||
}
|
||||
|
||||
this.vLinkSet = new ArrayList<>();
|
||||
for (int i = 0; i < vLinkCount; i++) {
|
||||
int n1 = stream.readInt();
|
||||
int n2 = stream.readInt();
|
||||
int c = stream.readInt();
|
||||
int flagsCount = stream.readInt();
|
||||
|
||||
EnumSet<VLinkFlags> flags = EnumSet.noneOf(VLinkFlags.class);
|
||||
for (int j = 0; j < flagsCount; j++) {
|
||||
int flag = stream.readInt();
|
||||
flags.add(VLinkFlags.values()[flag]);
|
||||
}
|
||||
this.vLinkSet.add(new VLink(this.vNodeSet.get(n1), this.vNodeSet.get(n2), c, flags));
|
||||
}
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketNetworkVisualiserData(ArrayList<VNode> vNodeSet, ArrayList<VLink> vLinkSet) throws IOException {
|
||||
this.vNodeSet = vNodeSet;
|
||||
this.vLinkSet = vLinkSet;
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
data.writeInt(this.getPacketID());
|
||||
|
||||
data.writeInt(vNodeSet.size());
|
||||
data.writeInt(vLinkSet.size());
|
||||
|
||||
for (VNode node : vNodeSet) {
|
||||
data.writeInt(node.x);
|
||||
data.writeInt(node.y);
|
||||
data.writeInt(node.z);
|
||||
data.writeInt(node.flags.size());
|
||||
for (VNodeFlags f : node.flags) {
|
||||
data.writeInt(f.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
for (VLink vl : vLinkSet) {
|
||||
data.writeInt(vNodeSet.indexOf(vl.node1));
|
||||
data.writeInt(vNodeSet.indexOf(vl.node2));
|
||||
data.writeInt(vl.channels);
|
||||
data.writeInt(vl.flags.size());
|
||||
for (VLinkFlags f : vl.flags) {
|
||||
data.writeInt(f.ordinal());
|
||||
}
|
||||
}
|
||||
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
||||
NetworkVisualiserRender.networkVisualiser(this.vNodeSet, this.vLinkSet);
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.PrimaryGui;
|
||||
import appeng.container.implementations.ContainerAdvancedInscriber;
|
||||
import appeng.container.implementations.ContainerCellWorkbench;
|
||||
import appeng.container.implementations.ContainerCraftConfirm;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
@@ -107,6 +108,11 @@ public class PacketValueConfig extends AppEngPacket {
|
||||
case "Reshuffle.Scan" -> qk.performNetworkScan();
|
||||
case "Reshuffle.View" -> qk.setView(this.Value);
|
||||
}
|
||||
} else if (this.Name.equals("AdvancedInscriber.Lock") && c instanceof final ContainerAdvancedInscriber qk) {
|
||||
final String[] parts = this.Value.split(":", 2);
|
||||
if (parts.length == 2) {
|
||||
qk.setLock(parts[0], Boolean.parseBoolean(parts[1]));
|
||||
}
|
||||
} else if (this.Name.equals("Interface.DoublePatterns") && c instanceof final ContainerInterface qk) {
|
||||
qk.doublePatterns(Integer.parseInt(this.Value));
|
||||
} else if (this.Name.startsWith("TileCrafting.") && c instanceof final ContainerCraftingCPU qk) {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
import appeng.container.implementations.ContainerWirelessKit;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.WirelessKitCommand;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
public class PacketWirelessToolCommand extends AppEngPacket {
|
||||
|
||||
private final WirelessKitCommand command;
|
||||
|
||||
public PacketWirelessToolCommand(final ByteBuf stream) throws IOException {
|
||||
this.command = WirelessKitCommand.read(stream);
|
||||
}
|
||||
|
||||
public PacketWirelessToolCommand(final WirelessKitCommand newCommand) throws IOException {
|
||||
this.command = newCommand;
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt(this.getPacketID());
|
||||
|
||||
newCommand.write(data);
|
||||
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serverPacketData(INetworkInfo manager, AppEngPacket packet, EntityPlayer player) {
|
||||
if (player.openContainer instanceof ContainerWirelessKit swk) swk.processCommand(this.command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package appeng.core.sync.packets;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import appeng.client.gui.implementations.GuiWirelessKit;
|
||||
import appeng.core.sync.AppEngPacket;
|
||||
import appeng.core.sync.network.INetworkInfo;
|
||||
import appeng.helpers.WirelessToolDataObject;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.Unpooled;
|
||||
|
||||
public class PacketWirelessToolData extends AppEngPacket {
|
||||
|
||||
private final NBTTagCompound nData;
|
||||
private final ArrayList<WirelessToolDataObject> wData;
|
||||
|
||||
// automatic.
|
||||
public PacketWirelessToolData(final ByteBuf stream) throws IOException {
|
||||
this.nData = ByteBufUtils.readTag(stream);
|
||||
this.wData = WirelessToolDataObject.readAsList(stream);
|
||||
}
|
||||
|
||||
// api
|
||||
public PacketWirelessToolData(final NBTTagCompound nData, final ArrayList<WirelessToolDataObject> wData)
|
||||
throws IOException {
|
||||
this.nData = nData;
|
||||
this.wData = wData;
|
||||
|
||||
final ByteBuf data = Unpooled.buffer();
|
||||
|
||||
data.writeInt(this.getPacketID());
|
||||
|
||||
ByteBufUtils.writeTag(data, nData);
|
||||
|
||||
WirelessToolDataObject.writeAsList(wData, data);
|
||||
|
||||
this.configureWrite(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void clientPacketData(final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player) {
|
||||
final GuiScreen gs = Minecraft.getMinecraft().currentScreen;
|
||||
if (gs instanceof GuiWirelessKit gsw) gsw.setData(this.nData, this.wData);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,566 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import static appeng.items.tools.ToolWirelessKit.getConfigManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.AdvancedWirelessToolMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.WirelessToolMode;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.security.BaseActionSource;
|
||||
import appeng.api.networking.security.PlayerSource;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.localization.WirelessMessages;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class WireLessToolHelper {
|
||||
|
||||
public enum BindResult {
|
||||
INVALID_SOURCE,
|
||||
SUCCESS,
|
||||
INVALID_TARGET,
|
||||
FAILED,
|
||||
ALREADY_BIND
|
||||
}
|
||||
|
||||
public final static String NbtSimple = "Simple";
|
||||
|
||||
public final static String NbtAdvanced = "Advanced";
|
||||
public final static String NbtAdvancedLineQueue = "advancedLineQueue";
|
||||
public final static String NbtAdvancedLineBinding = "advancedLineBinding";
|
||||
public final static String NbtAdvanced1StPoint = "1stPoint";
|
||||
public final static String NbtAdvanced2ndPoint = "2ndPoint";
|
||||
|
||||
public final static String NbtSuper = "Super";
|
||||
public final static String NbtSuperPins = "pins";
|
||||
public final static String NbtSuperNames = "names";
|
||||
public final static String NbtSuperPos = "pos";
|
||||
|
||||
public static void nextToolMode(EntityPlayer p, IConfigManager cm) {
|
||||
final WirelessToolMode newState = (WirelessToolMode) Platform.rotateEnum(
|
||||
cm.getSetting(Settings.WIRELESS_TOOL_MODE),
|
||||
false,
|
||||
Settings.WIRELESS_TOOL_MODE.getPossibleValues());
|
||||
cm.putSetting(Settings.WIRELESS_TOOL_MODE, newState);
|
||||
|
||||
p.addChatMessage(WirelessMessages.SetMode.toChat(newState.getLocal()));
|
||||
}
|
||||
|
||||
public static void nextConnectMode(IConfigManager cm, EntityPlayer p) {
|
||||
final AdvancedWirelessToolMode newState = (AdvancedWirelessToolMode) Platform.rotateEnum(
|
||||
cm.getSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE),
|
||||
false,
|
||||
Settings.ADVANCED_WIRELESS_TOOL_MODE.getPossibleValues());
|
||||
cm.putSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE, newState);
|
||||
|
||||
p.addChatMessage(new ChatComponentTranslation(newState.getLocal()));
|
||||
}
|
||||
|
||||
public static WirelessToolMode getMode(ItemStack is) {
|
||||
final IConfigManager cm = getConfigManager(is);
|
||||
return (WirelessToolMode) cm.getSetting(Settings.WIRELESS_TOOL_MODE);
|
||||
}
|
||||
|
||||
public static AdvancedWirelessToolMode getConnectMode(ItemStack stack) {
|
||||
IConfigManager cm = getConfigManager(stack);
|
||||
return ((AdvancedWirelessToolMode) cm.getSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE));
|
||||
}
|
||||
|
||||
public static void newNBT(ItemStack is) {
|
||||
is.setTagCompound(new NBTTagCompound());
|
||||
clearNBT(is, WirelessToolMode.Simple, null);
|
||||
clearNBT(is, WirelessToolMode.Advanced, null);
|
||||
clearNBT(is, WirelessToolMode.Super, null);
|
||||
}
|
||||
|
||||
public static void clearNBT(ItemStack is, WirelessToolMode mode, @Nullable EntityPlayer p) {
|
||||
final NBTTagCompound tag = is.getTagCompound();
|
||||
switch (mode) {
|
||||
case Simple -> tag.setTag(NbtSimple, new NBTTagCompound());
|
||||
case Advanced -> {
|
||||
tag.setTag(NbtAdvanced, new NBTTagCompound());
|
||||
tag.setTag(NbtAdvancedLineQueue, new NBTTagCompound());
|
||||
tag.setTag(NbtAdvancedLineBinding, new NBTTagCompound());
|
||||
}
|
||||
case Super -> {
|
||||
NBTTagCompound newTag = new NBTTagCompound();
|
||||
newTag.setTag(NbtSuperPins, new NBTTagList());
|
||||
newTag.setTag(NbtSuperNames, new NBTTagList());
|
||||
newTag.setTag(NbtSuperPos, new NBTTagCompound());
|
||||
tag.setTag(NbtSuper, newTag);
|
||||
}
|
||||
}
|
||||
if (p != null) p.addChatMessage(WirelessMessages.Cleared.toChat(mode.getLocal()));
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static TileWirelessBase getAndCheckTile(DimensionalCoord dc, World w, @Nullable EntityPlayer p) {
|
||||
if (dc == null) {
|
||||
if (p != null) p.addChatMessage(WirelessMessages.InvalidTarget.toChat());
|
||||
return null;
|
||||
}
|
||||
|
||||
if (dc.getDimension() != w.provider.dimensionId) {
|
||||
if (p != null) p.addChatMessage(WirelessMessages.DimensionMismatch.toChat());
|
||||
return null;
|
||||
}
|
||||
|
||||
final TileEntity te = w.getTileEntity(dc.x, dc.y, dc.z);
|
||||
if (te instanceof TileWirelessBase twb) return twb;
|
||||
|
||||
if (p != null) p.addChatMessage(WirelessMessages.InvalidTarget.toChat());
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean securityCheck(TileWirelessBase source, BaseActionSource actionSource) {
|
||||
if (!Platform.canAccess(source.getProxy(), actionSource)) {
|
||||
if (actionSource instanceof PlayerSource ps) ps.player.addChatMessage(WirelessMessages.Security.toChat());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static BindResult securityCheck(TileWirelessBase target, TileWirelessBase source,
|
||||
BaseActionSource actionSource) {
|
||||
final boolean securitySource = !Platform.canAccess(source.getProxy(), actionSource);
|
||||
final boolean securityTarget = !Platform.canAccess(target.getProxy(), actionSource);
|
||||
|
||||
if (securitySource || securityTarget) {
|
||||
if (actionSource instanceof PlayerSource ps) ps.player.addChatMessage(WirelessMessages.Security.toChat());
|
||||
if (securitySource && securityTarget) return BindResult.FAILED;
|
||||
if (securitySource) return BindResult.INVALID_SOURCE;
|
||||
return BindResult.INVALID_TARGET;
|
||||
}
|
||||
|
||||
return BindResult.SUCCESS;
|
||||
}
|
||||
|
||||
public static BindResult performConnection(TileWirelessBase target, TileWirelessBase source,
|
||||
BaseActionSource actionSource) {
|
||||
return performConnection(target, source, actionSource, true);
|
||||
}
|
||||
|
||||
public static BindResult performConnection(TileWirelessBase target, TileWirelessBase source,
|
||||
BaseActionSource actionSource, boolean sendMessages) {
|
||||
if (target.getLocation().getDimension() != source.getLocation().getDimension()) {
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.DimensionMismatch.toChat());
|
||||
return BindResult.FAILED;
|
||||
}
|
||||
|
||||
final BindResult securityCheck = securityCheck(target, source, actionSource);
|
||||
if (securityCheck != BindResult.SUCCESS) return securityCheck;
|
||||
|
||||
if (target.isHub() && !target.canAddLink()) {
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.TargetHubFull.toChat());
|
||||
return BindResult.INVALID_TARGET;
|
||||
}
|
||||
|
||||
if (source.isHub() && !source.canAddLink()) {
|
||||
final DimensionalCoord loc = source.getLocation();
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.SourceHubFull.toChat(loc.getGuiTextShortNoDim()));
|
||||
return BindResult.INVALID_SOURCE;
|
||||
}
|
||||
|
||||
if (source.isHub() && target.isHub()) {
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.HubToHub.toChat());
|
||||
return BindResult.INVALID_SOURCE;
|
||||
}
|
||||
|
||||
if (!target.isHub()) target.doUnlink();
|
||||
if (!source.isHub()) source.doUnlink();
|
||||
|
||||
final BindResult result = target.doLink(source);
|
||||
switch (result) {
|
||||
case SUCCESS -> {
|
||||
final DimensionalCoord dc = source.getLocation();
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.Connected.toChat(dc.getGuiTextShortNoDim()));
|
||||
}
|
||||
|
||||
case FAILED, INVALID_TARGET, INVALID_SOURCE -> {
|
||||
if (sendMessages && actionSource instanceof PlayerSource ps)
|
||||
ps.player.addChatMessage(WirelessMessages.Failed.toChat());
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void breakConnection(TileWirelessBase source, BaseActionSource actionSource) {
|
||||
source.getConnectedTiles().forEach(t -> {
|
||||
final BindResult securityCheck = securityCheck(t, source, actionSource);
|
||||
if (securityCheck == BindResult.SUCCESS) WireLessToolHelper.breakConnection(t, source, actionSource);
|
||||
if (actionSource instanceof PlayerSource ps) ps.player.addChatMessage(
|
||||
WirelessMessages.Disconnected.toChat(
|
||||
source.getLocation().getGuiTextShortNoDim(),
|
||||
t.getLocation().getGuiTextShortNoDim()));
|
||||
});
|
||||
}
|
||||
|
||||
public static void breakConnection(TileWirelessBase target, TileWirelessBase source,
|
||||
BaseActionSource actionSource) {
|
||||
final BindResult securityCheck = securityCheck(target, source, actionSource);
|
||||
if (securityCheck != BindResult.SUCCESS) return;
|
||||
target.doUnlink(source);
|
||||
if (actionSource instanceof PlayerSource ps) ps.player.addChatMessage(
|
||||
WirelessMessages.Disconnected.toChat(
|
||||
source.getLocation().getGuiTextShortNoDim(),
|
||||
target.getLocation().getGuiTextShortNoDim()));
|
||||
}
|
||||
|
||||
public static boolean bindSimple(TileWirelessBase target, ItemStack tool, World w, EntityPlayer p) {
|
||||
NBTTagCompound tag = tool.getTagCompound().getCompoundTag(NbtSimple);
|
||||
final PlayerSource playerSource = new PlayerSource(p, null);
|
||||
|
||||
if (!securityCheck(target, playerSource)) return false;
|
||||
|
||||
if (tag.hasNoTags()) {
|
||||
if (target.isHub() && !target.canAddLink()) {
|
||||
p.addChatMessage(WirelessMessages.TargetHubFull.toChat());
|
||||
return false;
|
||||
}
|
||||
|
||||
DimensionalCoord dc = target.getLocation();
|
||||
dc.writeToNBT(tag);
|
||||
tool.getTagCompound().setTag(NbtSimple, tag);
|
||||
p.addChatMessage(WirelessMessages.SimpleBound.toChat(dc.getGuiTextShortNoDim()));
|
||||
return true;
|
||||
}
|
||||
|
||||
final DimensionalCoord sourceLocation = DimensionalCoord.readFromNBT(tag);
|
||||
|
||||
if (sourceLocation.getDimension() != w.provider.dimensionId) {
|
||||
p.addChatMessage(WirelessMessages.DimensionMismatch.toChat());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (target.getLocation().isEqual(sourceLocation)) {
|
||||
tool.getTagCompound().setTag(NbtSimple, new NBTTagCompound());
|
||||
return true;
|
||||
}
|
||||
|
||||
TileWirelessBase tile = getAndCheckTile(sourceLocation, w, p);
|
||||
if (tile == null) {
|
||||
tool.getTagCompound().setTag(NbtSimple, new NBTTagCompound());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!securityCheck(tile, playerSource)) {
|
||||
tool.getTagCompound().setTag(NbtSimple, new NBTTagCompound());
|
||||
return false;
|
||||
}
|
||||
|
||||
final BindResult result = performConnection(target, tile, playerSource);
|
||||
tool.getTagCompound().setTag(NbtSimple, new NBTTagCompound());
|
||||
return result == BindResult.SUCCESS;
|
||||
}
|
||||
|
||||
private static boolean isLine(DimensionalCoord firstPoint, DimensionalCoord secondPoint) {
|
||||
int line = 0;
|
||||
if (firstPoint.equals(secondPoint)) return false;
|
||||
if (firstPoint.x != secondPoint.x) line++;
|
||||
if (firstPoint.y != secondPoint.y) line++;
|
||||
if (firstPoint.z != secondPoint.z) line++;
|
||||
|
||||
return line == 1;
|
||||
}
|
||||
|
||||
private static boolean addLine(TileWirelessBase target, ItemStack tool, EntityPlayer p, String nbtKey) {
|
||||
final NBTTagCompound tag = tool.getTagCompound().getCompoundTag(nbtKey);
|
||||
if (tag.hasKey(NbtAdvanced1StPoint)) {
|
||||
if (tag.hasKey(NbtAdvanced2ndPoint)) {
|
||||
p.addChatMessage(WirelessMessages.AdvancedLineReset.toChat());
|
||||
} else {
|
||||
final DimensionalCoord firstPoint = DimensionalCoord
|
||||
.readFromNBT(tag.getCompoundTag(NbtAdvanced1StPoint));
|
||||
final DimensionalCoord secondPoint = target.getLocation();
|
||||
if (isLine(firstPoint, secondPoint)) {
|
||||
final NBTTagCompound secondPointTag = new NBTTagCompound();
|
||||
secondPoint.writeToNBT(secondPointTag);
|
||||
tag.setTag(NbtAdvanced2ndPoint, secondPointTag);
|
||||
tool.getTagCompound().setTag(nbtKey, tag);
|
||||
|
||||
p.addChatMessage(WirelessMessages.AdvancedLine2ndAdded.toChat(secondPoint.getGuiTextShortNoDim()));
|
||||
return true;
|
||||
} else {
|
||||
p.addChatMessage(WirelessMessages.AdvancedLineNotLine.toChat());
|
||||
tool.getTagCompound().removeTag(nbtKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final NBTTagCompound NbtFirstPoint = new NBTTagCompound();
|
||||
final DimensionalCoord firstPoint = target.getLocation();
|
||||
firstPoint.writeToNBT(NbtFirstPoint);
|
||||
tag.setTag(NbtAdvanced1StPoint, NbtFirstPoint);
|
||||
tool.getTagCompound().setTag(nbtKey, tag);
|
||||
|
||||
p.addChatMessage(WirelessMessages.AdvancedLine1stAdded.toChat(firstPoint.getGuiTextShortNoDim()));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean addToQueueLine(TileWirelessBase target, ItemStack tool, EntityPlayer p) {
|
||||
return addLine(target, tool, p, NbtAdvancedLineQueue);
|
||||
}
|
||||
|
||||
private static boolean addToQueue(TileWirelessBase target, ItemStack tool, EntityPlayer p) {
|
||||
List<DimensionalCoord> locList = DimensionalCoord
|
||||
.readAsListFromNBT(tool.getTagCompound().getCompoundTag(NbtAdvanced));
|
||||
|
||||
DimensionalCoord targetLoc = target.getLocation();
|
||||
boolean isHub = target.isHub();
|
||||
|
||||
if (!target.canAddLink()) {
|
||||
p.addChatMessage(WirelessMessages.TargetHubFull.toChat());
|
||||
return false;
|
||||
} else if (!isHub) { // if not a hub, check if not already in the queue
|
||||
for (DimensionalCoord loc : locList) {
|
||||
if (targetLoc.isEqual(loc)) {
|
||||
p.addChatMessage(WirelessMessages.BoundAdvancedFilled.toChat());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Platform.keyBindLCtrl.isKeyDown(p) && isHub) {
|
||||
int i = 0;
|
||||
while (i < target.getFreeSlots()) {
|
||||
locList.add(new DimensionalCoord(target));
|
||||
i++;
|
||||
}
|
||||
p.addChatMessage(WirelessMessages.AdvancedQueueingHub.toChat(i));
|
||||
} else {
|
||||
locList.add(new DimensionalCoord(target));
|
||||
p.addChatMessage(WirelessMessages.AdvancedQueued.toChat(targetLoc.getGuiTextShortNoDim()));
|
||||
}
|
||||
|
||||
final NBTTagCompound tag = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(tag, locList);
|
||||
tool.getTagCompound().setTag(NbtAdvanced, tag);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static List<TileWirelessBase> getLine(DimensionalCoord firstPoint, DimensionalCoord secondPoint, World w) {
|
||||
final List<TileWirelessBase> tiles = new ArrayList<>();
|
||||
if (firstPoint.x != secondPoint.x) {
|
||||
final int size = Math.abs(firstPoint.x - secondPoint.x) + 1;
|
||||
final boolean direction = firstPoint.x < secondPoint.x;
|
||||
for (int i = 0; i < size; i++) {
|
||||
final DimensionalCoord next = new DimensionalCoord(firstPoint);
|
||||
next.x = direction ? firstPoint.x + i : firstPoint.x - i;
|
||||
|
||||
if (w.getTileEntity(next.x, next.y, next.z) instanceof TileWirelessBase twb) tiles.add(twb);
|
||||
}
|
||||
} else if (firstPoint.y != secondPoint.y) {
|
||||
final int size = Math.abs(firstPoint.y - secondPoint.y);
|
||||
final boolean direction = firstPoint.y < secondPoint.y;
|
||||
for (int i = 0; i < size; i++) {
|
||||
final DimensionalCoord next = new DimensionalCoord(firstPoint);
|
||||
next.y = direction ? firstPoint.y + i : firstPoint.y - i;
|
||||
|
||||
if (w.getTileEntity(next.x, next.y, next.z) instanceof TileWirelessBase twb) tiles.add(twb);
|
||||
}
|
||||
} else if (firstPoint.z != secondPoint.z) {
|
||||
final int size = Math.abs(firstPoint.z - secondPoint.z);
|
||||
final boolean direction = firstPoint.z < secondPoint.z;
|
||||
for (int i = 0; i < size; i++) {
|
||||
final DimensionalCoord next = new DimensionalCoord(firstPoint);
|
||||
next.z = direction ? firstPoint.z + i : firstPoint.z - i;
|
||||
|
||||
if (w.getTileEntity(next.x, next.y, next.z) instanceof TileWirelessBase twb) tiles.add(twb);
|
||||
}
|
||||
}
|
||||
|
||||
return tiles;
|
||||
}
|
||||
|
||||
private static boolean bindFromQueueLine(TileWirelessBase target, ItemStack tool, World w, EntityPlayer p) {
|
||||
final NBTTagCompound tagQueue = tool.getTagCompound().getCompoundTag(NbtAdvancedLineQueue);
|
||||
final NBTTagCompound tagBind = tool.getTagCompound().getCompoundTag(NbtAdvancedLineBinding);
|
||||
if (tagQueue.hasKey(NbtAdvanced1StPoint) && tagQueue.hasKey(NbtAdvanced2ndPoint)) {
|
||||
if (tagBind.hasKey(NbtAdvanced1StPoint)) {
|
||||
addLine(target, tool, p, NbtAdvancedLineBinding);
|
||||
|
||||
final DimensionalCoord firstPointQueue = DimensionalCoord
|
||||
.readFromNBT(tagQueue.getCompoundTag(NbtAdvanced1StPoint));
|
||||
final DimensionalCoord secondPointQueue = DimensionalCoord
|
||||
.readFromNBT(tagQueue.getCompoundTag(NbtAdvanced2ndPoint));
|
||||
|
||||
final DimensionalCoord firstPointBind = DimensionalCoord
|
||||
.readFromNBT(tagBind.getCompoundTag(NbtAdvanced1StPoint));
|
||||
final DimensionalCoord secondPointBind = DimensionalCoord
|
||||
.readFromNBT(tagBind.getCompoundTag(NbtAdvanced2ndPoint));
|
||||
|
||||
final List<TileWirelessBase> twToBind = getLine(firstPointQueue, secondPointQueue, w);
|
||||
final List<TileWirelessBase> twTarget = getLine(firstPointBind, secondPointBind, w);
|
||||
|
||||
bindRows(twToBind, twTarget, p);
|
||||
|
||||
tool.getTagCompound().removeTag(NbtAdvancedLineQueue);
|
||||
tool.getTagCompound().removeTag(NbtAdvancedLineBinding);
|
||||
} else {
|
||||
return addLine(target, tool, p, NbtAdvancedLineBinding);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean bindFromQueue(TileWirelessBase target, ItemStack tool, World w, EntityPlayer p) {
|
||||
List<DimensionalCoord> locList = DimensionalCoord
|
||||
.readAsListFromNBT(tool.getTagCompound().getCompoundTag(NbtAdvanced));
|
||||
if (locList.isEmpty()) {
|
||||
p.addChatMessage(WirelessMessages.AdvancedNoConnectors.toChat());
|
||||
return false;
|
||||
}
|
||||
|
||||
final PlayerSource playerSource = new PlayerSource(p, null);
|
||||
final boolean bindMultiple = Platform.keyBindLCtrl.isKeyDown(p) && target.isHub();
|
||||
boolean success = false;
|
||||
int boundCount = 0;
|
||||
|
||||
if (bindMultiple && !target.canAddLink()) {
|
||||
p.addChatMessage(WirelessMessages.TargetHubFull.toChat());
|
||||
return false;
|
||||
}
|
||||
|
||||
while (!locList.isEmpty()) {
|
||||
final DimensionalCoord sourceLocation = locList.get(0);
|
||||
|
||||
if (sourceLocation.getDimension() != w.provider.dimensionId) {
|
||||
p.addChatMessage(WirelessMessages.DimensionMismatch.toChat());
|
||||
break;
|
||||
}
|
||||
|
||||
if (target.getLocation().isEqual(sourceLocation)) {
|
||||
locList.remove(0);
|
||||
success = true;
|
||||
} else {
|
||||
final TileWirelessBase tile = getAndCheckTile(sourceLocation, w, p);
|
||||
if (tile == null) {
|
||||
locList.remove(0);
|
||||
} else if (!securityCheck(tile, playerSource)) {
|
||||
locList.remove(0);
|
||||
} else {
|
||||
final BindResult result = performConnection(target, tile, playerSource);
|
||||
locList.remove(0);
|
||||
if (result == BindResult.SUCCESS) {
|
||||
boundCount++;
|
||||
success = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!bindMultiple || !target.canAddLink()) break;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(tag, locList);
|
||||
tool.getTagCompound().setTag(NbtAdvanced, tag);
|
||||
|
||||
if (bindMultiple) p.addChatMessage(WirelessMessages.AdvancedBindingHub.toChat(boundCount));
|
||||
return success;
|
||||
}
|
||||
|
||||
public static boolean bindAdvanced(TileWirelessBase target, ItemStack tool, World w, EntityPlayer p) {
|
||||
if (!securityCheck(target, new PlayerSource(p, null))) return false;
|
||||
|
||||
AdvancedWirelessToolMode mod = (AdvancedWirelessToolMode) getConfigManager(tool)
|
||||
.getSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE);
|
||||
|
||||
return switch (mod) {
|
||||
case Queueing -> addToQueue(target, tool, p);
|
||||
case Binding -> bindFromQueue(target, tool, w, p);
|
||||
case QueueingLine -> addToQueueLine(target, tool, p);
|
||||
case BindingLine -> bindFromQueueLine(target, tool, w, p);
|
||||
};
|
||||
}
|
||||
|
||||
public static void bindRows(List<TileWirelessBase> twToBind, List<TileWirelessBase> twTarget, EntityPlayer p) {
|
||||
if (twToBind.isEmpty() || twTarget.isEmpty()) return;
|
||||
|
||||
int i = 0;
|
||||
int ii = 0;
|
||||
toBind: while (twToBind.size() > i && twTarget.size() > ii) {
|
||||
while (twTarget.get(ii).getFreeSlots() > 0) {
|
||||
final TileWirelessBase source = twToBind.get(ii);
|
||||
final TileWirelessBase target = twTarget.get(i);
|
||||
switch (WireLessToolHelper.performConnection(source, target, new PlayerSource(p, null))) {
|
||||
case SUCCESS -> {
|
||||
p.addChatMessage(
|
||||
WirelessMessages.rowBindSuccess.toChat(
|
||||
source.getLocation().getGuiTextShortNoDim(),
|
||||
target.getLocation().getGuiTextShortNoDim()));
|
||||
i++;
|
||||
if (!(twToBind.size() > i)) break toBind;
|
||||
}
|
||||
|
||||
case INVALID_TARGET -> {
|
||||
p.addChatMessage(
|
||||
WirelessMessages.rowBindInvalidTarget
|
||||
.toChat(target.getLocation().getGuiTextShortNoDim()));
|
||||
ii++;
|
||||
}
|
||||
case INVALID_SOURCE -> {
|
||||
p.addChatMessage(
|
||||
WirelessMessages.rowBindInvalidSource
|
||||
.toChat(target.getLocation().getGuiTextShortNoDim()));
|
||||
i++;
|
||||
}
|
||||
case FAILED -> {
|
||||
p.addChatMessage(
|
||||
WirelessMessages.rowBindFailed.toChat(target.getLocation().getGuiTextShortNoDim()));
|
||||
i++;
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ii++;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean bindSuper(TileEntity target, ItemStack tool, World w, EntityPlayer p) {
|
||||
if (!tool.getTagCompound().hasKey(NbtSuper)) clearNBT(tool, WirelessToolMode.Super, null);
|
||||
|
||||
final NBTTagCompound tag = tool.getTagCompound().getCompoundTag(NbtSuper).getCompoundTag(NbtSuperPos);
|
||||
final List<DimensionalCoord> locList = DimensionalCoord.readAsListFromNBT(tag);
|
||||
for (DimensionalCoord dc : locList) {
|
||||
TileEntity TempTe = w.getTileEntity(dc.x, dc.y, dc.z);
|
||||
if (TempTe instanceof IGridHost tile && target instanceof IGridHost gh) {
|
||||
if (gh.getGridNode(ForgeDirection.UNKNOWN).getGrid()
|
||||
== tile.getGridNode(ForgeDirection.UNKNOWN).getGrid()) {
|
||||
p.addChatMessage(WirelessMessages.SuperBoundFailed.toChat());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
DimensionalCoord targetLoc = new DimensionalCoord(target);
|
||||
p.addChatMessage(WirelessMessages.SuperBound.toChat(targetLoc.getGuiTextShortNoDim()));
|
||||
locList.add(targetLoc);
|
||||
DimensionalCoord.writeListToNBT(tag, locList);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,194 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class WirelessKitCommand {
|
||||
|
||||
public enum WirelessKitCommands {
|
||||
BIND,
|
||||
UNBIND,
|
||||
PIN,
|
||||
DELETE,
|
||||
RENAME_SINGLE,
|
||||
RENAME_GROUP,
|
||||
RECOLOR
|
||||
}
|
||||
|
||||
public enum PinType {
|
||||
SINGLE,
|
||||
COLOR,
|
||||
NETWORK
|
||||
}
|
||||
|
||||
public static class SubCommand {
|
||||
|
||||
public DimensionalCoord coord = null;
|
||||
public DimensionalCoord networkPos = null;
|
||||
public boolean includeConnectors = false;
|
||||
public boolean includeHubs = false;
|
||||
public AEColor color = null;
|
||||
public PinType groupBy = null;
|
||||
|
||||
public void write(ByteBuf buf) {
|
||||
if (this.coord != null) {
|
||||
buf.writeBoolean(true);
|
||||
this.coord.writeToPacket(buf);
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
if (this.networkPos != null) {
|
||||
buf.writeBoolean(true);
|
||||
this.networkPos.writeToPacket(buf);
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
buf.writeBoolean(this.includeConnectors);
|
||||
buf.writeBoolean(this.includeHubs);
|
||||
|
||||
if (this.color != null) {
|
||||
buf.writeBoolean(true);
|
||||
buf.writeInt(this.color.ordinal());
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
if (this.groupBy != null) {
|
||||
buf.writeBoolean(true);
|
||||
buf.writeInt(this.groupBy.ordinal());
|
||||
} else buf.writeBoolean(false);
|
||||
}
|
||||
|
||||
public static SubCommand read(ByteBuf buf) {
|
||||
SubCommand cmd = new SubCommand();
|
||||
if (buf.readBoolean()) cmd.setCoord(DimensionalCoord.readFromPacket(buf));
|
||||
if (buf.readBoolean()) cmd.setNetworkPos(DimensionalCoord.readFromPacket(buf));
|
||||
if (buf.readBoolean()) cmd.includeConnectors();
|
||||
if (buf.readBoolean()) cmd.includeHubs();
|
||||
if (buf.readBoolean()) cmd.setColor(AEColor.values()[buf.readInt()]);
|
||||
if (buf.readBoolean()) cmd.setGroupBy(PinType.values()[buf.readInt()]);
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
public void setCoord(DimensionalCoord coord) {
|
||||
this.coord = coord;
|
||||
}
|
||||
|
||||
public void setNetworkPos(DimensionalCoord networkPos) {
|
||||
this.networkPos = networkPos;
|
||||
}
|
||||
|
||||
public void includeConnectors() {
|
||||
this.includeConnectors = true;
|
||||
}
|
||||
|
||||
public void includeHubs() {
|
||||
this.includeHubs = true;
|
||||
}
|
||||
|
||||
public void setColor(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void setGroupBy(PinType groupBy) {
|
||||
this.groupBy = groupBy;
|
||||
}
|
||||
}
|
||||
|
||||
public final WirelessKitCommands command;
|
||||
public String name = "";
|
||||
public AEColor color = null;
|
||||
public DimensionalCoord networkPos = null;
|
||||
public boolean pin = false;
|
||||
public SubCommand subCommand = null;
|
||||
public final ArrayList<SubCommand> toBindRow = new ArrayList<>();
|
||||
public final ArrayList<SubCommand> targetRow = new ArrayList<>();
|
||||
|
||||
public WirelessKitCommand(WirelessKitCommands command) {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public void write(ByteBuf buf) {
|
||||
buf.writeInt(this.command.ordinal());
|
||||
ByteBufUtils.writeUTF8String(buf, this.name);
|
||||
|
||||
if (this.color != null) {
|
||||
buf.writeBoolean(true);
|
||||
buf.writeInt(this.color.ordinal());
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
if (this.networkPos != null) {
|
||||
buf.writeBoolean(true);
|
||||
this.networkPos.writeToPacket(buf);
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
buf.writeBoolean(this.pin);
|
||||
|
||||
if (this.subCommand != null) {
|
||||
buf.writeBoolean(true);
|
||||
this.subCommand.write(buf);
|
||||
} else buf.writeBoolean(false);
|
||||
|
||||
buf.writeInt(this.toBindRow.size());
|
||||
this.toBindRow.forEach(cmd -> cmd.write(buf));
|
||||
|
||||
buf.writeInt(this.targetRow.size());
|
||||
this.targetRow.forEach(cmd -> cmd.write(buf));
|
||||
}
|
||||
|
||||
public static WirelessKitCommand read(ByteBuf buf) {
|
||||
final WirelessKitCommand command = new WirelessKitCommand(WirelessKitCommands.values()[buf.readInt()]);
|
||||
command.setName(ByteBufUtils.readUTF8String(buf));
|
||||
|
||||
if (buf.readBoolean()) command.setColor(AEColor.values()[buf.readInt()]);
|
||||
if (buf.readBoolean()) command.setNetworkPos(DimensionalCoord.readFromPacket(buf));
|
||||
final boolean pin = buf.readBoolean();
|
||||
if (buf.readBoolean()) {
|
||||
final SubCommand subCommand = SubCommand.read(buf);
|
||||
if (pin) command.setPinCommand(subCommand);
|
||||
else command.setCommand(subCommand);
|
||||
}
|
||||
|
||||
final int toBindRowSize = buf.readInt();
|
||||
for (int i = 0; i < toBindRowSize; i++) {
|
||||
command.toBindRow.add(SubCommand.read(buf));
|
||||
}
|
||||
|
||||
final int targetRowSize = buf.readInt();
|
||||
for (int i = 0; i < targetRowSize; i++) {
|
||||
command.targetRow.add(SubCommand.read(buf));
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setNetworkPos(DimensionalCoord networkPos) {
|
||||
this.networkPos = networkPos;
|
||||
}
|
||||
|
||||
public void setColor(AEColor color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public void addToBind(SubCommand subCommand) {
|
||||
this.toBindRow.add(subCommand);
|
||||
}
|
||||
|
||||
public void addTarget(SubCommand subCommand) {
|
||||
this.targetRow.add(subCommand);
|
||||
}
|
||||
|
||||
public void setCommand(SubCommand SubCommand) {
|
||||
this.subCommand = SubCommand;
|
||||
}
|
||||
|
||||
public void setPinCommand(SubCommand SubCommand) {
|
||||
this.pin = true;
|
||||
this.subCommand = SubCommand;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package appeng.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public class WirelessToolDataObject {
|
||||
|
||||
public final DimensionalCoord network;
|
||||
public final String customName;
|
||||
public final DimensionalCoord cord;
|
||||
public boolean isConnected;
|
||||
public final List<DimensionalCoord> targets;
|
||||
public final AEColor color;
|
||||
public final int channels;
|
||||
public final boolean isHub;
|
||||
public final int slots;
|
||||
|
||||
public WirelessToolDataObject(DimensionalCoord network, String name, DimensionalCoord cord, boolean isConnected,
|
||||
List<DimensionalCoord> targets, AEColor color, int channels, boolean isHub, int slots) {
|
||||
this.network = network;
|
||||
this.customName = name;
|
||||
this.cord = cord;
|
||||
this.isConnected = isConnected;
|
||||
this.targets = targets;
|
||||
this.color = color;
|
||||
this.channels = channels;
|
||||
this.isHub = isHub;
|
||||
this.slots = slots;
|
||||
}
|
||||
|
||||
public void write(ByteBuf buf) {
|
||||
this.network.writeToPacket(buf);
|
||||
ByteBufUtils.writeUTF8String(buf, this.customName);
|
||||
this.cord.writeToPacket(buf);
|
||||
buf.writeBoolean(this.isConnected);
|
||||
buf.writeBoolean(this.isHub);
|
||||
|
||||
buf.writeInt(this.targets.size());
|
||||
this.targets.forEach((dc) -> dc.writeToPacket(buf));
|
||||
|
||||
buf.writeInt(this.color.ordinal());
|
||||
buf.writeInt(this.channels);
|
||||
buf.writeInt(this.slots);
|
||||
}
|
||||
|
||||
public static WirelessToolDataObject read(ByteBuf buf) {
|
||||
final DimensionalCoord network = DimensionalCoord.readFromPacket(buf);
|
||||
final String customName = ByteBufUtils.readUTF8String(buf);
|
||||
final DimensionalCoord coord = DimensionalCoord.readFromPacket(buf);
|
||||
final boolean isConnected = buf.readBoolean();
|
||||
final boolean isHub = buf.readBoolean();
|
||||
|
||||
final int targetsSize = buf.readInt();
|
||||
final List<DimensionalCoord> targets = new ArrayList<>(targetsSize);
|
||||
for (int i = 0; i < targetsSize; i++) targets.add(DimensionalCoord.readFromPacket(buf));
|
||||
|
||||
return new WirelessToolDataObject(
|
||||
network,
|
||||
customName,
|
||||
coord,
|
||||
isConnected,
|
||||
targets,
|
||||
AEColor.values()[buf.readInt()],
|
||||
buf.readInt(),
|
||||
isHub,
|
||||
buf.readInt());
|
||||
}
|
||||
|
||||
public static void writeAsList(ArrayList<WirelessToolDataObject> list, ByteBuf buf) {
|
||||
buf.writeInt(list.size());
|
||||
list.forEach(d -> d.write(buf));
|
||||
}
|
||||
|
||||
public static ArrayList<WirelessToolDataObject> readAsList(ByteBuf buf) {
|
||||
final int size = buf.readInt();
|
||||
final ArrayList<WirelessToolDataObject> arrayList = new ArrayList<>(size);
|
||||
for (int x = 0; x < size; x++) arrayList.add(WirelessToolDataObject.read(buf));
|
||||
|
||||
return arrayList;
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import appeng.integration.modules.waila.tile.InterfaceDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStateWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.PowerStorageWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.QuantumBridgeWailaDataProvider;
|
||||
import appeng.integration.modules.waila.tile.WirelessDataProvider;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
@@ -59,9 +60,16 @@ public final class TileWailaDataProvider implements IWailaDataProvider {
|
||||
final IWailaDataProvider craftingMonitor = new CraftingMonitorWailaDataProvider();
|
||||
final IWailaDataProvider interfaceBlock = new InterfaceDataProvider();
|
||||
final IWailaDataProvider quantumBridge = new QuantumBridgeWailaDataProvider();
|
||||
final IWailaDataProvider wireless = new WirelessDataProvider();
|
||||
|
||||
this.providers = Lists
|
||||
.newArrayList(charger, energyCell, craftingBlock, craftingMonitor, interfaceBlock, quantumBridge);
|
||||
this.providers = Lists.newArrayList(
|
||||
charger,
|
||||
energyCell,
|
||||
craftingBlock,
|
||||
craftingMonitor,
|
||||
interfaceBlock,
|
||||
quantumBridge,
|
||||
wireless);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package appeng.integration.modules.waila.tile;
|
||||
|
||||
import static appeng.helpers.WireLessToolHelper.getConnectMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.WirelessToolMode;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.client.render.NetworkVisualiserRender;
|
||||
import appeng.core.localization.WailaText;
|
||||
import appeng.helpers.WireLessToolHelper;
|
||||
import appeng.integration.modules.waila.BaseWailaDataProvider;
|
||||
import appeng.items.tools.ToolWirelessKit;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import appeng.util.Platform;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
|
||||
public class WirelessDataProvider extends BaseWailaDataProvider {
|
||||
|
||||
@Override
|
||||
public List<String> getWailaBody(final ItemStack itemStack, final List<String> currentToolTip,
|
||||
final IWailaDataAccessor accessor, final IWailaConfigHandler config) {
|
||||
|
||||
final TileEntity te = accessor.getTileEntity();
|
||||
if (!(te instanceof TileWirelessBase wl)) {
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = accessor.getNBTData();
|
||||
|
||||
if (tag.hasKey("connected")) {
|
||||
List<DimensionalCoord> locList = DimensionalCoord.readAsListFromNBT(tag.getCompoundTag("LocList"));
|
||||
NetworkVisualiserRender.doWirelessRender(locList);
|
||||
|
||||
switch (locList.size()) {
|
||||
case 0:
|
||||
currentToolTip.add(WailaText.wireless_notconnected.getLocal());
|
||||
break;
|
||||
case 1: {
|
||||
DimensionalCoord dc = locList.get(0);
|
||||
currentToolTip.add(WailaText.wireless_connected.getLocal(dc.getGuiTextShortNoDim()));
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
if (tag.getBoolean("isSneaking")) {
|
||||
currentToolTip.add(WailaText.wireless_connected_detailsTitle.getLocal());
|
||||
for (DimensionalCoord dc : locList) {
|
||||
currentToolTip
|
||||
.add(WailaText.wireless_connected_details.getLocal(dc.getGuiTextShortNoDim()));
|
||||
}
|
||||
return currentToolTip; // just list connected wireless devices
|
||||
}
|
||||
currentToolTip.add(WailaText.wireless_connected_multiple.getLocal(locList.size()));
|
||||
}
|
||||
}
|
||||
|
||||
currentToolTip.add(WailaText.wireless_channels.getLocal(tag.getInteger("channels")));
|
||||
currentToolTip.add(
|
||||
WailaText.wireless_power
|
||||
.getLocal(Platform.formatNumberDoubleRestrictedByWidth(tag.getDouble("power"), 5)));
|
||||
} else {
|
||||
currentToolTip.add(WailaText.wireless_notconnected.getLocal());
|
||||
}
|
||||
|
||||
AEColor color = AEColor.values()[tag.getInteger("color")];
|
||||
if (color != AEColor.Transparent) {
|
||||
currentToolTip.add(StatCollector.translateToLocal("gui.appliedenergistics2." + color.name()));
|
||||
}
|
||||
|
||||
if (wl.isHub() && tag.getBoolean("holdWand"))
|
||||
currentToolTip.add(StatCollector.translateToLocal(tag.getString("wandConnectMode")));
|
||||
|
||||
return currentToolTip;
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound getNBTData(final EntityPlayerMP player, final TileEntity te, final NBTTagCompound tag,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
if (!(te instanceof TileWirelessBase wc)) return tag;
|
||||
|
||||
if (wc.isLinked()) {
|
||||
tag.setBoolean("connected", true);
|
||||
tag.setInteger("channels", wc.getUsedChannels());
|
||||
tag.setDouble("power", wc.getPowerUsage());
|
||||
if (wc.isLinked()) {
|
||||
NBTTagCompound locList = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(locList, wc.getConnectedCoords());
|
||||
tag.setTag("LocList", locList);
|
||||
}
|
||||
tag.setBoolean("isSneaking", player.isSneaking());
|
||||
}
|
||||
|
||||
final ItemStack hand = player.getCurrentEquippedItem();
|
||||
if (hand != null && hand.getItem() instanceof ToolWirelessKit) {
|
||||
if (WireLessToolHelper.getMode(hand) == WirelessToolMode.Advanced) {
|
||||
final String connectionMode = getConnectMode(hand).getUnlocalized();
|
||||
tag.setBoolean("holdWand", true);
|
||||
tag.setString("wandConnectMode", connectionMode);
|
||||
}
|
||||
}
|
||||
|
||||
tag.setInteger("color", wc.getColor().ordinal());
|
||||
|
||||
return tag;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package appeng.items.contents;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.WirelessToolGroupBy;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.api.util.IConfigurableObject;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class WirelessKitObject implements IGuiItemObject, IConfigurableObject {
|
||||
|
||||
private final ItemStack stack;
|
||||
private final World world;
|
||||
|
||||
public WirelessKitObject(final ItemStack stack, World w) {
|
||||
this.stack = stack;
|
||||
this.world = w;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getItemStack() {
|
||||
return this.stack;
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
final ConfigManager out = new ConfigManager((manager, settingName, newValue) -> {
|
||||
final NBTTagCompound data = Platform.openNbtData(WirelessKitObject.this.stack);
|
||||
manager.writeToNBT(data);
|
||||
});
|
||||
|
||||
out.registerSetting(Settings.WIRELESS_TOOL_GROUP_BY, WirelessToolGroupBy.Single);
|
||||
out.registerSetting(Settings.WIRELESS_TOOL_HIDE_BOUNDED, YesNo.NO);
|
||||
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(this.stack).copy());
|
||||
return out;
|
||||
}
|
||||
}
|
||||
@@ -48,8 +48,6 @@ import appeng.core.CommonHelper;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.GuiText;
|
||||
import appeng.helpers.PatternHelper;
|
||||
import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.Platform;
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
@@ -60,7 +58,6 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
// rather simple client side caching.
|
||||
private static final Map<ItemStack, ItemStack> SIMPLE_CACHE = new WeakHashMap<>();
|
||||
private static final Map<ItemStack, IAEStack<?>> OUTPUT_STACK_CACHE = new WeakHashMap<>();
|
||||
private static final boolean isGTLoaded = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.GT);
|
||||
private static final Locale locale = Locale.getDefault();
|
||||
|
||||
public ItemEncodedPattern() {
|
||||
@@ -279,7 +276,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
||||
if (item.equals(unknownItem)) return true;
|
||||
|
||||
final String itemCountText = NumberFormat.getNumberInstance(locale).format(item.getStackSize());
|
||||
final String itemText = isGTLoaded && item instanceof IAEItemStack ais
|
||||
final String itemText = Platform.isGTLoaded && item instanceof IAEItemStack ais
|
||||
&& ais.getItem() instanceof ItemIntegratedCircuit
|
||||
? Platform.getItemDisplayName(item) + " " + ais.getItemStack().getItemDamage()
|
||||
: Platform.getItemDisplayName(item);
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2014 - 2015 https://github.com/bdew/ae2stuff This mod is distributed under the terms of the
|
||||
* Minecraft Mod Public License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://bdew.net/minecraft-mod-public-license/
|
||||
*/
|
||||
|
||||
package appeng.items.tools;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGrid;
|
||||
import appeng.api.networking.IGridBlock;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketNetworkVisualiserData;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
|
||||
import gregtech.common.tileentities.machines.MTEHatchCraftingInputME;
|
||||
import gregtech.common.tileentities.machines.MTEHatchCraftingInputSlave;
|
||||
|
||||
public class ToolNetworkVisualiser extends AEBaseItem {
|
||||
|
||||
public ToolNetworkVisualiser() {
|
||||
this.setFeature(EnumSet.of(AEFeature.Core));
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
public enum VNodeFlags {
|
||||
DENSE,
|
||||
MISSING,
|
||||
PROXY
|
||||
}
|
||||
|
||||
public static class VNode {
|
||||
|
||||
public final int x;
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final EnumSet<VNodeFlags> flags;
|
||||
|
||||
public VNode(int x, int y, int z, EnumSet<VNodeFlags> flags) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
public enum VLinkFlags {
|
||||
DENSE,
|
||||
COMPRESSED,
|
||||
PROXY
|
||||
}
|
||||
|
||||
public static class VLink {
|
||||
|
||||
public final VNode node1;
|
||||
public final VNode node2;
|
||||
public final int channels;
|
||||
public final EnumSet<VLinkFlags> flags;
|
||||
|
||||
public VLink(VNode node1, VNode node2, int channels, EnumSet<VLinkFlags> flags) {
|
||||
this.node1 = node1;
|
||||
this.node2 = node2;
|
||||
this.channels = channels;
|
||||
this.flags = flags;
|
||||
}
|
||||
}
|
||||
|
||||
public enum VisualisationModes {
|
||||
FULL,
|
||||
NODES,
|
||||
CHANNELS,
|
||||
NONUM,
|
||||
P2P,
|
||||
PROXY
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack is, World worldIn, EntityPlayer p) {
|
||||
if (Platform.isServer()) {
|
||||
if (p.isSneaking()) {
|
||||
final IConfigManager cm = getConfigManager(is);
|
||||
Enum<?> newState = getNextVisualisationMode(cm);
|
||||
if (!Platform.isGTLoaded && newState == VisualisationModes.PROXY)
|
||||
newState = getNextVisualisationMode(cm);
|
||||
cm.putSetting(Settings.NETWORK_VISUALISER, newState);
|
||||
p.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
"item.appliedenergistics2.ToolNetworkVisualiser.set",
|
||||
StatCollector.translateToLocal(
|
||||
"item.appliedenergistics2.ToolNetworkVisualiser.mode."
|
||||
+ newState.toString().toLowerCase(Locale.US))));
|
||||
}
|
||||
}
|
||||
return is;
|
||||
}
|
||||
|
||||
private Enum<?> getNextVisualisationMode(IConfigManager cm) {
|
||||
return Platform.rotateEnum(
|
||||
cm.getSetting(Settings.NETWORK_VISUALISER),
|
||||
false,
|
||||
Settings.NETWORK_VISUALISER.getPossibleValues());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float xOff,
|
||||
float yOff, float zOff) {
|
||||
if (Platform.isServer()) {
|
||||
TileEntity te = w.getTileEntity(x, y, z);
|
||||
if (te instanceof IGridHost) {
|
||||
if (!is.hasTagCompound()) is.setTagCompound(new NBTTagCompound());
|
||||
DimensionalCoord dc = new DimensionalCoord(te);
|
||||
dc.writeToNBT(is.getTagCompound());
|
||||
p.addChatMessage(
|
||||
new ChatComponentTranslation(
|
||||
"item.appliedenergistics2.ToolNetworkVisualiser.bound",
|
||||
dc.getGuiTextShortNoDim()));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
ItemStack currItem;
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack is, World w, Entity entity, int slot, boolean active) {
|
||||
if (Platform.isClient() || !(entity instanceof EntityPlayerMP player) || is.getTagCompound() == null) {
|
||||
return;
|
||||
}
|
||||
ItemStack currentItem = player.inventory.getCurrentItem();
|
||||
if (currentItem != currItem) {
|
||||
currItem = currentItem;
|
||||
}
|
||||
if (currentItem == null || !(currentItem.getItem() instanceof ToolNetworkVisualiser)) {
|
||||
return;
|
||||
}
|
||||
currItem = currentItem;
|
||||
|
||||
DimensionalCoord dc = DimensionalCoord.readFromNBT(is.getTagCompound());
|
||||
if (w.provider.dimensionId != dc.getDimension()) return;
|
||||
|
||||
ArrayList<VLink> vLinks = new ArrayList<>();
|
||||
Map<IGridNode, VNode> vnList = new HashMap<>();
|
||||
ArrayList<VNode> vNodeList = new ArrayList<>();
|
||||
|
||||
TileEntity te = w.getTileEntity(dc.x, dc.y, dc.z);
|
||||
if (te instanceof IGridHost gh) {
|
||||
IGridNode gn = gh.getGridNode(ForgeDirection.UNKNOWN);
|
||||
if (gn != null) {
|
||||
IGrid g = gn.getGrid();
|
||||
if (g != null) {
|
||||
ArrayList<IGridConnection> gcList = new ArrayList<>();
|
||||
for (IGridNode igNode : g.getNodes()) {
|
||||
IGridBlock igb = igNode.getGridBlock();
|
||||
if (igb.isWorldAccessible() && igb.getLocation().isInWorld(w)) {
|
||||
DimensionalCoord loc = igb.getLocation();
|
||||
for (IGridConnection igc : igNode.getConnections()) {
|
||||
gcList.add(igc);
|
||||
}
|
||||
EnumSet<VNodeFlags> flags = EnumSet.noneOf(VNodeFlags.class);
|
||||
if (!igNode.meetsChannelRequirements()) flags.add(VNodeFlags.MISSING);
|
||||
if (igNode.hasFlag(GridFlags.DENSE_CAPACITY)) {
|
||||
flags.add(VNodeFlags.DENSE);
|
||||
}
|
||||
|
||||
vnList.put(igNode, new VNode(loc.x, loc.y, loc.z, flags));
|
||||
|
||||
if (Platform.isGTLoaded && igb.getMachine() instanceof MTEHatchCraftingInputME crib) {
|
||||
EnumSet<VNodeFlags> flagsNode = EnumSet.of(VNodeFlags.PROXY);
|
||||
EnumSet<VLinkFlags> flagsLink = EnumSet.of(VLinkFlags.PROXY);
|
||||
final VNode node = new VNode(loc.x, loc.y, loc.z, flagsNode);
|
||||
for (MTEHatchCraftingInputSlave s : crib.getProxyHatches()) {
|
||||
final IGregTechTileEntity sb = s.getBaseMetaTileEntity();
|
||||
final VNode sbNode = new VNode(
|
||||
sb.getXCoord(),
|
||||
sb.getYCoord(),
|
||||
sb.getZCoord(),
|
||||
flagsNode);
|
||||
vLinks.add(new VLink(node, sbNode, 0, flagsLink));
|
||||
vNodeList.add(sbNode);
|
||||
}
|
||||
|
||||
vNodeList.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (IGridConnection c : gcList) {
|
||||
VNode n1 = vnList.get(c.a());
|
||||
VNode n2 = vnList.get(c.b());
|
||||
if (n1 != null && n2 != null && n1 != n2) {
|
||||
EnumSet<VLinkFlags> flags = EnumSet.noneOf(VLinkFlags.class);
|
||||
if (c.a().hasFlag(GridFlags.DENSE_CAPACITY) && c.b().hasFlag(GridFlags.DENSE_CAPACITY)) {
|
||||
flags.add(VLinkFlags.DENSE);
|
||||
}
|
||||
if (c.a().hasFlag(GridFlags.CANNOT_CARRY_COMPRESSED)
|
||||
&& c.b().hasFlag(GridFlags.CANNOT_CARRY_COMPRESSED)) {
|
||||
flags.add(VLinkFlags.COMPRESSED);
|
||||
}
|
||||
vLinks.add(new VLink(n1, n2, c.getUsedChannels(), flags));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
vNodeList.addAll(vnList.values());
|
||||
NetworkHandler.instance.sendTo(new PacketNetworkVisualiserData(vNodeList, vLinks), player);
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
public static IConfigManager getConfigManager(final ItemStack target) {
|
||||
final ConfigManager out = new ConfigManager((manager, settingName, newValue) -> {
|
||||
final NBTTagCompound data = Platform.openNbtData(target);
|
||||
manager.writeToNBT(data);
|
||||
});
|
||||
|
||||
out.registerSetting(Settings.NETWORK_VISUALISER, VisualisationModes.FULL);
|
||||
|
||||
out.readFromNBT((NBTTagCompound) Platform.openNbtData(target).copy());
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCheckedInformation(ItemStack is, EntityPlayer player, List<String> lines,
|
||||
boolean displayMoreInfo) {
|
||||
lines.add(
|
||||
StatCollector.translateToLocal("item.appliedenergistics2.ToolNetworkVisualiser.mode") + " "
|
||||
+ StatCollector.translateToLocal(
|
||||
"item.appliedenergistics2.ToolNetworkVisualiser.mode." + getConfigManager(is)
|
||||
.getSetting(Settings.NETWORK_VISUALISER).toString().toLowerCase(Locale.US)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package appeng.items.tools;
|
||||
|
||||
import static appeng.api.config.AdvancedWirelessToolMode.Queueing;
|
||||
import static appeng.api.config.AdvancedWirelessToolMode.QueueingLine;
|
||||
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants.NBT;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.gtnewhorizon.gtnhlib.item.ItemStackNBT;
|
||||
|
||||
import appeng.api.config.AdvancedWirelessToolMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.api.config.WirelessToolGroupBy;
|
||||
import appeng.api.config.WirelessToolMode;
|
||||
import appeng.api.config.YesNo;
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.api.networking.IGridHost;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.features.AEFeature;
|
||||
import appeng.core.localization.WirelessMessages;
|
||||
import appeng.core.sync.GuiBridge;
|
||||
import appeng.helpers.WireLessToolHelper;
|
||||
import appeng.items.AEBaseItem;
|
||||
import appeng.items.contents.WirelessKitObject;
|
||||
import appeng.tile.networking.TileWirelessBase;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ToolWirelessKit extends AEBaseItem implements IGuiItem {
|
||||
|
||||
public ToolWirelessKit() {
|
||||
this.setFeature(EnumSet.of(AEFeature.Core));
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack is, World w, Entity e, int p_77663_4_, boolean p_77663_5_) {
|
||||
if (!is.hasTagCompound()) WireLessToolHelper.newNBT(is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack is, World w, EntityPlayer p) {
|
||||
if (Platform.isClient()) {
|
||||
return is;
|
||||
}
|
||||
|
||||
final IConfigManager cm = getConfigManager(is);
|
||||
if (Platform.keyBindTab.isKeyDown(p)) {
|
||||
WireLessToolHelper.nextToolMode(p, cm);
|
||||
return is;
|
||||
}
|
||||
|
||||
final WirelessToolMode mode = WireLessToolHelper.getMode(is);
|
||||
if (p.isSneaking() && Platform.keyBindLCtrl.isKeyDown(p)) {
|
||||
WireLessToolHelper.clearNBT(is, mode, p);
|
||||
return is;
|
||||
}
|
||||
|
||||
if (p.isSneaking() && mode == WirelessToolMode.Advanced) {
|
||||
WireLessToolHelper.nextConnectMode(cm, p);
|
||||
return is;
|
||||
}
|
||||
|
||||
if (mode == WirelessToolMode.Super) {
|
||||
Platform.openGUI(p, null, ForgeDirection.UNKNOWN, GuiBridge.GUI_SUPER_WIRELESS_KIT);
|
||||
return is;
|
||||
}
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse(ItemStack is, EntityPlayer p, World w, int x, int y, int z, int side, float xOff,
|
||||
float yOff, float zOff) {
|
||||
if (Platform.isClient()) return true;
|
||||
|
||||
final WirelessToolMode mode = (WirelessToolMode) getConfigManager(is).getSetting(Settings.WIRELESS_TOOL_MODE);
|
||||
final TileEntity te = w.getTileEntity(x, y, z);
|
||||
|
||||
if (mode == WirelessToolMode.Super && te instanceof IGridHost)
|
||||
return WireLessToolHelper.bindSuper(te, is, w, p);
|
||||
|
||||
if (!(te instanceof TileWirelessBase target)) return false;
|
||||
|
||||
return switch (mode) {
|
||||
case Simple -> WireLessToolHelper.bindSimple(target, is, w, p);
|
||||
case Advanced -> WireLessToolHelper.bindAdvanced(target, is, w, p);
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
public static IConfigManager getConfigManager(final ItemStack target) {
|
||||
final ConfigManager out = new ConfigManager((manager, settingName, newValue) -> {
|
||||
final NBTTagCompound data = ItemStackNBT.get(target);
|
||||
manager.writeToNBT(data);
|
||||
});
|
||||
|
||||
final ToolWirelessKit tool = (ToolWirelessKit) target.getItem();
|
||||
|
||||
out.registerSetting(Settings.WIRELESS_TOOL_MODE, WirelessToolMode.Simple);
|
||||
out.registerSetting(Settings.WIRELESS_TOOL_GROUP_BY, WirelessToolGroupBy.Single);
|
||||
out.registerSetting(Settings.WIRELESS_TOOL_HIDE_BOUNDED, YesNo.NO);
|
||||
out.registerSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE, Queueing);
|
||||
|
||||
out.readFromNBT(ItemStackNBT.get(target));
|
||||
return out;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addCheckedInformation(ItemStack is, EntityPlayer player, final List<String> lines,
|
||||
boolean displayMoreInfo) {
|
||||
final IConfigManager cm = getConfigManager(is);
|
||||
final WirelessToolMode currentMode = (WirelessToolMode) cm.getSetting(Settings.WIRELESS_TOOL_MODE);
|
||||
lines.add(WirelessMessages.Mode.getLocal(currentMode.getLocal()));
|
||||
lines.add(WirelessMessages.ModeToggle.getLocal());
|
||||
lines.add(WirelessMessages.SuperClear.getLocal());
|
||||
|
||||
final NBTTagCompound tag = ItemStackNBT.get(is);
|
||||
|
||||
switch (currentMode) {
|
||||
case Simple -> {
|
||||
if (tag.getCompoundTag(WireLessToolHelper.NbtSimple).hasNoTags()) {
|
||||
lines.add(WirelessMessages.SimpleEmpty.getLocal());
|
||||
} else {
|
||||
final DimensionalCoord dc = DimensionalCoord
|
||||
.readFromNBT(tag.getCompoundTag(WireLessToolHelper.NbtSimple));
|
||||
lines.add(WirelessMessages.SimpleBounded.getLocal(dc.getGuiTextShortNoDim()));
|
||||
lines.add(WirelessMessages.SimpleBound.getLocal());
|
||||
}
|
||||
}
|
||||
case Advanced -> {
|
||||
final AdvancedWirelessToolMode mode = (AdvancedWirelessToolMode) cm
|
||||
.getSetting(Settings.ADVANCED_WIRELESS_TOOL_MODE);
|
||||
lines.add(WirelessMessages.AdvancedActivated.getLocal(mode.getLocal()));
|
||||
|
||||
switch (mode) {
|
||||
case Queueing, Binding -> {
|
||||
final List<DimensionalCoord> dcl = DimensionalCoord
|
||||
.readAsListFromNBT(tag.getCompoundTag(WireLessToolHelper.NbtAdvanced));
|
||||
if (dcl.isEmpty()) {
|
||||
if (mode == Queueing) lines.add(WirelessMessages.AdvancedQueueEmpty.getLocal());
|
||||
else lines.add(WirelessMessages.AdvancedBindingEmpty.getLocal());
|
||||
} else {
|
||||
if (GuiScreen.isShiftKeyDown()) {
|
||||
if (mode == Queueing) lines.add(WirelessMessages.AdvancedQueueNotEmpty.getLocal());
|
||||
else lines.add(WirelessMessages.AdvancedBindingNotEmpty.getLocal());
|
||||
dcl.forEach(dc -> lines.add(dc.getGuiTextShort()));
|
||||
return;
|
||||
} else lines.add(WirelessMessages.AdvancedNext.getLocal(dcl.get(0).getGuiTextShortNoDim()));
|
||||
}
|
||||
|
||||
if (mode == Queueing) lines.add(WirelessMessages.AdvancedQueueingHubQol.getLocal());
|
||||
else lines.add(WirelessMessages.AdvancedBindingHubQol.getLocal());
|
||||
}
|
||||
|
||||
case QueueingLine, BindingLine -> {
|
||||
final NBTTagCompound line;
|
||||
if (mode == QueueingLine) line = tag.getCompoundTag(WireLessToolHelper.NbtAdvancedLineQueue);
|
||||
else line = tag.getCompoundTag(WireLessToolHelper.NbtAdvancedLineBinding);
|
||||
|
||||
if (!line.hasKey(WireLessToolHelper.NbtAdvanced1StPoint))
|
||||
lines.add(WirelessMessages.AdvancedLineEmpty1st.getLocal());
|
||||
else {
|
||||
lines.add(
|
||||
WirelessMessages.AdvancedLine1st.getLocal(
|
||||
DimensionalCoord
|
||||
.readFromNBT(
|
||||
line.getCompoundTag(WireLessToolHelper.NbtAdvanced1StPoint))
|
||||
.getGuiTextShort()));
|
||||
|
||||
if (!line.hasKey(WireLessToolHelper.NbtAdvanced2ndPoint))
|
||||
lines.add(WirelessMessages.AdvancedLineEmpty2nd.getLocal());
|
||||
else {
|
||||
lines.add(
|
||||
WirelessMessages.AdvancedLine2nd.getLocal(
|
||||
DimensionalCoord.readFromNBT(
|
||||
line.getCompoundTag(WireLessToolHelper.NbtAdvanced2ndPoint))
|
||||
.getGuiTextShort()));
|
||||
lines.add(WirelessMessages.AdvancedQueueingLineNotEmpty.getLocal());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lines.add(WirelessMessages.AdvancedHowToggle.getLocal(EnumChatFormatting.ITALIC));
|
||||
}
|
||||
case Super -> {
|
||||
final NBTTagCompound stash = tag.getCompoundTag(WireLessToolHelper.NbtSuper);
|
||||
final List<DimensionalCoord> dcl = DimensionalCoord
|
||||
.readAsListFromNBT(stash.getCompoundTag(WireLessToolHelper.NbtSuperPos));
|
||||
if (dcl.isEmpty()) lines.add(WirelessMessages.SuperNetworkListEmpty.getLocal());
|
||||
else {
|
||||
lines.add(WirelessMessages.SuperNetworkList.getLocal());
|
||||
final NBTTagList tagNames = stash.getTagList(WireLessToolHelper.NbtSuperNames, NBT.TAG_COMPOUND);
|
||||
for (int i = 0; i < tagNames.tagCount(); i++) {
|
||||
final NBTTagCompound tagName = tagNames.getCompoundTagAt(i);
|
||||
final DimensionalCoord netCoord = DimensionalCoord.readFromNBT(tagName);
|
||||
String customName = "";
|
||||
|
||||
if (tagName.hasKey("networkName")) {
|
||||
for (final DimensionalCoord dc : dcl) {
|
||||
if (dc.equals(netCoord)) {
|
||||
customName = tagName.getString("networkName");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lines.add(
|
||||
WirelessMessages.SuperNetwork
|
||||
.getLocal(customName + " ", netCoord.getGuiTextShortNoDim()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGuiItemObject getGuiObject(ItemStack is, World world, EntityPlayer player, int x, int y, int z) {
|
||||
return new WirelessKitObject(is, world);
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_AEBaseInvTile(final net.minecraft.nbt.NBTTagCompound data) {
|
||||
if (this.inventoryPersistent) {
|
||||
if (this.isInventoryPersistent()) {
|
||||
final IInventory inv = this.getInternalInventory();
|
||||
final NBTTagCompound opt = data.getCompoundTag("inv");
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++) {
|
||||
@@ -54,7 +54,7 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_AEBaseInvTile(final net.minecraft.nbt.NBTTagCompound data) {
|
||||
if (this.inventoryPersistent) {
|
||||
if (this.isInventoryPersistent()) {
|
||||
final IInventory inv = this.getInternalInventory();
|
||||
final NBTTagCompound opt = new NBTTagCompound();
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++) {
|
||||
@@ -69,6 +69,10 @@ public abstract class AEBaseInvTile extends AEBaseTile implements ISidedInventor
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isInventoryPersistent() {
|
||||
return this.inventoryPersistent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return this.getInternalInventory().getSizeInventory();
|
||||
|
||||
@@ -0,0 +1,470 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.features.IInscriberRecipe;
|
||||
import appeng.api.features.InscriberProcessType;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.AECableType;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.core.settings.TickRates;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.DefinitionUpgradeInventory;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class TileAdvancedInscriber extends AENetworkPowerTile
|
||||
implements IGridTickable, IUpgradeableHost, IConfigManagerHost {
|
||||
|
||||
public static final int SLOT_TOP = 0;
|
||||
public static final int SLOT_MIDDLE = 1;
|
||||
public static final int SLOT_BOTTOM = 2;
|
||||
public static final int SLOT_OUTPUT = 3;
|
||||
public static final String NBT_INV = "inv";
|
||||
public static final String NBT_UPGRADES = "upgrades";
|
||||
public static final String NBT_PROGRESS = "progress";
|
||||
public static final String NBT_TOP_LOCKED = "topLocked";
|
||||
public static final String NBT_BOTTOM_LOCKED = "bottomLocked";
|
||||
public static final String NBT_PENDING_OUTPUT = "output";
|
||||
|
||||
private static final int MAX_PROCESSING_TIME = 100;
|
||||
private static final int BASE_POWER_PER_TICK = 10;
|
||||
private static final int[] ACCESSIBLE_SLOTS = { SLOT_TOP, SLOT_MIDDLE, SLOT_BOTTOM, SLOT_OUTPUT };
|
||||
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 4);
|
||||
private final IConfigManager settings;
|
||||
private final UpgradeInventory upgrades;
|
||||
|
||||
private int processingTime = 0;
|
||||
private ItemStack pendingOutput;
|
||||
private boolean topLocked = true;
|
||||
private boolean bottomLocked = true;
|
||||
private boolean active = false;
|
||||
|
||||
public TileAdvancedInscriber() {
|
||||
this.getProxy().setValidSides(EnumSet.allOf(ForgeDirection.class));
|
||||
this.setPowerSides(EnumSet.allOf(ForgeDirection.class));
|
||||
this.setInternalMaxPower(5000);
|
||||
this.getProxy().setIdlePowerUsage(0);
|
||||
this.settings = new ConfigManager(this);
|
||||
|
||||
final ITileDefinition advancedInscriber = AEApi.instance().definitions().blocks().advancedInscriber();
|
||||
this.upgrades = new DefinitionUpgradeInventory(advancedInscriber, this, this.getUpgradeSlots());
|
||||
}
|
||||
|
||||
private int getUpgradeSlots() {
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AECableType getCableConnectionType(final ForgeDirection dir) {
|
||||
return AECableType.COVERED;
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileAdvancedInscriber(final NBTTagCompound data) {
|
||||
this.inv.writeToNBT(data, NBT_INV);
|
||||
this.upgrades.writeToNBT(data, NBT_UPGRADES);
|
||||
this.settings.writeToNBT(data);
|
||||
data.setInteger(NBT_PROGRESS, this.processingTime);
|
||||
data.setBoolean(NBT_TOP_LOCKED, this.topLocked);
|
||||
data.setBoolean(NBT_BOTTOM_LOCKED, this.bottomLocked);
|
||||
|
||||
if (this.pendingOutput != null) {
|
||||
final NBTTagCompound output = new NBTTagCompound();
|
||||
this.pendingOutput.writeToNBT(output);
|
||||
data.setTag(NBT_PENDING_OUTPUT, output);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileAdvancedInscriber(final NBTTagCompound data) {
|
||||
this.inv.readFromNBT(data, NBT_INV);
|
||||
this.upgrades.readFromNBT(data, NBT_UPGRADES);
|
||||
this.settings.readFromNBT(data);
|
||||
this.processingTime = data.getInteger(NBT_PROGRESS);
|
||||
this.topLocked = !data.hasKey(NBT_TOP_LOCKED) || data.getBoolean(NBT_TOP_LOCKED);
|
||||
this.bottomLocked = !data.hasKey(NBT_BOTTOM_LOCKED) || data.getBoolean(NBT_BOTTOM_LOCKED);
|
||||
this.pendingOutput = data.hasKey(NBT_PENDING_OUTPUT)
|
||||
? ItemStack.loadItemStackFromNBT(data.getCompoundTag(NBT_PENDING_OUTPUT))
|
||||
: null;
|
||||
this.updateActiveState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops) {
|
||||
super.getDrops(w, x, y, z, drops);
|
||||
|
||||
for (int h = 0; h < this.upgrades.getSizeInventory(); h++) {
|
||||
final ItemStack is = this.upgrades.getStackInSlot(h);
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.pendingOutput != null) {
|
||||
drops.add(this.pendingOutput.copy());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory() {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(final int slot, final ItemStack stack) {
|
||||
if (stack == null || slot == SLOT_OUTPUT) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return switch (slot) {
|
||||
case SLOT_TOP -> this
|
||||
.isValidPartialRecipe(stack, this.getStackInSlot(SLOT_MIDDLE), this.getStackInSlot(SLOT_BOTTOM));
|
||||
case SLOT_MIDDLE -> this
|
||||
.isValidPartialRecipe(this.getStackInSlot(SLOT_TOP), stack, this.getStackInSlot(SLOT_BOTTOM));
|
||||
case SLOT_BOTTOM -> this
|
||||
.isValidPartialRecipe(this.getStackInSlot(SLOT_TOP), this.getStackInSlot(SLOT_MIDDLE), stack);
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(final int slotIndex, final ItemStack extractedItem, final int side) {
|
||||
return switch (slotIndex) {
|
||||
case SLOT_OUTPUT -> true;
|
||||
case SLOT_TOP -> !this.topLocked && this.pendingOutput == null && this.getStackInSlot(SLOT_MIDDLE) == null;
|
||||
case SLOT_BOTTOM -> !this.bottomLocked && this.pendingOutput == null
|
||||
&& this.getStackInSlot(SLOT_MIDDLE) == null;
|
||||
default -> false;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(final ForgeDirection d) {
|
||||
return ACCESSIBLE_SLOTS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(final IInventory inv, final int slot, final InvOperation mc, final ItemStack removed,
|
||||
final ItemStack added) {
|
||||
if (mc != InvOperation.markDirty) {
|
||||
this.wakeDevice();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
return new TickingRequest(TickRates.Inscriber.getMin(), TickRates.Inscriber.getMax(), !this.hasWork(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(final IGridNode node, final int ticksSinceLastCall) {
|
||||
if (this.pendingOutput == null) {
|
||||
this.tryStartJob();
|
||||
}
|
||||
|
||||
boolean keepTicking = false;
|
||||
if (this.pendingOutput != null) {
|
||||
if (this.processingTime >= MAX_PROCESSING_TIME) {
|
||||
keepTicking = this.tryOutput();
|
||||
} else {
|
||||
this.tryProgress(ticksSinceLastCall);
|
||||
keepTicking = true;
|
||||
if (this.processingTime >= MAX_PROCESSING_TIME) {
|
||||
keepTicking = this.tryOutput();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
this.updateActiveState();
|
||||
return keepTicking ? TickRateModulation.URGENT : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private boolean hasWork() {
|
||||
return this.pendingOutput != null || this.getTask() != null;
|
||||
}
|
||||
|
||||
private void tryStartJob() {
|
||||
final IInscriberRecipe recipe = this.getTask();
|
||||
if (recipe == null) {
|
||||
this.processingTime = 0;
|
||||
this.active = false;
|
||||
return;
|
||||
}
|
||||
|
||||
this.pendingOutput = recipe.getOutput().copy();
|
||||
this.processingTime = 0;
|
||||
this.active = true;
|
||||
this.decrStackSize(SLOT_MIDDLE, 1);
|
||||
|
||||
if (recipe.getProcessType() == InscriberProcessType.Press) {
|
||||
this.decrStackSize(SLOT_TOP, 1);
|
||||
this.decrStackSize(SLOT_BOTTOM, 1);
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
private void tryProgress(final int ticksSinceLastCall) {
|
||||
try {
|
||||
final IEnergyGrid energyGrid = this.getProxy().getEnergy();
|
||||
IEnergySource source = this;
|
||||
final int speedFactor = this.getSpeedFactor();
|
||||
final int powerConsumption = BASE_POWER_PER_TICK * speedFactor;
|
||||
final double powerThreshold = powerConsumption - 0.01;
|
||||
double extracted = this.extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
|
||||
if (extracted <= powerThreshold) {
|
||||
source = energyGrid;
|
||||
extracted = energyGrid.extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
}
|
||||
|
||||
if (extracted > powerThreshold) {
|
||||
source.extractAEPower(powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
||||
this.processingTime += Math.max(1, ticksSinceLastCall) * speedFactor;
|
||||
if (this.processingTime > MAX_PROCESSING_TIME) {
|
||||
this.processingTime = MAX_PROCESSING_TIME;
|
||||
}
|
||||
this.active = true;
|
||||
return;
|
||||
}
|
||||
} catch (final GridAccessException ignored) {
|
||||
// No network power available this tick.
|
||||
}
|
||||
|
||||
this.active = false;
|
||||
}
|
||||
|
||||
private int getSpeedFactor() {
|
||||
return 1 + this.upgrades.getInstalledUpgrades(Upgrades.SPEED);
|
||||
}
|
||||
|
||||
private boolean tryOutput() {
|
||||
final ItemStack currentOutput = this.getStackInSlot(SLOT_OUTPUT);
|
||||
|
||||
if (currentOutput == null) {
|
||||
this.setInventorySlotContents(SLOT_OUTPUT, this.pendingOutput.copy());
|
||||
return this.finishOutput();
|
||||
}
|
||||
|
||||
if (this.matches(currentOutput, this.pendingOutput)
|
||||
&& currentOutput.stackSize + this.pendingOutput.stackSize <= currentOutput.getMaxStackSize()) {
|
||||
currentOutput.stackSize += this.pendingOutput.stackSize;
|
||||
return this.finishOutput();
|
||||
}
|
||||
|
||||
this.active = false;
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean finishOutput() {
|
||||
this.pendingOutput = null;
|
||||
this.processingTime = 0;
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
|
||||
final boolean hasNextTask = this.getTask() != null;
|
||||
this.active = hasNextTask;
|
||||
return hasNextTask;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public IInscriberRecipe getTask() {
|
||||
final ItemStack middle = this.getStackInSlot(SLOT_MIDDLE);
|
||||
|
||||
if (middle == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if (this.isMatchingFullRecipe(recipe)) {
|
||||
return recipe;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean isMatchingFullRecipe(final IInscriberRecipe recipe) {
|
||||
final ItemStack middle = this.getStackInSlot(SLOT_MIDDLE);
|
||||
if (middle == null || !this.matches(recipe.getTopOptional().orNull(), this.getStackInSlot(SLOT_TOP))
|
||||
|| !this.matches(recipe.getBottomOptional().orNull(), this.getStackInSlot(SLOT_BOTTOM))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return this.matchesAny(recipe.getInputs(), middle);
|
||||
}
|
||||
|
||||
private boolean isValidPartialRecipe(final ItemStack top, final ItemStack middle, final ItemStack bottom) {
|
||||
for (final IInscriberRecipe recipe : AEApi.instance().registries().inscriber().getRecipes()) {
|
||||
if (this.isMatchingPartialRecipe(recipe, top, middle, bottom)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isMatchingPartialRecipe(final IInscriberRecipe recipe, final ItemStack top, final ItemStack middle,
|
||||
final ItemStack bottom) {
|
||||
if (top != null
|
||||
&& (!recipe.getTopOptional().isPresent() || !this.matches(recipe.getTopOptional().get(), top))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (middle != null && !this.matchesAny(recipe.getInputs(), middle)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return bottom == null
|
||||
|| (recipe.getBottomOptional().isPresent() && this.matches(recipe.getBottomOptional().get(), bottom));
|
||||
}
|
||||
|
||||
private boolean matchesAny(final Collection<ItemStack> stacks, final ItemStack input) {
|
||||
for (final ItemStack stack : stacks) {
|
||||
if (this.matches(stack, input)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean matches(@Nullable final ItemStack expected, @Nullable final ItemStack actual) {
|
||||
if (expected == null || actual == null) {
|
||||
return expected == null && actual == null;
|
||||
}
|
||||
return Platform.isSameItemPrecise(expected, actual);
|
||||
}
|
||||
|
||||
private void wakeDevice() {
|
||||
try {
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
} catch (final GridAccessException ignored) {
|
||||
// The node may not be attached yet.
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
this.wakeDevice();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty() {
|
||||
this.wakeDevice();
|
||||
super.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(final Block oldBlock, final Block newBlock, final int oldMeta, final int newMeta,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return oldBlock != newBlock;
|
||||
}
|
||||
|
||||
private void updateActiveState() {
|
||||
if (this.worldObj == null || !this.worldObj.blockExists(this.xCoord, this.yCoord, this.zCoord)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final int meta = this.active ? 1 : 0;
|
||||
if (this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord) != meta) {
|
||||
this.worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, meta, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals(NBT_INV)) {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
if (name.equals(NBT_UPGRADES)) {
|
||||
return this.upgrades;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return this.upgrades.getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {}
|
||||
|
||||
public int getMaxProcessingTime() {
|
||||
return MAX_PROCESSING_TIME;
|
||||
}
|
||||
|
||||
public int getProcessingTime() {
|
||||
return this.processingTime;
|
||||
}
|
||||
|
||||
public boolean isTopLocked() {
|
||||
return this.topLocked;
|
||||
}
|
||||
|
||||
public boolean isBottomLocked() {
|
||||
return this.bottomLocked;
|
||||
}
|
||||
|
||||
public void setTopLocked(final boolean topLocked) {
|
||||
this.topLocked = topLocked;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
public void setBottomLocked(final boolean bottomLocked) {
|
||||
this.bottomLocked = bottomLocked;
|
||||
this.markDirty();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isInventoryPersistent() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,283 @@
|
||||
package appeng.tile.misc;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.config.Upgrades;
|
||||
import appeng.api.definitions.IItemDefinition;
|
||||
import appeng.api.definitions.ITileDefinition;
|
||||
import appeng.api.implementations.IUpgradeableHost;
|
||||
import appeng.api.implementations.items.IGrowableCrystal;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.networking.energy.IEnergyGrid;
|
||||
import appeng.api.networking.energy.IEnergySource;
|
||||
import appeng.api.networking.ticking.IGridTickable;
|
||||
import appeng.api.networking.ticking.TickRateModulation;
|
||||
import appeng.api.networking.ticking.TickingRequest;
|
||||
import appeng.api.util.IConfigManager;
|
||||
import appeng.me.GridAccessException;
|
||||
import appeng.parts.automation.DefinitionUpgradeInventory;
|
||||
import appeng.parts.automation.UpgradeInventory;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkPowerTile;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.tile.inventory.InvOperation;
|
||||
import appeng.util.ConfigManager;
|
||||
import appeng.util.IConfigManagerHost;
|
||||
import appeng.util.InventoryAdaptor;
|
||||
import appeng.util.inv.WrapperInventoryRange;
|
||||
|
||||
public class TileCrystalGrowthChamber extends AENetworkPowerTile
|
||||
implements IGridTickable, IUpgradeableHost, IConfigManagerHost {
|
||||
|
||||
private static final int CYCLE_POWER = 100;
|
||||
|
||||
private final AppEngInternalInventory inv = new AppEngInternalInventory(this, 27);
|
||||
private final UpgradeInventory upgrades;
|
||||
private final IConfigManager settings;
|
||||
private final IItemDefinition chargedCertusQuartz = AEApi.instance().definitions().materials()
|
||||
.certusQuartzCrystalCharged();
|
||||
private final IItemDefinition fluixCrystal = AEApi.instance().definitions().materials().fluixCrystal();
|
||||
|
||||
public TileCrystalGrowthChamber() {
|
||||
setInternalMaxPower(10000);
|
||||
getProxy().setIdlePowerUsage(0);
|
||||
|
||||
final ITileDefinition growerDefinition = AEApi.instance().definitions().blocks().crystalGrowthChamber();
|
||||
upgrades = new DefinitionUpgradeInventory(growerDefinition, this, 3);
|
||||
settings = new ConfigManager(this);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileGrower(final NBTTagCompound data) {
|
||||
upgrades.writeToNBT(data, "upgrades");
|
||||
settings.writeToNBT(data);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileGrower(final NBTTagCompound data) {
|
||||
upgrades.readFromNBT(data, "upgrades");
|
||||
settings.readFromNBT(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(final World w, final int x, final int y, final int z, final List<ItemStack> drops) {
|
||||
super.getDrops(w, x, y, z, drops);
|
||||
|
||||
for (int h = 0; h < this.upgrades.getSizeInventory(); h++) {
|
||||
final ItemStack is = this.upgrades.getStackInSlot(h);
|
||||
if (is != null) {
|
||||
drops.add(is);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack is) {
|
||||
return is != null && (is.getItem() instanceof IGrowableCrystal || is.getItem() == Items.quartz
|
||||
|| is.getItem() == Items.redstone
|
||||
|| chargedCertusQuartz.isSameAs(is));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack is, int side) {
|
||||
return !isItemValidForSlot(i, is);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInternalInventory() {
|
||||
return inv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removed, ItemStack added) {
|
||||
try {
|
||||
if (mc != InvOperation.markDirty) {
|
||||
markForUpdate();
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsBySide(ForgeDirection whichSide) {
|
||||
return IntStream.range(0, 27).toArray();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(final IGridNode node) {
|
||||
return new TickingRequest(1, 20, true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gridChanged() {
|
||||
try {
|
||||
this.getProxy().getTick().wakeDevice(this.getProxy().getNode());
|
||||
} catch (final GridAccessException ignored) {}
|
||||
}
|
||||
|
||||
public boolean simulatePower() {
|
||||
try {
|
||||
final IEnergyGrid eg = getProxy().getEnergy();
|
||||
IEnergySource src = this;
|
||||
|
||||
// Base 1, increase by 1 for each card
|
||||
final int speedFactor = 1 + upgrades.getInstalledUpgrades(Upgrades.SPEED);
|
||||
final int powerConsumption = CYCLE_POWER * speedFactor;
|
||||
final double powerThreshold = powerConsumption - 0.01;
|
||||
double powerReq = extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
|
||||
if (powerReq <= powerThreshold) {
|
||||
src = eg;
|
||||
powerReq = eg.extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
}
|
||||
|
||||
if (powerReq > powerThreshold) {
|
||||
return true;
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void consumePower() {
|
||||
try {
|
||||
final IEnergyGrid eg = getProxy().getEnergy();
|
||||
IEnergySource src = this;
|
||||
|
||||
// Base 1, increase by 1 for each card
|
||||
final int speedFactor = 1 + upgrades.getInstalledUpgrades(Upgrades.SPEED);
|
||||
final int powerConsumption = CYCLE_POWER * speedFactor;
|
||||
final double powerThreshold = powerConsumption - 0.01;
|
||||
double powerReq = extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
|
||||
if (powerReq <= powerThreshold) {
|
||||
src = eg;
|
||||
powerReq = eg.extractAEPower(powerConsumption, Actionable.SIMULATE, PowerMultiplier.CONFIG);
|
||||
}
|
||||
|
||||
if (powerReq > powerThreshold) {
|
||||
src.extractAEPower(powerConsumption, Actionable.MODULATE, PowerMultiplier.CONFIG);
|
||||
}
|
||||
} catch (final GridAccessException e) {
|
||||
// :P
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(final IGridNode node, final int ticksSinceLastCall) {
|
||||
boolean hasWork = false;
|
||||
if (simulatePower()) {
|
||||
for (int i = 0; i < inv.getSizeInventory(); i++) {
|
||||
ItemStack is = inv.getStackInSlot(i);
|
||||
if (is != null) {
|
||||
if (is.getItem() instanceof IGrowableCrystal gc) {
|
||||
ItemStack ns = null;
|
||||
for (int j = 0; j < 1 + getInstalledUpgrades(Upgrades.SPEED); j++) {
|
||||
ns = gc.triggerGrowth(is);
|
||||
}
|
||||
setInventorySlotContents(i, ns);
|
||||
hasWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
hasWork |= tryCreateFluix();
|
||||
} else return TickRateModulation.SLOWER;
|
||||
|
||||
if (hasWork) consumePower();
|
||||
updateMeta(hasWork);
|
||||
|
||||
return hasWork ? TickRateModulation.URGENT : TickRateModulation.SLEEP;
|
||||
}
|
||||
|
||||
private boolean tryCreateFluix() {
|
||||
int certusPos = -1;
|
||||
int redstonePos = -1;
|
||||
int netherPos = -1;
|
||||
|
||||
for (int j = 0; j < inv.getSizeInventory(); j++) {
|
||||
final ItemStack is = inv.getStackInSlot(j);
|
||||
if (is == null) continue;
|
||||
|
||||
if (certusPos < 0 && chargedCertusQuartz.isSameAs(is)) {
|
||||
certusPos = j;
|
||||
} else if (redstonePos < 0 && is.getItem() == Items.redstone) {
|
||||
redstonePos = j;
|
||||
} else if (netherPos < 0 && is.getItem() == Items.quartz) {
|
||||
netherPos = j;
|
||||
}
|
||||
|
||||
if (certusPos > -1 && redstonePos > -1 && netherPos > -1) break;
|
||||
}
|
||||
|
||||
if (certusPos < 0 || redstonePos < 0 || netherPos < 0) return false;
|
||||
|
||||
final ItemStack output = fluixCrystal.maybeStack(2).get();
|
||||
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor(
|
||||
new WrapperInventoryRange(this.inv, 0, this.inv.getSizeInventory(), true),
|
||||
ForgeDirection.UNKNOWN);
|
||||
|
||||
if (adaptor.addItems(output) != null) return false;
|
||||
|
||||
decrStackSize(certusPos, 1);
|
||||
decrStackSize(netherPos, 1);
|
||||
decrStackSize(redstonePos, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void updateMeta(boolean hasWork) {
|
||||
if (hasWork) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 1, 3);
|
||||
} else {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(final Upgrades u) {
|
||||
return this.upgrades.getInstalledUpgrades(u);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(final String name) {
|
||||
if (name.equals("inv")) {
|
||||
return this.inv;
|
||||
}
|
||||
|
||||
if (name.equals("upgrades")) {
|
||||
return this.upgrades;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRefresh(final Block oldBlock, final Block newBlock, final int oldMeta, final int newMeta,
|
||||
final World world, final int x, final int y, final int z) {
|
||||
return oldBlock != newBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue) {}
|
||||
}
|
||||
@@ -0,0 +1,335 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2014 - 2015 https://github.com/bdew/ae2stuff This mod is distributed under the terms of the
|
||||
* Minecraft Mod Public License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://bdew.net/minecraft-mod-public-license/
|
||||
*/
|
||||
|
||||
package appeng.tile.networking;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.implementations.tiles.IColorableTile;
|
||||
import appeng.api.networking.GridFlags;
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.IGridNode;
|
||||
import appeng.api.util.AEColor;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.core.AEConfig;
|
||||
import appeng.helpers.WireLessToolHelper.BindResult;
|
||||
import appeng.helpers.WirelessToolDataObject;
|
||||
import appeng.me.helpers.AENetworkProxy;
|
||||
import appeng.tile.TileEvent;
|
||||
import appeng.tile.events.TileEventType;
|
||||
import appeng.tile.grid.AENetworkTile;
|
||||
import appeng.util.Platform;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
|
||||
public abstract class TileWirelessBase extends AENetworkTile implements IColorableTile {
|
||||
|
||||
TileWirelessBase(int maxConnections) {
|
||||
this.maxConnections = maxConnections;
|
||||
}
|
||||
|
||||
private AEColor color = AEColor.Transparent;
|
||||
|
||||
private final int maxConnections;
|
||||
|
||||
protected abstract void setDataConnections(TileWirelessBase other, IGridConnection connection);
|
||||
|
||||
protected abstract void removeDataConnections(TileWirelessBase other);
|
||||
|
||||
public abstract List<TileWirelessBase> getConnectedTiles();
|
||||
|
||||
public List<DimensionalCoord> getConnectedCoords() {
|
||||
return ImmutableList.copyOf(new Iterator<>() {
|
||||
|
||||
final Iterator<TileWirelessBase> it = getConnectedTiles().iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return it.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DimensionalCoord next() {
|
||||
return it.next().getLocation();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public abstract List<IGridConnection> getAllConnections();
|
||||
|
||||
public abstract Map<TileWirelessBase, IGridConnection> getConnectionMap();
|
||||
|
||||
public abstract IGridConnection getConnection(TileWirelessBase other);
|
||||
|
||||
public boolean isConnectedTo(TileWirelessBase other) {
|
||||
return getConnection(other) != null && other.getConnection(this) != null;
|
||||
}
|
||||
|
||||
public boolean isLinked() {
|
||||
return !getConnectedTiles().isEmpty();
|
||||
}
|
||||
|
||||
public boolean isHub() {
|
||||
return maxConnections > 1;
|
||||
}
|
||||
|
||||
public int getFreeSlots() {
|
||||
return maxConnections - getConnectedTiles().size();
|
||||
}
|
||||
|
||||
public boolean canAddLink() {
|
||||
return getFreeSlots() > 0;
|
||||
}
|
||||
|
||||
public int getUsedChannels() {
|
||||
int used = 0;
|
||||
for (IGridConnection connection : getGridNode(ForgeDirection.UNKNOWN).getConnections()) {
|
||||
used = Math.max(used, connection.getUsedChannels());
|
||||
}
|
||||
return used;
|
||||
}
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS, USE WireLessToolHelper.performConnection()
|
||||
**/
|
||||
public abstract BindResult doLink(TileWirelessBase other);
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS, USE WireLessToolHelper.breakConnection()
|
||||
**/
|
||||
public abstract void doUnlink(TileWirelessBase other);
|
||||
|
||||
/**
|
||||
* DO NOT USE THIS, USE WireLessToolHelper.breakConnection()
|
||||
**/
|
||||
public abstract void doUnlink();
|
||||
|
||||
protected BindResult setupConnection(TileWirelessBase other) {
|
||||
if (!canAddLink()) return BindResult.INVALID_SOURCE;
|
||||
|
||||
try {
|
||||
final IGridNode selfNode = getGridNode(ForgeDirection.UNKNOWN);
|
||||
final IGridNode targetNode = other.getGridNode(ForgeDirection.UNKNOWN);
|
||||
|
||||
if (selfNode == null) return BindResult.INVALID_SOURCE;
|
||||
if (targetNode == null) return BindResult.INVALID_SOURCE;
|
||||
|
||||
final IGridConnection connection = AEApi.instance().createGridConnection(selfNode, targetNode);
|
||||
|
||||
setDataConnections(other, connection);
|
||||
other.setDataConnections(this, connection);
|
||||
updateActive();
|
||||
other.updateActive();
|
||||
shareCustomName(other);
|
||||
return BindResult.SUCCESS;
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage().equals("Connection already set!")) return BindResult.ALREADY_BIND;
|
||||
}
|
||||
|
||||
return BindResult.FAILED;
|
||||
}
|
||||
|
||||
protected void breakConnection(TileWirelessBase other) {
|
||||
IGridConnection connection = getConnection(other);
|
||||
if (connection == null) return;
|
||||
connection.destroy();
|
||||
removeDataConnections(other);
|
||||
other.removeDataConnections(this);
|
||||
updateActive();
|
||||
other.updateActive();
|
||||
}
|
||||
|
||||
protected void breakAllConnections() {
|
||||
for (TileWirelessBase other : getConnectedTiles()) {
|
||||
breakConnection(other);
|
||||
}
|
||||
}
|
||||
|
||||
private DimensionalCoord location = null;
|
||||
|
||||
@Override
|
||||
public DimensionalCoord getLocation() {
|
||||
if (location == null) location = new DimensionalCoord(this);
|
||||
return location;
|
||||
}
|
||||
|
||||
public void setConnectionsPowerDraw() {
|
||||
double idlePowerUse = PowerMultiplier.CONFIG.multiply( // apply the AE2 configuration multiplier
|
||||
getConnectedTiles().stream().mapToDouble(tile -> {
|
||||
int dx = this.xCoord - tile.xCoord;
|
||||
int dy = this.yCoord - tile.yCoord;
|
||||
int dz = this.zCoord - tile.zCoord;
|
||||
double dist = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
||||
return AEConfig.instance.getWirelessConnectorPowerBase()
|
||||
+ AEConfig.instance.getWirelessConnectorPowerDistanceMultiplier() * dist
|
||||
* Math.log(dist * dist + 3);
|
||||
}).sum());
|
||||
this.setPowerDraw(idlePowerUse);
|
||||
}
|
||||
|
||||
public void setPowerDraw(double d) {
|
||||
this.getProxy().setIdlePowerUsage(d);
|
||||
}
|
||||
|
||||
public double getPowerUsage() {
|
||||
return getProxy().getIdlePowerUsage();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AENetworkProxy createProxy() {
|
||||
AENetworkProxy ae = super.createProxy();
|
||||
ae.setFlags(GridFlags.DENSE_CAPACITY);
|
||||
return ae;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeRotated() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void updateActive() {
|
||||
setConnectionsPowerDraw();
|
||||
if (isLinked()) {
|
||||
worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 1, 3);
|
||||
} else {
|
||||
worldObj.setBlockMetadataWithNotify(this.xCoord, this.yCoord, this.zCoord, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_READ)
|
||||
public boolean readFromStream_TileSecurity(final ByteBuf data) {
|
||||
final AEColor oldColor = this.color;
|
||||
this.color = AEColor.values()[data.readByte()];
|
||||
return oldColor != this.color;
|
||||
}
|
||||
|
||||
private final Set<DimensionalCoord> locList = new HashSet<>();
|
||||
|
||||
public void injectConnection(DimensionalCoord target) {
|
||||
this.locList.add(target);
|
||||
}
|
||||
|
||||
protected abstract void tryRestoreConnection(Set<DimensionalCoord> locList);
|
||||
|
||||
@TileEvent(TileEventType.TICK)
|
||||
public void onTick() {
|
||||
if (!Platform.isServer() || this.locList.isEmpty()) return;
|
||||
this.tryRestoreConnection(this.locList);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.NETWORK_WRITE)
|
||||
public void writeToStream_TileSecurity(final ByteBuf data) {
|
||||
data.writeByte(this.color.ordinal());
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_WRITE)
|
||||
public void writeToNBT_TileWirelessConnector(final NBTTagCompound data) {
|
||||
data.setShort("Color", (short) color.ordinal());
|
||||
|
||||
getConnectedTiles().forEach(t -> locList.add(t.getLocation()));
|
||||
final NBTTagCompound nbt = new NBTTagCompound();
|
||||
DimensionalCoord.writeListToNBT(nbt, new ArrayList<>(this.locList));
|
||||
data.setTag("connectedTargets", nbt);
|
||||
}
|
||||
|
||||
@TileEvent(TileEventType.WORLD_NBT_READ)
|
||||
public void readFromNBT_TileWirelessConnector(final NBTTagCompound data) {
|
||||
if (data.hasKey("Color")) {
|
||||
this.color = AEColor.values()[data.getShort("Color")];
|
||||
this.getProxy().setColor(this.color);
|
||||
}
|
||||
|
||||
this.locList.addAll(DimensionalCoord.readAsListFromNBT(data.getCompoundTag("connectedTargets")));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AEColor getColor() {
|
||||
return this.color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recolourBlock(ForgeDirection side, AEColor colour, EntityPlayer who) {
|
||||
if (this.color == colour) return false;
|
||||
this.color = colour;
|
||||
this.getProxy().setColor(this.color);
|
||||
|
||||
if (getGridNode(side) != null) {
|
||||
getGridNode(side).updateState();
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void shareCustomName(TileWirelessBase other) {
|
||||
if (other.hasCustomName()) setCustomName(other.getCustomName());
|
||||
else if (hasCustomName()) other.setCustomName(getCustomName());
|
||||
}
|
||||
|
||||
public void setCustomName(final String name) {
|
||||
super.setCustomName(name);
|
||||
for (TileWirelessBase tile : getConnectedTiles()) {
|
||||
if (name.isEmpty() && !tile.hasCustomName() || Objects.equals(tile.getCustomName(), name)) continue;
|
||||
tile.setCustomName(name);
|
||||
}
|
||||
}
|
||||
|
||||
public void madChameleonRecolor() {
|
||||
DimensionalCoord dc = this.getLocation();
|
||||
ArrayList<Integer> ic = new ArrayList<>();
|
||||
int i = 0;
|
||||
for (ForgeDirection fd : ForgeDirection.VALID_DIRECTIONS) {
|
||||
TileEntity te = worldObj.getTileEntity(dc.x + fd.offsetX, dc.y + fd.offsetY, dc.z + fd.offsetZ);
|
||||
if (te instanceof TileWirelessBase tw) {
|
||||
ic.add(tw.getColor().ordinal());
|
||||
while (ic.contains(i)) {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AEColor colour = AEColor.values()[i];
|
||||
|
||||
if (this.color == colour) return;
|
||||
this.color = colour;
|
||||
this.getProxy().setColor(this.color);
|
||||
|
||||
if (getGridNode(ForgeDirection.UNKNOWN) != null) {
|
||||
getGridNode(ForgeDirection.UNKNOWN).updateState();
|
||||
}
|
||||
|
||||
this.markDirty();
|
||||
this.markForUpdate();
|
||||
}
|
||||
|
||||
public WirelessToolDataObject getDataForTool(DimensionalCoord network) {
|
||||
return new WirelessToolDataObject(
|
||||
network,
|
||||
this.hasCustomName() ? this.getCustomName() : this.getBlockType().getLocalizedName(),
|
||||
getLocation(),
|
||||
isLinked(),
|
||||
getConnectedCoords(),
|
||||
getColor(),
|
||||
getUsedChannels(),
|
||||
isHub(),
|
||||
getFreeSlots());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (c) bdew, 2014 - 2015 https://github.com/bdew/ae2stuff This mod is distributed under the terms of the
|
||||
* Minecraft Mod Public License 1.0, or MMPL. Please check the contents of the license located in
|
||||
* http://bdew.net/minecraft-mod-public-license/
|
||||
*/
|
||||
|
||||
package appeng.tile.networking;
|
||||
|
||||
import static appeng.helpers.WireLessToolHelper.getAndCheckTile;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.helpers.WireLessToolHelper;
|
||||
import appeng.helpers.WireLessToolHelper.BindResult;
|
||||
|
||||
public class TileWirelessConnector extends TileWirelessBase {
|
||||
|
||||
private IGridConnection connection;
|
||||
private TileWirelessBase target;
|
||||
|
||||
public TileWirelessConnector() {
|
||||
super(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDataConnections(TileWirelessBase other, IGridConnection connection) {
|
||||
if (this.connection != null) breakAllConnections();
|
||||
|
||||
this.connection = connection;
|
||||
this.target = other;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeDataConnections(TileWirelessBase other) {
|
||||
if (target == other) {
|
||||
connection = null;
|
||||
target = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileWirelessBase> getConnectedTiles() {
|
||||
return target == null ? ImmutableList.of() : ImmutableList.of(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IGridConnection> getAllConnections() {
|
||||
return connection == null ? ImmutableList.of() : ImmutableList.of(connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<TileWirelessBase, IGridConnection> getConnectionMap() {
|
||||
return target != null && connection != null ? ImmutableMap.of(target, connection) : ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection getConnection(TileWirelessBase other) {
|
||||
if (target == other) return connection;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindResult doLink(TileWirelessBase other) {
|
||||
this.doUnlink();
|
||||
return setupConnection(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAddLink() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doUnlink(TileWirelessBase other) {
|
||||
if (target == other) this.breakConnection(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doUnlink() {
|
||||
this.breakAllConnections();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tryRestoreConnection(Set<DimensionalCoord> locList) {
|
||||
final Iterator<DimensionalCoord> iterator = locList.iterator();
|
||||
if (iterator.hasNext()) {
|
||||
if (this.connection != null) {
|
||||
iterator.next();
|
||||
iterator.remove();
|
||||
return;
|
||||
}
|
||||
|
||||
final TileWirelessBase tile = getAndCheckTile(iterator.next(), worldObj, null);
|
||||
if (tile == null) return;
|
||||
final BindResult result = WireLessToolHelper.performConnection(tile, this, new MachineSource(this));
|
||||
if (result == BindResult.SUCCESS || result == BindResult.ALREADY_BIND) iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package appeng.tile.networking;
|
||||
|
||||
import static appeng.helpers.WireLessToolHelper.getAndCheckTile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import appeng.api.networking.IGridConnection;
|
||||
import appeng.api.networking.security.MachineSource;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
import appeng.helpers.WireLessToolHelper;
|
||||
import appeng.helpers.WireLessToolHelper.BindResult;
|
||||
|
||||
public class TileWirelessHub extends TileWirelessBase {
|
||||
|
||||
HashMap<TileWirelessBase, IGridConnection> connections = new HashMap<>();
|
||||
|
||||
public TileWirelessHub() {
|
||||
super(32);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setDataConnections(TileWirelessBase target, IGridConnection connection) {
|
||||
if (connections.containsKey(target)) throw new IllegalStateException("Connection already set!");
|
||||
|
||||
connections.put(target, connection);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void removeDataConnections(TileWirelessBase target) {
|
||||
connections.remove(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TileWirelessBase> getConnectedTiles() {
|
||||
return ImmutableList.copyOf(connections.keySet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IGridConnection> getAllConnections() {
|
||||
return ImmutableList.copyOf(connections.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<TileWirelessBase, IGridConnection> getConnectionMap() {
|
||||
return ImmutableMap.copyOf(connections);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IGridConnection getConnection(TileWirelessBase target) {
|
||||
return connections.get(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BindResult doLink(TileWirelessBase target) {
|
||||
return setupConnection(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doUnlink(TileWirelessBase target) {
|
||||
breakConnection(target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doUnlink() {
|
||||
breakAllConnections();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tryRestoreConnection(Set<DimensionalCoord> locList) {
|
||||
final Iterator<DimensionalCoord> iterator = locList.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
final DimensionalCoord target = iterator.next();
|
||||
TileWirelessBase tile = getAndCheckTile(target, worldObj, null);
|
||||
if (tile == null) continue;
|
||||
final BindResult result = WireLessToolHelper.performConnection(tile, this, new MachineSource(this));
|
||||
if (result == BindResult.SUCCESS || result == BindResult.ALREADY_BIND) iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,8 +69,11 @@ import net.minecraftforge.common.util.FakePlayerFactory;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import com.glodblock.github.common.item.ItemFluidDrop;
|
||||
import com.glodblock.github.common.item.ItemFluidPacket;
|
||||
import com.gtnewhorizon.gtnhlib.keybind.SyncedKeybind;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
@@ -178,6 +181,9 @@ public class Platform {
|
||||
public static final boolean isBaublesLoaded = Loader.isModLoaded("Baubles|Expanded");
|
||||
public static final boolean isBackhandLoaded = Loader.isModLoaded("backhand");
|
||||
public static final boolean isPosteaLoaded = Loader.isModLoaded("postea");
|
||||
public static final boolean isGTLoaded = IntegrationRegistry.INSTANCE.isEnabled(IntegrationType.GT);
|
||||
public static final SyncedKeybind keyBindLCtrl = SyncedKeybind.create(Keyboard.KEY_LCONTROL);
|
||||
public static final SyncedKeybind keyBindTab = SyncedKeybind.create(Keyboard.KEY_TAB);
|
||||
public static final boolean isThaumicEnergisticsLoaded = Loader.isModLoaded("thaumicenergistics");
|
||||
public static final boolean isEndlessIdsLoaded = Loader.isModLoaded("endlessids");
|
||||
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
package appeng.util;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
|
||||
import com.gtnewhorizons.postea.api.BlockReplacementManager;
|
||||
import com.gtnewhorizons.postea.api.ItemStackReplacementManager;
|
||||
import com.gtnewhorizons.postea.api.TileEntityReplacementManager;
|
||||
import com.gtnewhorizons.postea.utility.BlockInfo;
|
||||
|
||||
import appeng.api.AEApi;
|
||||
import appeng.tile.misc.TileAdvancedInscriber;
|
||||
|
||||
public class ae2stuffConvertor implements Runnable {
|
||||
|
||||
public final static String ae2stuffGrower = "ae2stuff.Grower";
|
||||
public final static String ae2stuffInscriber = "ae2stuff.Inscriber";
|
||||
public final static String ae2stuffWireless = "ae2stuff.Wireless";
|
||||
|
||||
public final static String ae2stuffGrowerItem = "ae2stuff:Grower";
|
||||
public final static String ae2stuffInscriberItem = "ae2stuff:Inscriber";
|
||||
public final static String ae2stuffWirelessItem = "ae2stuff:Wireless";
|
||||
public final static String ae2stuffWirelessKit = "ae2stuff:WirelessKit";
|
||||
public final static String ae2stuffAdvWirelessKit = "ae2stuff:AdvWirelessKit";
|
||||
public final static String ae2stuffVisualizer = "ae2stuff:Visualiser";
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.ignoreMissingMappings();
|
||||
|
||||
// items
|
||||
ItemStackReplacementManager.addSimpleReplacement(
|
||||
ae2stuffWirelessKit,
|
||||
AEApi.instance().definitions().items().toolWirelessKit().maybeItem().get(),
|
||||
true);
|
||||
|
||||
ItemStackReplacementManager.addSimpleReplacement(
|
||||
ae2stuffAdvWirelessKit,
|
||||
AEApi.instance().definitions().items().toolWirelessKit().maybeItem().get(),
|
||||
true);
|
||||
|
||||
ItemStackReplacementManager.addSimpleReplacement(
|
||||
ae2stuffVisualizer,
|
||||
AEApi.instance().definitions().items().toolNetworkVisualiser().maybeItem().get(),
|
||||
true);
|
||||
|
||||
ItemStackReplacementManager.addSimpleReplacement(
|
||||
ae2stuffGrowerItem,
|
||||
AEApi.instance().definitions().blocks().crystalGrowthChamber().maybeItem().get(),
|
||||
true);
|
||||
|
||||
ItemStackReplacementManager.addSimpleReplacement(
|
||||
ae2stuffInscriberItem,
|
||||
AEApi.instance().definitions().blocks().advancedInscriber().maybeItem().get(),
|
||||
true);
|
||||
|
||||
final Item wireless = AEApi.instance().definitions().blocks().wirelessConnector().maybeItem().get();
|
||||
final Item hub = AEApi.instance().definitions().blocks().wirelessHub().maybeItem().get();
|
||||
for (int i = 0; i < 34; i++) {
|
||||
if (i > 16) {
|
||||
final int newMeta = i - 17;
|
||||
ItemStackReplacementManager.addSimpleReplacement(ae2stuffWirelessItem, i, hub, newMeta, true);
|
||||
} else {
|
||||
ItemStackReplacementManager.addSimpleReplacement(ae2stuffWirelessItem, i, wireless, i, true);
|
||||
}
|
||||
}
|
||||
|
||||
// tiles
|
||||
final Block growerBlock = Block
|
||||
.getBlockFromItem(AEApi.instance().definitions().blocks().crystalGrowthChamber().maybeItem().get());
|
||||
TileEntityReplacementManager.tileEntityTransformer(
|
||||
ae2stuffGrower,
|
||||
((tagCompound, world, chunk) -> new BlockInfo(growerBlock, 0, tag -> {
|
||||
final NBTTagCompound newNbt = new NBTTagCompound();
|
||||
|
||||
newNbt.setTag("inv", this.writeInv("item", tag.getTagList("Items", Constants.NBT.TAG_COMPOUND)));
|
||||
newNbt.setTag(
|
||||
"upgrades",
|
||||
this.writeInv("#", tag.getTagList("upgrades", Constants.NBT.TAG_COMPOUND)));
|
||||
|
||||
newNbt.setDouble("internalCurrentPower", tag.getDouble("power"));
|
||||
|
||||
newNbt.setString("id", "BlockCrystalGrowthChamber");
|
||||
newNbt.setTag("proxy", tag.getCompoundTag("ae_node"));
|
||||
newNbt.setInteger("x", tag.getInteger("x"));
|
||||
newNbt.setInteger("y", tag.getInteger("y"));
|
||||
newNbt.setInteger("z", tag.getInteger("z"));
|
||||
|
||||
return newNbt;
|
||||
})));
|
||||
|
||||
final Block advancedInscriberBlock = AEApi.instance().definitions().blocks().advancedInscriber().maybeBlock()
|
||||
.get();
|
||||
TileEntityReplacementManager.tileEntityTransformer(
|
||||
ae2stuffInscriber,
|
||||
((tagCompound, world, chunk) -> new BlockInfo(advancedInscriberBlock, 0, tag -> {
|
||||
final NBTTagCompound newNbt = new NBTTagCompound();
|
||||
|
||||
newNbt.setTag(
|
||||
TileAdvancedInscriber.NBT_INV,
|
||||
this.writeInv("#", tag.getTagList("Items", Constants.NBT.TAG_COMPOUND)));
|
||||
newNbt.setTag(
|
||||
TileAdvancedInscriber.NBT_UPGRADES,
|
||||
this.writeInv("#", tag.getTagList("upgrades", Constants.NBT.TAG_COMPOUND)));
|
||||
newNbt.setInteger(TileAdvancedInscriber.NBT_PROGRESS, Math.round(tag.getFloat("progress") * 100));
|
||||
newNbt.setBoolean(
|
||||
TileAdvancedInscriber.NBT_TOP_LOCKED,
|
||||
!tag.hasKey("topLocked") || tag.getBoolean("topLocked"));
|
||||
newNbt.setBoolean(
|
||||
TileAdvancedInscriber.NBT_BOTTOM_LOCKED,
|
||||
!tag.hasKey("bottomLocked") || tag.getBoolean("bottomLocked"));
|
||||
|
||||
if (tag.hasKey("output", Constants.NBT.TAG_COMPOUND)) {
|
||||
newNbt.setTag(TileAdvancedInscriber.NBT_PENDING_OUTPUT, tag.getCompoundTag("output").copy());
|
||||
}
|
||||
|
||||
newNbt.setDouble("internalCurrentPower", tag.getDouble("power"));
|
||||
newNbt.setString("id", "BlockAdvancedInscriber");
|
||||
newNbt.setTag("proxy", tag.getCompoundTag("ae_node"));
|
||||
newNbt.setInteger("x", tag.getInteger("x"));
|
||||
newNbt.setInteger("y", tag.getInteger("y"));
|
||||
newNbt.setInteger("z", tag.getInteger("z"));
|
||||
|
||||
return newNbt;
|
||||
})));
|
||||
|
||||
final Block connectorBlock = AEApi.instance().definitions().blocks().wirelessConnector().maybeBlock().get();
|
||||
final Block hubBlock = AEApi.instance().definitions().blocks().wirelessHub().maybeBlock().get();
|
||||
TileEntityReplacementManager.tileEntityTransformer(ae2stuffWireless, ((tag, world, chunk) -> {
|
||||
final NBTTagCompound newNbt = new NBTTagCompound();
|
||||
final boolean isHub = tag.getBoolean("isHub");
|
||||
|
||||
final int color = tag.getInteger("Color");
|
||||
if (isHub) {
|
||||
newNbt.setString("id", "BlockWirelessHub");
|
||||
} else {
|
||||
newNbt.setString("id", "BlockWirelessConnector");
|
||||
|
||||
if (tag.hasKey("link")) {
|
||||
final NBTTagCompound link = tag.getCompoundTag("link");
|
||||
final NBTTagCompound target = new NBTTagCompound();
|
||||
final NBTTagCompound targetPos = new NBTTagCompound();
|
||||
|
||||
targetPos.setInteger("dim", world.provider.dimensionId);
|
||||
targetPos.setInteger("x", link.getInteger("x"));
|
||||
targetPos.setInteger("y", link.getInteger("y"));
|
||||
targetPos.setInteger("z", link.getInteger("z"));
|
||||
|
||||
target.setTag("pos#0", targetPos);
|
||||
newNbt.setTag("connectedTargets", target);
|
||||
}
|
||||
}
|
||||
|
||||
if (color != 16) newNbt.setShort("Color", (short) color);
|
||||
newNbt.setTag("proxy", tag.getCompoundTag("ae_node"));
|
||||
newNbt.setInteger("x", tag.getInteger("x"));
|
||||
newNbt.setInteger("y", tag.getInteger("y"));
|
||||
newNbt.setInteger("z", tag.getInteger("z"));
|
||||
|
||||
return new BlockInfo(isHub ? hubBlock : connectorBlock, 0, nbtTagCompound -> newNbt);
|
||||
}));
|
||||
}
|
||||
|
||||
private void ignoreMissingMappings() {
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffGrowerItem);
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffInscriberItem);
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffWirelessItem);
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffWirelessKit);
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffAdvWirelessKit);
|
||||
ItemStackReplacementManager.ignoreMissingMapping(ae2stuffVisualizer);
|
||||
|
||||
BlockReplacementManager.ignoreMissingMapping(ae2stuffGrowerItem);
|
||||
BlockReplacementManager.ignoreMissingMapping(ae2stuffInscriberItem);
|
||||
BlockReplacementManager.ignoreMissingMapping(ae2stuffWirelessItem);
|
||||
}
|
||||
|
||||
private NBTTagCompound writeInv(final String prefix, final NBTTagList list) {
|
||||
final NBTTagCompound newTag = new NBTTagCompound();
|
||||
for (int i = 0; i < list.tagCount(); i++) newTag.setTag(prefix + i, list.getCompoundTagAt(i));
|
||||
return newTag;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ tile.appliedenergistics2.BlockGrinder.name=Quartz Grindstone
|
||||
tile.appliedenergistics2.BlockMatrixFrame.name=Matrix Frame
|
||||
tile.appliedenergistics2.BlockIOPort.name=ME IO Port
|
||||
tile.appliedenergistics2.BlockInscriber.name=Inscriber
|
||||
tile.appliedenergistics2.BlockAdvancedInscriber.name=Advanced Inscriber
|
||||
tile.appliedenergistics2.BlockInterface.name=ME Interface
|
||||
tile.appliedenergistics2.BlockQuantumLinkChamber.name=ME Quantum Link Chamber
|
||||
tile.appliedenergistics2.BlockQuantumRing.name=ME Quantum Ring
|
||||
@@ -71,6 +72,9 @@ tile.appliedenergistics2.BlockSingularityCraftingStorage.name=Singularity Crafti
|
||||
tile.appliedenergistics2.BlockPaint.name=Paint
|
||||
tile.appliedenergistics2.BlockSpatialLinkChamber.name=Spatial Link Chamber
|
||||
tile.appliedenergistics2.BlockSpatialNetworkRelay.name=Spatial Network Relay
|
||||
tile.appliedenergistics2.BlockWirelessConnector.name=Wireless Connector
|
||||
tile.appliedenergistics2.BlockWirelessHub.name=Wireless Hub
|
||||
tile.appliedenergistics2.BlockCrystalGrowthChamber.name=Crystal Growth Chamber
|
||||
|
||||
# Stairs
|
||||
tile.appliedenergistics2.ChiseledQuartzStairBlock.name=Chiseled Certus Quartz Stairs
|
||||
@@ -147,6 +151,11 @@ chat.appliedenergistics2.StorageInOtherDim=%d containing %d %d is located in dim
|
||||
chat.appliedenergistics2.PickBlockTerminalNotFound=AE2 wireless terminal not found.
|
||||
chat.appliedenergistics2.PatternRepeaterProvider=§5Provider§r - will provide pattern to current system from in front §5Accessor§r.
|
||||
chat.appliedenergistics2.PatternRepeaterAccessor=§5Accessor§r - will provide pattern to in front §5Provider§r.
|
||||
chat.appliedenergistics2.WirelessHighlighted=%d §e"%d§e"§r is now highlighted at %d, %d, %d
|
||||
chat.appliedenergistics2.WirelessInOtherDim=%d §e"%d§e"§r located in dimension: %d and can't be highlighted
|
||||
chat.appliedenergistics2.WirelessHighlighterPrefix=Wireless
|
||||
chat.appliedenergistics2.WirelessHighlighterNetworkPrefix=Wireless of network §e"%s§e"§r -
|
||||
chat.appliedenergistics2.WirelessHighlighterColorPrefix=Wireless color §e"%s§e"§r of network §e"%s§e"§r -
|
||||
|
||||
# Creative Tabs
|
||||
itemGroup.appliedenergistics2=Applied Energistics 2
|
||||
@@ -247,6 +256,10 @@ gui.appliedenergistics2.StoredPower=Stored Power
|
||||
gui.appliedenergistics2.MaxPower=Max Power
|
||||
gui.appliedenergistics2.QuartzCuttingKnife=Quartz Cutting Knife
|
||||
gui.appliedenergistics2.Inscriber=Inscriber
|
||||
gui.appliedenergistics2.AdvancedInscriber=Advanced Inscriber
|
||||
gui.appliedenergistics2.AdvancedInscriberLockOn=Locked - Can't be removed with automation
|
||||
gui.appliedenergistics2.AdvancedInscriberLockOff=Unlocked - Can be removed with automation
|
||||
gui.appliedenergistics2.AdvancedInscriberLockNote=If no process is ongoing and middle slot is empty
|
||||
gui.appliedenergistics2.Wireless=Wireless Access Point
|
||||
gui.appliedenergistics2.WirelessTerminal=Wireless Term
|
||||
gui.appliedenergistics2.NoPermissions=No Permissions Selected
|
||||
@@ -470,6 +483,18 @@ gui.appliedenergistics2.ControlButtonValuesDesc2=Negative buttons are mirrored
|
||||
gui.appliedenergistics2.SelectColor=Select a Color
|
||||
gui.appliedenergistics2.Selected=Selected
|
||||
|
||||
gui.appliedenergistics2.GuiWirelessKitColor=C: %s
|
||||
gui.appliedenergistics2.GuiWirelessKitNetwork=N: %s
|
||||
gui.appliedenergistics2.GuiWirelessKitSelfPos=S: %s
|
||||
gui.appliedenergistics2.GuiWirelessKitTargetPos=T: %s
|
||||
gui.appliedenergistics2.GuiWirelessKitChannelsUsage=Channels Usage: %s
|
||||
gui.appliedenergistics2.GuiWirelessKitNameFieldDesc=Rename connector in world or group in gui
|
||||
|
||||
gui.appliedenergistics2.GuiDimensionalCoord=§cX: %s§r,§aY: %s§r,§9Z: %s§r,§5DIM: %s
|
||||
gui.appliedenergistics2.GuiDimensionalCoordShort=§c%s§r, §a%s§r, §9%s§r, §5%s
|
||||
gui.appliedenergistics2.GuiDimensionalCoordNoDim=§cX: %s§r,§aY: %s§r,§9Z: %s
|
||||
gui.appliedenergistics2.GuiDimensionalCoordShortNoDim=§c%s§r, §a%s§r, §9%s
|
||||
|
||||
# GUI Colors - ARGB
|
||||
gui.color.appliedenergistics2.SearchboxFocused=6E000000
|
||||
gui.color.appliedenergistics2.SearchboxUnfocused=00000000
|
||||
@@ -742,6 +767,34 @@ gui.tooltips.appliedenergistics2.CPUOnlyAllowNonPlayerDesc=Only allow crafting r
|
||||
gui.tooltips.appliedenergistics2.Suspend=Click to stop this CPU from sending out crafts
|
||||
gui.tooltips.appliedenergistics2.Resume=Click to make this CPU send out crafts again
|
||||
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupBySingleName=Single
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupBySingleDesc=Each wireless is single unit
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupByNetworkName=Network
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupByNetworkDesc=All wireless in network is one unit
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupByColorName=Color
|
||||
gui.tooltips.appliedenergistics2.WirelessToolGroupByColorDesc=Wireless with same color and in same network is one unit
|
||||
gui.tooltips.appliedenergistics2.WirelessToolHideBoundedYesName=Hide bounded
|
||||
gui.tooltips.appliedenergistics2.WirelessToolHideBoundedYesDesc=Hide connectors with connection and hubs without free slots
|
||||
gui.tooltips.appliedenergistics2.WirelessToolHideBoundedNoName=Show bounded
|
||||
gui.tooltips.appliedenergistics2.WirelessToolHideBoundedNoDesc=Show connectors with connection and hubs without free slots
|
||||
|
||||
gui.tooltips.appliedenergistics2.WirelessKitPinButtonName=Pin
|
||||
gui.tooltips.appliedenergistics2.WirelessKitPinButtonDesc=Keep this unit in current row
|
||||
gui.tooltips.appliedenergistics2.WirelessKitMadChameleonRecolorName=Mad Chameleon
|
||||
gui.tooltips.appliedenergistics2.WirelessKitMadChameleonRecolorDesc=Recolor in color which not allow connect to neighbor wireless`s
|
||||
gui.tooltips.appliedenergistics2.WirelessKitaAE2StuffName=AE2Stuff converter
|
||||
gui.tooltips.appliedenergistics2.WirelessKitAE2StuffDesc=Replace ae2tuff connectors in networks with AE2 connections
|
||||
gui.tooltips.appliedenergistics2.WirelessKitIncludeConnectorsName=Include connectors
|
||||
gui.tooltips.appliedenergistics2.WirelessKitIncludeConnectorsDesc=Include connectors in manipulations
|
||||
gui.tooltips.appliedenergistics2.WirelessKitIncludeHubsName=Include hubs
|
||||
gui.tooltips.appliedenergistics2.WirelessKitIncludeHubsDesc=Include hubs in manipulations
|
||||
gui.tooltips.appliedenergistics2.WirelessKitDeleteName=Delete Network
|
||||
gui.tooltips.appliedenergistics2.WirelessKitDeleteDesc=Remove network from list
|
||||
gui.tooltips.appliedenergistics2.WirelessKitBindName=Bind
|
||||
gui.tooltips.appliedenergistics2.WirelessKitBindDesc=Bind wireless`s in 2nd row to wireless`s in 3rd row
|
||||
gui.tooltips.appliedenergistics2.WirelessKitUnbindName=Unbind
|
||||
gui.tooltips.appliedenergistics2.WirelessKitUnbindDesc=Break connection for wireless`s in 2nd row
|
||||
|
||||
gui.tooltips.appliedenergistics2.PinsSection=Pins section
|
||||
gui.tooltips.appliedenergistics2.PinsSectionActive=§6LMB§8 - §7Add player row\n§6RMB§8 - §7Remove player row\n§6CTRL + LMB§8 - §7Add crafting row\n§6CTRL + RMB§8 - §7Remove crafting row\n§6SHIFT + RMB§8 - §7Unpin§r
|
||||
gui.tooltips.appliedenergistics2.PinsSectionHint=Hold §6ALT§7 for keybinds
|
||||
@@ -826,6 +879,15 @@ waila.appliedenergistics2.IOBusSpeed=Speed: %s %s/t
|
||||
# Baubles Extended
|
||||
slot.Terminal=§aTerminal§7
|
||||
|
||||
waila.appliedenergistics2.wireless.connected=Connected to %s
|
||||
waila.appliedenergistics2.wireless.connected.multiple=Connected to %s Wireless (shift for details)
|
||||
waila.appliedenergistics2.wireless.connected.detailsTitle=Connected Wireless:
|
||||
waila.appliedenergistics2.wireless.connected.details= %s
|
||||
waila.appliedenergistics2.wireless.notconnected=Not Connected
|
||||
waila.appliedenergistics2.wireless.channels=Channels: %s
|
||||
waila.appliedenergistics2.wireless.power=Power Used: %s AE/t
|
||||
waila.appliedenergistics2.wireless.name=Name: %s
|
||||
|
||||
# Items
|
||||
item.appliedenergistics2.ItemBasicStorageCell.1k.name=§61k§r ME Storage Cell
|
||||
item.appliedenergistics2.ItemBasicStorageCell.4k.name=§e4k§r ME Storage Cell
|
||||
@@ -1012,6 +1074,83 @@ item.appliedenergistics2.ToolBiometricCard.name=Biometric Card
|
||||
|
||||
item.appliedenergistics2.ToolDebugCard.name=Dev.DebugCard
|
||||
item.appliedenergistics2.ToolReplicatorCard.name=Dev.ReplicatorCard
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.name=Network Visualisation Tool
|
||||
item.appliedenergistics2.ToolWirelessKit.name=Wireless Kit
|
||||
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.bound=§eVisualising network at %s
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode=Mode:
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.set=Mode changed to %s
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.full=§eShow Everything
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.nodes=§eShow Nodes
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.channels=§eShow Channels
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.nonum=§eShow Channels and Nodes
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.p2p=§eShow P2P Links
|
||||
item.appliedenergistics2.ToolNetworkVisualiser.mode.proxy=§eShow Crafting Input Proxy Links
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.BoundAdvancedFilled=§cTarget already in queue
|
||||
item.appliedenergistics2.WirelessMessages.Disconnected=Wireless %s disconnect %s
|
||||
item.appliedenergistics2.WirelessMessages.Failed=§cConnection failed
|
||||
item.appliedenergistics2.WirelessMessages.Connected=§aConnected to %s
|
||||
item.appliedenergistics2.WirelessMessages.TargetHubFull=§cTarget Hub is Full
|
||||
item.appliedenergistics2.WirelessMessages.SourceHubFull=§cHub at %s §cis Full
|
||||
item.appliedenergistics2.WirelessMessages.HubToHub=§cHub to Hub connection is not allowed
|
||||
item.appliedenergistics2.WirelessMessages.ModeToggle=Tab + R-Click for toggle mode
|
||||
item.appliedenergistics2.WirelessMessages.Security=Security violation - you are not allowed to modify this network
|
||||
item.appliedenergistics2.WirelessMessages.DimensionMismatch=Both connectors must be in the same dimension
|
||||
item.appliedenergistics2.WirelessMessages.InvalidTarget=§cInvalid target - must be Wireless Connector or Wireless Hub
|
||||
item.appliedenergistics2.WirelessMessages.Cleared=§aList of §e%s mode cleared
|
||||
item.appliedenergistics2.WirelessMessages.Mode=Mode: %s
|
||||
item.appliedenergistics2.WirelessMessages.SetMode=Mode changed to %s
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.Simple=§eSimple
|
||||
item.appliedenergistics2.WirelessMessages.SimpleEmpty=Click Wireless Connector to bind
|
||||
item.appliedenergistics2.WirelessMessages.SimpleBound=§aBound to %s
|
||||
item.appliedenergistics2.WirelessMessages.SimpleBounded=Click other Wireless Connector to connect
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.Advanced=§eAdvanced
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedActivated=%s §aactivated
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedNext=§9Next connector in queue: %s
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedHowToggle=Sneak + R-Click for toggle advanced modes
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedNoConnectors=No connectors found in queue. Try putting the tool into queueing mode and adding some
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueing=§aQueuing Mode
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueEmpty=§9Click Wireless Connectors to add to binding queue
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueNotEmpty=§9Current wireless connectors in queue:
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueingLineNotEmpty=§9Switch to Binding Line mode for perform connection
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueued=§aAdded connector at %s §ato queue
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueingHubQol=Ctrl + R-click for add all free hub slots to queue
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueingHub=§a%s hub slots added to queue
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueingTargetHubFull=All free slots of target hub already queued
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBinding=§aBinding Mode
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBindingEmpty=§9Switch to Queuing Mode to add connectors to queue
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBindingNotEmpty=§9Current wireless connectors in queue to be bound:
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBindingHubQol=Ctrl + R-click for connect to all free hub slots
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBindingHub=%s hub slots added to queue
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedQueueingLine=§aQueuing Line
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedBindingLine=§aBinding Line
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLineNotLine=Its not a line
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLineReset=Points is reseted
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLine1stAdded=§a1St point %s §ais added
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLine2ndAdded=§a2nd point %s §ais added
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLine1st=§91st point %s
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLine2nd=§92nd point %s
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLineEmpty1st=§9Click Wireless Connectors to select 1st point
|
||||
item.appliedenergistics2.WirelessMessages.AdvancedLineEmpty2nd=§9Click Wireless Connectors to select 2nd point
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.Super=§eSuper
|
||||
item.appliedenergistics2.WirelessMessages.SuperBound=§aNetwork at %s §aadded to list
|
||||
item.appliedenergistics2.WirelessMessages.SuperBoundFailed=§cNetwork already in list
|
||||
item.appliedenergistics2.WirelessMessages.SuperClear=Shift + Ctrl + R-click for clear current tool mode
|
||||
item.appliedenergistics2.WirelessMessages.SuperNetworkList=Network list:
|
||||
item.appliedenergistics2.WirelessMessages.Network=Network %sat %s
|
||||
item.appliedenergistics2.WirelessMessages.SuperNetworkListEmpty=There no networks in list
|
||||
|
||||
item.appliedenergistics2.WirelessMessages.rowBindSuccess=§aSuccess connected %s §ato %s
|
||||
item.appliedenergistics2.WirelessMessages.rowBindInvalidSource=§cInvalid source %s
|
||||
item.appliedenergistics2.WirelessMessages.rowBindInvalidTarget=§cInvalid target %s
|
||||
item.appliedenergistics2.WirelessMessages.rowBindFailed=§cCannot connect %s §cto %s
|
||||
|
||||
# Commands
|
||||
commands.ae2.usage=Commands provided by Applied Energistics 2 - use /ae2 list for a list, and /ae2 help _____ for help with a command.
|
||||
|
||||
|
After Width: | Height: | Size: 225 B |
|
After Width: | Height: | Size: 596 B |
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
6,
|
||||
6,
|
||||
5,
|
||||
4,
|
||||
3,
|
||||
2,
|
||||
1,
|
||||
0,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 143 B |
|
After Width: | Height: | Size: 902 B |
|
After Width: | Height: | Size: 2.8 KiB |
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"frames": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
4,
|
||||
3,
|
||||
2,
|
||||
1,
|
||||
0
|
||||
]
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 266 B |
|
After Width: | Height: | Size: 261 B |
|
After Width: | Height: | Size: 268 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 264 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 265 B |
|
After Width: | Height: | Size: 267 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 306 B |
|
After Width: | Height: | Size: 263 B |
|
After Width: | Height: | Size: 262 B |
|
After Width: | Height: | Size: 276 B |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 282 B |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 283 B |
|
After Width: | Height: | Size: 277 B |
|
After Width: | Height: | Size: 279 B |
|
After Width: | Height: | Size: 281 B |
|
After Width: | Height: | Size: 281 B |