Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
20 changes: 10 additions & 10 deletions src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,8 +493,15 @@ 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 (MetaItems.TOOL_DATA_STICK.isItemEqual(heldStack) && dsi.onDataStickRightClick(playerIn, heldStack)) {
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;
}
}
Expand Down Expand Up @@ -654,14 +661,7 @@ public boolean onHardHammerClick(EntityPlayer playerIn, EnumHand hand, EnumFacin
return true;
}

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);
}
}
}
public void onLeftClick(EntityPlayer player, EnumFacing facing, CuboidRayTraceResult hitResult) {}

/**
* @return true if the player must sneak to rotate this metatileentity, otherwise false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -571,6 +572,7 @@ public void addInformation(ItemStack stack, @Nullable World player, List<String>
if (I18n.hasKey(mainKey)) {
tooltip.add(1, mainKey);
}
tooltip.add(2, I18n.format("gregtech.machine.copy_paste.tooltip"));
}

@Override
Expand All @@ -585,4 +587,51 @@ public void addToolUsages(ItemStack stack, @Nullable World world, List<String> 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"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand All @@ -274,12 +274,13 @@ public void registerAbilities(List<IFluidTank> 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() {
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/assets/gregtech/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions src/main/resources/assets/gregtech/lang/ru_ru.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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! Все начинается с вашего первого медного слитка.
Expand Down Expand Up @@ -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=Авто. ввод предметов включен
Expand Down
9 changes: 6 additions & 3 deletions src/main/resources/assets/gregtech/lang/zh_cn.lang
Original file line number Diff line number Diff line change
Expand Up @@ -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格方块
Expand Down Expand Up @@ -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输入仓配置数据

Expand Down