From c854e19f068deb2b1cba7aa982dd0b684731db36 Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 21 Jul 2024 17:26:43 -0400 Subject: [PATCH 1/9] init --- .../api/capability/IDataStickIntractable.java | 2 +- .../api/metatileentity/MetaTileEntity.java | 11 ++-- .../SimpleMachineMetaTileEntity.java | 51 ++++++++++++++++++- .../appeng/MetaTileEntityMEInputBus.java | 9 ++-- .../appeng/MetaTileEntityMEInputHatch.java | 9 ++-- .../appeng/MetaTileEntityMEStockingBus.java | 2 +- .../appeng/MetaTileEntityMEStockingHatch.java | 2 +- .../resources/assets/gregtech/lang/en_us.lang | 8 +-- .../resources/assets/gregtech/lang/ru_ru.lang | 8 +-- .../resources/assets/gregtech/lang/zh_cn.lang | 9 ++-- 10 files changed, 87 insertions(+), 24 deletions(-) diff --git a/src/main/java/gregtech/api/capability/IDataStickIntractable.java b/src/main/java/gregtech/api/capability/IDataStickIntractable.java index 4b9d36ee6ff..dfd25f2c896 100644 --- a/src/main/java/gregtech/api/capability/IDataStickIntractable.java +++ b/src/main/java/gregtech/api/capability/IDataStickIntractable.java @@ -5,7 +5,7 @@ public interface IDataStickIntractable { - void onDataStickLeftClick(EntityPlayer player, ItemStack dataStick); + boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack dataStick); boolean onDataStickRightClick(EntityPlayer player, ItemStack dataStick); } diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 0369acfd850..dbae90e338a 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -493,11 +493,16 @@ public final void onCoverLeftClick(EntityPlayer playerIn, CuboidRayTraceResult r public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { ItemStack heldStack = playerIn.getHeldItem(hand); - if (this instanceof IDataStickIntractable dsi) { + if (this instanceof IDataStickIntractable dsi && !playerIn.isSneaking()) { if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && dsi.onDataStickRightClick(playerIn, heldStack)) { return true; } } + if (this instanceof IDataStickIntractable dsi && playerIn.isSneaking()) { + if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && dsi.onDataStickShiftRightClick(playerIn, heldStack)) { + return true; + } + } if (!playerIn.isSneaking() && openGUIOnRightClick()) { if (getWorld() != null && !getWorld().isRemote) { @@ -655,12 +660,12 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin } public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - if (this instanceof IDataStickIntractable dsi) { + /* if (this instanceof IDataStickIntractable dsi) { ItemStack stack = player.getHeldItemMainhand(); if (MetaItems.TOOL_DATA_STICK.isItemEqual(stack)) { dsi.onDataStickLeftClick(player, stack); } - } + } */ } /** diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index 4547f5eaac0..801c1ea7dcc 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -3,6 +3,7 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; +import gregtech.api.capability.IDataStickIntractable; import gregtech.api.capability.IGhostSlotConfigurable; import gregtech.api.capability.impl.EnergyContainerHandler; import gregtech.api.capability.impl.FluidHandlerProxy; @@ -66,7 +67,7 @@ import static gregtech.api.capability.GregtechDataCodes.*; public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity - implements IActiveOutputSide, IGhostSlotConfigurable { + implements IActiveOutputSide, IGhostSlotConfigurable, IDataStickIntractable { private final boolean hasFrontFacing; @@ -571,6 +572,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (I18n.hasKey(mainKey)) { tooltip.add(1, mainKey); } + tooltip.add(2, I18n.format("gregtech.machine.copy_paste.tooltip")); } @Override @@ -585,4 +587,51 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.soft_mallet.reset")); super.addToolUsages(stack, world, tooltip, advanced); } + + @Override + public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack dataStick) { + NBTTagCompound tag = new NBTTagCompound(); + tag.setTag("MachineData", writeConfigToTag()); + dataStick.setTagCompound(tag); + dataStick.setTranslatableName("gregtech.machine.import.data_stick.name"); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); + return true; + } + + protected NBTTagCompound writeConfigToTag() { + NBTTagCompound tag = new NBTTagCompound(); + if (this.circuitInventory != null) { + tag.setByte("GhostCircuit", (byte) this.circuitInventory.getCircuitValue()); + } + tag.setInteger("OutputFacing", getOutputFacingItems().getIndex()); + tag.setInteger("OutputFacingF", getOutputFacingFluids().getIndex()); + tag.setBoolean("AutoOutputItems", autoOutputItems); + tag.setBoolean("AutoOutputFluids", autoOutputFluids); + tag.setBoolean("AllowInputFromOutputSide", allowInputFromOutputSideItems); + tag.setBoolean("AllowInputFromOutputSideF", allowInputFromOutputSideFluids); + return tag; + } + + @Override + public final boolean onDataStickRightClick(EntityPlayer player, ItemStack dataStick) { + NBTTagCompound tag = dataStick.getTagCompound(); + if (tag == null || !tag.hasKey("MachineData")) { + return false; + } + readConfigFromTag(tag.getCompoundTag("MachineData")); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_paste_settings"), true); + return true; + } + + protected void readConfigFromTag(NBTTagCompound tag) { + if (tag.hasKey("GhostCircuit")) { + this.setGhostCircuitConfig(tag.getByte("GhostCircuit")); + } + this.setOutputFacingItems(EnumFacing.VALUES[tag.getInteger("OutputFacing")]); + this.setOutputFacingFluids(EnumFacing.VALUES[tag.getInteger("OutputFacingF")]); + this.setAutoOutputItems(tag.getBoolean("AutoOutputItems")); + this.setAutoOutputFluids(tag.getBoolean("AutoOutputFluids")); + this.setAllowInputFromOutputSideItems(tag.getBoolean("AllowInputFromOutputSide")); + this.setAllowInputFromOutputSideFluids(tag.getBoolean("AllowInputFromOutputSideF")); + } } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java index 3d4fea9abc0..b3539be8be1 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java @@ -319,7 +319,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.machine.item_bus.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.item_import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me_import_item_hatch.configs.tooltip")); - tooltip.add(I18n.format("gregtech.machine.me.copy_paste.tooltip")); + tooltip.add(I18n.format("gregtech.machine.copy_paste.tooltip")); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -350,12 +350,13 @@ public void setGhostCircuitConfig(int config) { } @Override - public final void onDataStickLeftClick(EntityPlayer player, ItemStack dataStick) { + public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack dataStick) { NBTTagCompound tag = new NBTTagCompound(); tag.setTag("MEInputBus", writeConfigToTag()); dataStick.setTagCompound(tag); dataStick.setTranslatableName("gregtech.machine.me.item_import.data_stick.name"); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.me.import_copy_settings"), true); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); + return true; } protected NBTTagCompound writeConfigToTag() { @@ -384,7 +385,7 @@ public final boolean onDataStickRightClick(EntityPlayer player, ItemStack dataSt } readConfigFromTag(tag.getCompoundTag("MEInputBus")); syncME(); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.me.import_paste_settings"), true); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_paste_settings"), true); return true; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java index 4e510077787..3c0484714fd 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java @@ -259,7 +259,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.fluid_import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me_import_fluid_hatch.configs.tooltip")); - tooltip.add(I18n.format("gregtech.machine.me.copy_paste.tooltip")); + tooltip.add(I18n.format("gregtech.machine.copy_paste.tooltip")); tooltip.add(I18n.format("gregtech.universal.enabled")); } @@ -274,12 +274,13 @@ public void registerAbilities(List list) { } @Override - public final void onDataStickLeftClick(EntityPlayer player, ItemStack dataStick) { + public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack dataStick) { NBTTagCompound tag = new NBTTagCompound(); tag.setTag("MEInputHatch", writeConfigToTag()); dataStick.setTagCompound(tag); dataStick.setTranslatableName("gregtech.machine.me.fluid_import.data_stick.name"); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.me.import_copy_settings"), true); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); + return true; } protected NBTTagCompound writeConfigToTag() { @@ -307,7 +308,7 @@ public final boolean onDataStickRightClick(EntityPlayer player, ItemStack dataSt } readConfigFromTag(tag.getCompoundTag("MEInputHatch")); syncME(); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.me.import_paste_settings"), true); + player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_paste_settings"), true); return true; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java index f8bd7a5850a..fdc0d15eb25 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingBus.java @@ -358,7 +358,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.machine.item_bus.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.stocking_item.tooltip")); tooltip.add(I18n.format("gregtech.machine.me_import_item_hatch.configs.tooltip")); - tooltip.add(I18n.format("gregtech.machine.me.copy_paste.tooltip")); + tooltip.add(I18n.format("gregtech.machine.copy_paste.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.stocking_item.tooltip.2")); tooltip.add(I18n.format("gregtech.universal.enabled")); } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java index fcc9e1e7d12..bdafdd1690f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEStockingHatch.java @@ -263,7 +263,7 @@ public void addInformation(ItemStack stack, @Nullable World player, @NotNull Lis tooltip.add(I18n.format("gregtech.machine.fluid_hatch.import.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.stocking_fluid.tooltip")); tooltip.add(I18n.format("gregtech.machine.me_import_fluid_hatch.configs.tooltip")); - tooltip.add(I18n.format("gregtech.machine.me.copy_paste.tooltip")); + tooltip.add(I18n.format("gregtech.machine.copy_paste.tooltip")); tooltip.add(I18n.format("gregtech.machine.me.stocking_fluid.tooltip.2")); tooltip.add(I18n.format("gregtech.universal.enabled")); } diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 8e9b4091db2..3151f3a5c00 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4497,6 +4497,11 @@ gregtech.machine.muffle.off=Sound Muffling: Disabled gregtech.machine.perfect_oc=Does not lose energy efficiency when overclocked. gregtech.machine.parallel_limit=Can run up to §b%d§r§7 Recipes at once. +gregtech.machine.copy_paste.tooltip=Shift Left-click with Data Stick to copy settings, right-click to apply +gregtech.machine.import_copy_settings=Saved settings to Data Stick +gregtech.machine.import_paste_settings=Applied settings from Data Stick +gregtech.machine.import.data_stick.name=§oMachine Configuration Data + gregtech.machine.ld_item_endpoint.name=Long Distance Item Pipeline Endpoint gregtech.machine.ld_fluid_endpoint.name=Long Distance Fluid Pipeline Endpoint gregtech.machine.endpoint.tooltip.min_length=§bMinimum Endpoint Distance: §f%d Blocks @@ -5310,9 +5315,6 @@ gregtech.machine.me.fluid_export.tooltip=Stores fluids directly into the ME netw gregtech.machine.me.fluid_export.tooltip.2=Can cache an infinite amount of fluid gregtech.machine.me.stocking_auto_pull_enabled=Auto-Pull Enabled gregtech.machine.me.stocking_auto_pull_disabled=Auto-Pull Disabled -gregtech.machine.me.copy_paste.tooltip=Left-click with Data Stick to copy settings, right-click to apply -gregtech.machine.me.import_copy_settings=Saved settings to Data Stick -gregtech.machine.me.import_paste_settings=Applied settings from Data Stick gregtech.machine.me.item_import.data_stick.name=§oME Input Bus Configuration Data gregtech.machine.me.fluid_import.data_stick.name=§oME Input Hatch Configuration Data diff --git a/src/main/resources/assets/gregtech/lang/ru_ru.lang b/src/main/resources/assets/gregtech/lang/ru_ru.lang index a1fc457f007..4ae5af58ee2 100644 --- a/src/main/resources/assets/gregtech/lang/ru_ru.lang +++ b/src/main/resources/assets/gregtech/lang/ru_ru.lang @@ -4125,6 +4125,11 @@ gregtech.machine.endpoint.tooltip.1=Соединяется с блоком §fТ gregtech.machine.endpoint.tooltip.2=Трубопровод обязан иметь §f1 Входную§7 и §f1 Выходную§7 конечную точку. gregtech.machine.endpoint.tooltip.3=Только Конечная точка трубопровода может находится в §fЗагруженном чанке§7. +gregtech.machine.copy_paste.tooltip=ЛКС с Флешкой для копирования, ПКМ для применения +gregtech.machine.import_copy_settings=Настройки сохранены в Флешку +gregtech.machine.import_paste_settings=Настройки из Флешки применены +#gregtech.machine.import.data_stick.name + # Advancements gregtech.advancement.root_steam.name=Эра пара gregtech.advancement.root_steam.desc=Добро пожаловать в GregTech! Все начинается с вашего первого медного слитка. @@ -5932,9 +5937,6 @@ gregtech.machine.me.stocking_item.tooltip=Извлекает предметы н gregtech.machine.me_import_item_hatch.configs.tooltip=Держит 16 предметов в наличии tile.gt_explosive.breaking_tooltip=При обычной добыче взрывается, добудьте с SHIFT, чтобы забрать обратно gregtech.machine.me.stocking_fluid.tooltip=Извлекает жидкости непосредственно из сети ME -gregtech.machine.me.copy_paste.tooltip=ЛКС с Флешкой для копирования, ПКМ для применения -gregtech.machine.me.import_copy_settings=Настройки сохранены в Флешку -gregtech.machine.me.import_paste_settings=Настройки из Флешки применены gregtech.machine.me.fluid_import.data_stick.name=§oНастройки ME Накопительного жидкостного люка gregtech.recipe.dimensions_blocked=Заблокированные измерения: %s gregtech.gui.item_auto_input.tooltip.enabled=Авто. ввод предметов включен diff --git a/src/main/resources/assets/gregtech/lang/zh_cn.lang b/src/main/resources/assets/gregtech/lang/zh_cn.lang index 1cc9087cde0..9b34e09c98e 100644 --- a/src/main/resources/assets/gregtech/lang/zh_cn.lang +++ b/src/main/resources/assets/gregtech/lang/zh_cn.lang @@ -4497,6 +4497,12 @@ gregtech.machine.muffle.off=静音:已禁用 gregtech.machine.perfect_oc=超频不会损失能效。 gregtech.machine.parallel_limit=可同时处理至多§b%d§7个配方。 +gregtech.machine.copy_paste.tooltip=左键点击闪存以复制设置,右键点击以应用 +gregtech.machine.import_copy_settings=已将设置保存到闪存 +gregtech.machine.import_paste_settings=已从闪存应用设置 +#gregtech.machine.import.data_stick.name + + gregtech.machine.ld_item_endpoint.name=长距离物品管道接口 gregtech.machine.ld_fluid_endpoint.name=长距离流体管道接口 gregtech.machine.endpoint.tooltip.min_length=§b最低接口间距:§f%d格方块 @@ -5309,9 +5315,6 @@ gregtech.machine.me.fluid_export.tooltip=将流体直接存储到ME网络中 gregtech.machine.me.fluid_export.tooltip.2=可以缓存无限数量的流体 gregtech.machine.me.stocking_auto_pull_enabled=ME自动拉取已启用 gregtech.machine.me.stocking_auto_pull_disabled=ME自动拉取已禁用 -gregtech.machine.me.copy_paste.tooltip=左键点击闪存以复制设置,右键点击以应用 -gregtech.machine.me.import_copy_settings=已将设置保存到闪存 -gregtech.machine.me.import_paste_settings=已从闪存应用设置 gregtech.machine.me.item_import.data_stick.name=§oME输入总线配置数据 gregtech.machine.me.fluid_import.data_stick.name=§oME输入仓配置数据 From 2224f5a0d97f11c6ed4af02b49e092167f1689cb Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 21 Jul 2024 17:27:27 -0400 Subject: [PATCH 2/9] spotless!!!!! --- .../api/metatileentity/MetaTileEntity.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index dbae90e338a..fec046b38e1 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -499,7 +499,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac } } if (this instanceof IDataStickIntractable dsi && playerIn.isSneaking()) { - if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && dsi.onDataStickShiftRightClick(playerIn, heldStack)) { + if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && + dsi.onDataStickShiftRightClick(playerIn, heldStack)) { return true; } } @@ -660,12 +661,14 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin } public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - /* if (this instanceof IDataStickIntractable dsi) { - ItemStack stack = player.getHeldItemMainhand(); - if (MetaItems.TOOL_DATA_STICK.isItemEqual(stack)) { - dsi.onDataStickLeftClick(player, stack); - } - } */ + /* + * if (this instanceof IDataStickIntractable dsi) { + * ItemStack stack = player.getHeldItemMainhand(); + * if (MetaItems.TOOL_DATA_STICK.isItemEqual(stack)) { + * dsi.onDataStickLeftClick(player, stack); + * } + * } + */ } /** From 24b3cb19d09808256ece367c527fd0eea13701fc Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 21 Jul 2024 17:31:41 -0400 Subject: [PATCH 3/9] Remove commented out code --- .../java/gregtech/api/metatileentity/MetaTileEntity.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index fec046b38e1..c7a6aa80d51 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -661,14 +661,7 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin } public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - /* - * if (this instanceof IDataStickIntractable dsi) { - * ItemStack stack = player.getHeldItemMainhand(); - * if (MetaItems.TOOL_DATA_STICK.isItemEqual(stack)) { - * dsi.onDataStickLeftClick(player, stack); - * } - * } - */ + } /** From 3468bbb565814207a05a594f0bdb4521b1664467 Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 21 Jul 2024 17:35:49 -0400 Subject: [PATCH 4/9] Slight formatting change --- .../java/gregtech/api/metatileentity/MetaTileEntity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index c7a6aa80d51..0ff2707af3b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -494,7 +494,8 @@ public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing fac CuboidRayTraceResult hitResult) { ItemStack heldStack = playerIn.getHeldItem(hand); if (this instanceof IDataStickIntractable dsi && !playerIn.isSneaking()) { - if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && dsi.onDataStickRightClick(playerIn, heldStack)) { + if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && + dsi.onDataStickRightClick(playerIn, heldStack)) { return true; } } @@ -660,9 +661,7 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin return true; } - public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) { - - } + public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) {} /** * @return true if the player must sneak to rotate this metatileentity, otherwise false From 3d0ab6f233e5b2eed87a100002c25904928162c2 Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Wed, 7 Aug 2024 21:31:19 -0400 Subject: [PATCH 5/9] Fix wording --- src/main/resources/assets/gregtech/lang/en_us.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 3151f3a5c00..90ab802968f 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4497,7 +4497,7 @@ gregtech.machine.muffle.off=Sound Muffling: Disabled gregtech.machine.perfect_oc=Does not lose energy efficiency when overclocked. gregtech.machine.parallel_limit=Can run up to §b%d§r§7 Recipes at once. -gregtech.machine.copy_paste.tooltip=Shift Left-click with Data Stick to copy settings, right-click to apply +gregtech.machine.copy_paste.tooltip=Shift right-click with Data Stick to copy settings, right-click to apply gregtech.machine.import_copy_settings=Saved settings to Data Stick gregtech.machine.import_paste_settings=Applied settings from Data Stick gregtech.machine.import.data_stick.name=§oMachine Configuration Data From e8de319d1e1dca508cf512e1b62c928a0973724f Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Wed, 7 Aug 2024 22:14:16 -0400 Subject: [PATCH 6/9] Add the type of machine to the data stick's name --- .../api/metatileentity/SimpleMachineMetaTileEntity.java | 3 ++- .../multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java | 3 ++- .../multiblockpart/appeng/MetaTileEntityMEInputHatch.java | 3 ++- src/main/resources/assets/gregtech/lang/en_us.lang | 4 +--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index 801c1ea7dcc..c4b4bc9dad4 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -593,7 +593,8 @@ public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack d NBTTagCompound tag = new NBTTagCompound(); tag.setTag("MachineData", writeConfigToTag()); dataStick.setTagCompound(tag); - dataStick.setTranslatableName("gregtech.machine.import.data_stick.name"); + dataStick.setStackDisplayName( + I18n.format("gregtech.machine.import.data_stick.name", I18n.format(getMetaFullName()))); player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); return true; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java index b3539be8be1..4c65d935e7f 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputBus.java @@ -354,7 +354,8 @@ public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack d NBTTagCompound tag = new NBTTagCompound(); tag.setTag("MEInputBus", writeConfigToTag()); dataStick.setTagCompound(tag); - dataStick.setTranslatableName("gregtech.machine.me.item_import.data_stick.name"); + dataStick.setStackDisplayName( + I18n.format("gregtech.machine.import.data_stick.name", I18n.format(getMetaFullName()))); player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); return true; } diff --git a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java index 3c0484714fd..ebbeb73c5ae 100644 --- a/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java +++ b/src/main/java/gregtech/common/metatileentities/multi/multiblockpart/appeng/MetaTileEntityMEInputHatch.java @@ -278,7 +278,8 @@ public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack d NBTTagCompound tag = new NBTTagCompound(); tag.setTag("MEInputHatch", writeConfigToTag()); dataStick.setTagCompound(tag); - dataStick.setTranslatableName("gregtech.machine.me.fluid_import.data_stick.name"); + dataStick.setStackDisplayName( + I18n.format("gregtech.machine.import.data_stick.name", I18n.format(getMetaFullName()))); player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); return true; } diff --git a/src/main/resources/assets/gregtech/lang/en_us.lang b/src/main/resources/assets/gregtech/lang/en_us.lang index 90ab802968f..da14f3f5059 100644 --- a/src/main/resources/assets/gregtech/lang/en_us.lang +++ b/src/main/resources/assets/gregtech/lang/en_us.lang @@ -4500,7 +4500,7 @@ gregtech.machine.parallel_limit=Can run up to §b%d§r§7 Recipes at once. gregtech.machine.copy_paste.tooltip=Shift right-click with Data Stick to copy settings, right-click to apply gregtech.machine.import_copy_settings=Saved settings to Data Stick gregtech.machine.import_paste_settings=Applied settings from Data Stick -gregtech.machine.import.data_stick.name=§oMachine Configuration Data +gregtech.machine.import.data_stick.name=§oMachine Configuration Data (%s) gregtech.machine.ld_item_endpoint.name=Long Distance Item Pipeline Endpoint gregtech.machine.ld_fluid_endpoint.name=Long Distance Fluid Pipeline Endpoint @@ -5315,8 +5315,6 @@ gregtech.machine.me.fluid_export.tooltip=Stores fluids directly into the ME netw gregtech.machine.me.fluid_export.tooltip.2=Can cache an infinite amount of fluid gregtech.machine.me.stocking_auto_pull_enabled=Auto-Pull Enabled gregtech.machine.me.stocking_auto_pull_disabled=Auto-Pull Disabled -gregtech.machine.me.item_import.data_stick.name=§oME Input Bus Configuration Data -gregtech.machine.me.fluid_import.data_stick.name=§oME Input Hatch Configuration Data # Universal tooltips gregtech.universal.tooltip.voltage_in=§aVoltage IN: §f%,d EU/t (%s§f) From 5e028c2b0e1138c75a01fc5d254483dcde9872a4 Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sat, 31 Aug 2024 23:55:39 -0400 Subject: [PATCH 7/9] Don't copy singleblock machines anymore --- .../SimpleMachineMetaTileEntity.java | 51 +------------------ 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index 45c2eb119bd..d82e58c50f5 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -3,7 +3,6 @@ import gregtech.api.GTValues; import gregtech.api.capability.GregtechTileCapabilities; import gregtech.api.capability.IActiveOutputSide; -import gregtech.api.capability.IDataStickIntractable; import gregtech.api.capability.IGhostSlotConfigurable; import gregtech.api.capability.impl.EnergyContainerHandler; import gregtech.api.capability.impl.FluidHandlerProxy; @@ -67,7 +66,7 @@ import static gregtech.api.capability.GregtechDataCodes.*; public class SimpleMachineMetaTileEntity extends WorkableTieredMetaTileEntity - implements IActiveOutputSide, IGhostSlotConfigurable, IDataStickIntractable { + implements IActiveOutputSide, IGhostSlotConfigurable { private final boolean hasFrontFacing; @@ -594,52 +593,4 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List t tooltip.add(I18n.format("gregtech.tool_action.soft_mallet.reset")); super.addToolUsages(stack, world, tooltip, advanced); } - - @Override - public final boolean onDataStickShiftRightClick(EntityPlayer player, ItemStack dataStick) { - NBTTagCompound tag = new NBTTagCompound(); - tag.setTag("MachineData", writeConfigToTag()); - dataStick.setTagCompound(tag); - dataStick.setStackDisplayName( - I18n.format("gregtech.machine.import.data_stick.name", I18n.format(getMetaFullName()))); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_copy_settings"), true); - return true; - } - - protected NBTTagCompound writeConfigToTag() { - NBTTagCompound tag = new NBTTagCompound(); - if (this.circuitInventory != null) { - tag.setByte("GhostCircuit", (byte) this.circuitInventory.getCircuitValue()); - } - tag.setInteger("OutputFacing", getOutputFacingItems().getIndex()); - tag.setInteger("OutputFacingF", getOutputFacingFluids().getIndex()); - tag.setBoolean("AutoOutputItems", autoOutputItems); - tag.setBoolean("AutoOutputFluids", autoOutputFluids); - tag.setBoolean("AllowInputFromOutputSide", allowInputFromOutputSideItems); - tag.setBoolean("AllowInputFromOutputSideF", allowInputFromOutputSideFluids); - return tag; - } - - @Override - public final boolean onDataStickRightClick(EntityPlayer player, ItemStack dataStick) { - NBTTagCompound tag = dataStick.getTagCompound(); - if (tag == null || !tag.hasKey("MachineData")) { - return false; - } - readConfigFromTag(tag.getCompoundTag("MachineData")); - player.sendStatusMessage(new TextComponentTranslation("gregtech.machine.import_paste_settings"), true); - return true; - } - - protected void readConfigFromTag(NBTTagCompound tag) { - if (tag.hasKey("GhostCircuit")) { - this.setGhostCircuitConfig(tag.getByte("GhostCircuit")); - } - this.setOutputFacingItems(EnumFacing.VALUES[tag.getInteger("OutputFacing")]); - this.setOutputFacingFluids(EnumFacing.VALUES[tag.getInteger("OutputFacingF")]); - this.setAutoOutputItems(tag.getBoolean("AutoOutputItems")); - this.setAutoOutputFluids(tag.getBoolean("AutoOutputFluids")); - this.setAllowInputFromOutputSideItems(tag.getBoolean("AllowInputFromOutputSide")); - this.setAllowInputFromOutputSideFluids(tag.getBoolean("AllowInputFromOutputSideF")); - } } From 4465f1caf30e7da63e71a0e299b236036da1602c Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 1 Sep 2024 00:07:32 -0400 Subject: [PATCH 8/9] This logic can be simpler --- .../api/metatileentity/MetaTileEntity.java | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java index 0ff2707af3b..baab104323b 100644 --- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java @@ -493,17 +493,13 @@ public final void onCoverLeftClick(EntityPlayer playerIn, CuboidRayTraceResult r public boolean onRightClick(EntityPlayer playerIn, EnumHand hand, EnumFacing facing, CuboidRayTraceResult hitResult) { ItemStack heldStack = playerIn.getHeldItem(hand); - if (this instanceof IDataStickIntractable dsi && !playerIn.isSneaking()) { - if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && - dsi.onDataStickRightClick(playerIn, heldStack)) { - return true; - } - } - if (this instanceof IDataStickIntractable dsi && playerIn.isSneaking()) { - if (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && - dsi.onDataStickShiftRightClick(playerIn, heldStack)) { - return true; - } + + if (this instanceof IDataStickIntractable dataStickIntractable && + MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack)) { + + return playerIn.isSneaking() ? + dataStickIntractable.onDataStickShiftRightClick(playerIn, heldStack) : + dataStickIntractable.onDataStickRightClick(playerIn, heldStack); } if (!playerIn.isSneaking() && openGUIOnRightClick()) { From 3171cbe72ff9bb9d51b31e5fa38eb96d253119a3 Mon Sep 17 00:00:00 2001 From: Zorbatron Date: Sun, 1 Sep 2024 00:10:37 -0400 Subject: [PATCH 9/9] Oopsies --- .../gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java index d82e58c50f5..ac0896d0305 100644 --- a/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java +++ b/src/main/java/gregtech/api/metatileentity/SimpleMachineMetaTileEntity.java @@ -578,7 +578,6 @@ public void addInformation(ItemStack stack, @Nullable World player, List if (I18n.hasKey(mainKey)) { tooltip.add(1, mainKey); } - tooltip.add(2, I18n.format("gregtech.machine.copy_paste.tooltip")); } @Override