mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 00:38:35 +01:00
Added the ability to add text replacements via the API
This commit is contained in:
parent
3b3d28c3fc
commit
1e00615aaa
2 changed files with 19 additions and 17 deletions
|
@ -16,10 +16,14 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public abstract class BookletPage{
|
||||
|
||||
public boolean arePageStacksWildcard;
|
||||
protected IBookletChapter chapter;
|
||||
protected final HashMap<String, String> textReplacements = new HashMap<String, String>();
|
||||
protected boolean hasNoText;
|
||||
|
||||
public void onOpened(IBookletGui gui){
|
||||
|
||||
|
@ -88,4 +92,18 @@ public abstract class BookletPage{
|
|||
this.arePageStacksWildcard = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPage setNoText(){
|
||||
this.hasNoText = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPage addTextReplacement(String text, int replacement){
|
||||
return this.addTextReplacement(text, Integer.toString(replacement));
|
||||
}
|
||||
|
||||
public BookletPage addTextReplacement(String text, String replacement){
|
||||
this.textReplacements.put(text, replacement);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,8 +26,6 @@ import java.util.Map;
|
|||
public class BookletPageAA extends BookletPage{
|
||||
|
||||
protected final int localizationKey;
|
||||
private final HashMap<String, String> textReplacements = new HashMap<String, String>();
|
||||
private boolean hasNoText;
|
||||
|
||||
public BookletPageAA(int localizationKey){
|
||||
this.localizationKey = localizationKey;
|
||||
|
@ -39,7 +37,7 @@ public class BookletPageAA extends BookletPage{
|
|||
}
|
||||
|
||||
@Override
|
||||
public final String getText(){
|
||||
public String getText(){
|
||||
if(this.hasNoText){
|
||||
return null;
|
||||
}
|
||||
|
@ -83,20 +81,6 @@ public class BookletPageAA extends BookletPage{
|
|||
return TextFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID+".clickToSeeRecipe");
|
||||
}
|
||||
|
||||
public BookletPage setNoText(){
|
||||
this.hasNoText = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BookletPageAA addTextReplacement(String text, int replacement){
|
||||
return this.addTextReplacement(text, Integer.toString(replacement));
|
||||
}
|
||||
|
||||
public BookletPageAA addTextReplacement(String text, String replacement){
|
||||
this.textReplacements.put(text, replacement);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void addToPagesWithItemStackData(){
|
||||
if(!ActuallyAdditionsAPI.BOOKLET_PAGES_WITH_ITEM_DATA.contains(this)){
|
||||
ItemStack[] stacks = this.getItemStacksForPage();
|
||||
|
|
Loading…
Reference in a new issue