Add getter for parent content

This commit is contained in:
Marcel Konrad
2019-11-11 16:20:41 +01:00
parent 644b10bdbf
commit 3ce935d714
3 changed files with 9 additions and 4 deletions

View File

@@ -94,6 +94,6 @@ public class ContentButcherSettings extends ContentChild
@Override @Override
public String getTitle() public String getTitle()
{ {
return this.parent.getTitle(); return this.getParentContent().getTitle();
} }
} }

View File

@@ -9,7 +9,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public abstract class ContentChild extends Content public abstract class ContentChild extends Content
{ {
protected Content parent; private Content parent;
public ContentChild withParent(Content parent) public ContentChild withParent(Content parent)
{ {
@@ -55,4 +55,9 @@ public abstract class ContentChild extends Content
{ {
return this.parent; return this.parent;
} }
public Content getParentContent()
{
return this.parent;
}
} }

View File

@@ -68,7 +68,7 @@ public class ContentContinue extends ContentChild
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, TextFormatting.RED + I18n.format("gui.worldhandler.generic.yes"), () -> container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, TextFormatting.RED + I18n.format("gui.worldhandler.generic.yes"), () ->
{ {
CommandHelper.sendCommand(this.builder, this.special); CommandHelper.sendCommand(this.builder, this.special);
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.parent)); Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
})); }));
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, I18n.format("gui.worldhandler.generic.no"), () -> ActionHelper.back(this))); container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, I18n.format("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
} }
@@ -82,6 +82,6 @@ public class ContentContinue extends ContentChild
@Override @Override
public String getTitle() public String getTitle()
{ {
return this.parent.getTitle(); return this.getParentContent().getTitle();
} }
} }