Skip to content

Commit

Permalink
add pattern blame (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
Glease authored Oct 7, 2023
1 parent a00d3b1 commit 4ca326e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ else if (output == null) {
encodedValue.setBoolean("crafting", this.isCraftingMode());
encodedValue.setBoolean("substitute", this.isSubstitute());
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
encodedValue.setString("author", this.getPlayerInv().player.getCommandSenderName());

output.setTagCompound(encodedValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ else if (output == null) {
encodedValue.setBoolean("crafting", false);
encodedValue.setBoolean("substitute", this.isSubstitute());
encodedValue.setBoolean("beSubstitute", this.canBeSubstitute());
encodedValue.setString("author", this.getPlayerInv().player.getCommandSenderName());

output.setTagCompound(encodedValue);
}
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/appeng/core/localization/GuiText.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public enum GuiText {
BeSubstitute,
Yes,
No,
EncodedBy,

MolecularAssembler,

Expand Down Expand Up @@ -220,6 +221,10 @@ public String getLocal() {
return StatCollector.translateToLocal(this.getUnlocalized());
}

public String getLocal(Object... formatArgs) {
return StatCollector.translateToLocalFormatted(this.getUnlocalized(), formatArgs);
}

public String getUnlocalized() {
return this.root + '.' + this;
}
Expand Down
8 changes: 7 additions & 1 deletion src/main/java/appeng/helpers/PatternHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,13 @@ public PatternHelper(final ItemStack is, final World w) {
this.canSubstitute = encodedValue.getBoolean("substitute");
this.canBeSubstitute = encodedValue.getBoolean("beSubstitute");
this.patternItem = is;
this.pattern = AEItemStack.create(is);
if (encodedValue.hasKey("author")) {
final ItemStack forComparison = this.patternItem.copy();
forComparison.stackTagCompound.removeTag("author");
this.pattern = AEItemStack.create(forComparison);
} else {
this.pattern = AEItemStack.create(is);
}

final List<IAEItemStack> in = new ArrayList<>();
final List<IAEItemStack> out = new ArrayList<>();
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/appeng/items/misc/ItemEncodedPattern.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StringUtils;
import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.event.ForgeEventFactory;
Expand Down Expand Up @@ -104,6 +105,7 @@ public void addCheckedInformation(final ItemStack stack, final EntityPlayer play
final boolean isCrafting = encodedValue.getBoolean("crafting");
final boolean substitute = encodedValue.getBoolean("substitute");
final boolean beSubstitute = encodedValue.getBoolean("beSubstitute");
final String author = encodedValue.getString("author");
IAEItemStack[] inItems;
IAEItemStack[] outItems;

Expand Down Expand Up @@ -144,6 +146,10 @@ public void addCheckedInformation(final ItemStack stack, final EntityPlayer play

lines.add(substitutionLabel + canSubstitute);
lines.add(beSubstitutionLabel + canBeSubstitute);

if (!StringUtils.isNullOrEmpty(author)) {
lines.add(GuiText.EncodedBy.getLocal(author));
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ gui.appliedenergistics2.Substitute=Using Substitutions:
gui.appliedenergistics2.BeSubstitute=Can be a substitution:
gui.appliedenergistics2.Yes=Yes
gui.appliedenergistics2.No=No
gui.appliedenergistics2.EncodedBy=Encoded by: %s
gui.appliedenergistics2.InWorldCrafting=AE2 In World Crafting
gui.appliedenergistics2.inWorldFluix=Drop 1 Charged Certus Quartz + 1 Nether Quartz + Redstone Dust into a puddle next to one another and wait a moment to receive 2 Fluix Crystals.
gui.appliedenergistics2.inWorldPurificationCertus=Drop a Certus Quartz Seed made from Certus Quartz Dust and Sand into a puddle of water; to make the process faster add Crystal Growth Accelerators.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ gui.appliedenergistics2.With=使用
gui.appliedenergistics2.Substitute=启用替换:
gui.appliedenergistics2.Yes=是
gui.appliedenergistics2.No=否
gui.appliedenergistics2.EncodedBy=编写者:%s
gui.appliedenergistics2.InWorldCrafting=AE2在世界中的合成
gui.appliedenergistics2.inWorldFluix=将1个充能赛特斯石英水晶,1个下界石英和1个红石,相继扔进同一格水里,并等待一会儿.
gui.appliedenergistics2.inWorldPurificationCertus=用赛特斯石英粉和沙子制作赛特斯石英种子,并扔进水里;使用晶体催生器可以让这个过程变得更快.
Expand Down

0 comments on commit 4ca326e

Please sign in to comment.