mirror of
https://github.com/alexcrea/CustomAnvil.git
synced 2026-06-23 16:16:17 +02:00
fix nowBook display value
This commit is contained in:
parent
47d8efda78
commit
1fd8501461
2 changed files with 15 additions and 17 deletions
|
|
@ -24,20 +24,26 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
||||||
protected final static String ITEM_PATH = ".item";
|
protected final static String ITEM_PATH = ".item";
|
||||||
protected final static String BOOK_PATH = ".book";
|
protected final static String BOOK_PATH = ".book";
|
||||||
|
|
||||||
private int beforeBook = -1;
|
private int beforeBook;
|
||||||
private int nowBook = -1;
|
private int nowBook;
|
||||||
|
|
||||||
protected EnchantCostSettingsGui(EnchantCostSettingFactory holder, int nowItem, int nowBook) {
|
protected EnchantCostSettingsGui(EnchantCostSettingFactory holder, int nowItem) {
|
||||||
super(holder, nowItem);
|
super(holder, nowItem);
|
||||||
|
|
||||||
this.beforeBook = nowBook;
|
|
||||||
this.nowBook = nowBook;
|
|
||||||
|
|
||||||
this.step = holder.steps[0];
|
this.step = holder.steps[0];
|
||||||
|
|
||||||
initStaticItem();
|
initStaticItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void initStepsValue() {
|
||||||
|
super.initStepsValue();
|
||||||
|
|
||||||
|
int nowBook = ((EnchantCostSettingFactory)this.holder).getConfiguredBookValue();
|
||||||
|
this.beforeBook = nowBook;
|
||||||
|
this.nowBook = nowBook;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Pattern getGuiPattern() {
|
public Pattern getGuiPattern() {
|
||||||
return new Pattern(
|
return new Pattern(
|
||||||
|
|
@ -102,12 +108,7 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
||||||
// assume holder is an instance of EnchantCostSettingFactory
|
// assume holder is an instance of EnchantCostSettingFactory
|
||||||
EnchantCostSettingFactory holder = ((EnchantCostSettingFactory) this.holder);
|
EnchantCostSettingFactory holder = ((EnchantCostSettingFactory) this.holder);
|
||||||
|
|
||||||
int nowBook;
|
int nowBook = this.nowBook;
|
||||||
if(this.nowBook == -1){
|
|
||||||
nowBook = holder.getConfiguredBookValue();
|
|
||||||
}else{
|
|
||||||
nowBook = this.nowBook;
|
|
||||||
}
|
|
||||||
|
|
||||||
// minus item
|
// minus item
|
||||||
GuiItem minusItem;
|
GuiItem minusItem;
|
||||||
|
|
@ -178,7 +179,6 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onSave() {
|
public boolean onSave() {
|
||||||
System.out.println("ON SAVE");
|
|
||||||
if(TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE){
|
if(TEMPORARY_DO_SAVE_TO_DISK_EVERY_CHANGE){
|
||||||
holder.config.getConfig().set(holder.configPath+ITEM_PATH, now);
|
holder.config.getConfig().set(holder.configPath+ITEM_PATH, now);
|
||||||
holder.config.getConfig().set(holder.configPath+BOOK_PATH, nowBook);
|
holder.config.getConfig().set(holder.configPath+BOOK_PATH, nowBook);
|
||||||
|
|
@ -237,10 +237,8 @@ public class EnchantCostSettingsGui extends IntSettingsGui {
|
||||||
public AbstractSettingGui create() {
|
public AbstractSettingGui create() {
|
||||||
// Get value or default
|
// Get value or default
|
||||||
int nowItem = getConfiguredValue();
|
int nowItem = getConfiguredValue();
|
||||||
// Get value or default
|
|
||||||
int nowBook = getConfiguredBookValue();
|
|
||||||
// create new gui
|
// create new gui
|
||||||
return new EnchantCostSettingsGui(this, nowItem, nowBook);
|
return new EnchantCostSettingsGui(this, nowItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,9 +33,9 @@ public class IntSettingsGui extends AbstractSettingGui{
|
||||||
this.now = now;
|
this.now = now;
|
||||||
this.step = holder.steps[0];
|
this.step = holder.steps[0];
|
||||||
|
|
||||||
|
initStepsValue();
|
||||||
prepareReturnToDefault();
|
prepareReturnToDefault();
|
||||||
updateValueDisplay();
|
updateValueDisplay();
|
||||||
initStepsValue();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue