Use ActionHelper#open whenever possible
This commit is contained in:
@@ -11,7 +11,6 @@ import exopandora.worldhandler.builder.impl.BuilderAdvancement.EnumMode;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.container.impl.GuiWorldHandler;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.gui.menu.impl.ILogicMapped;
|
||||
@@ -25,7 +24,6 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.AdvancementHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
@@ -132,7 +130,7 @@ public class ContentAdvancements extends Content
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderAdvancement.build(EnumActionType.REVOKE, EnumMode.EVERYTHING)).withParent(Contents.ADVANCEMENTS)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderAdvancement.build(EnumActionType.REVOKE, EnumMode.EVERYTHING)));
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.container.impl.GuiWorldHandler;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
@@ -99,7 +98,7 @@ public class ContentButcher extends Content
|
||||
container.add(this.radiusField);
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.configure"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.BUTCHER_SETTINGS.withParent(Contents.BUTCHER)));
|
||||
ActionHelper.open(Contents.BUTCHER_SETTINGS);
|
||||
}));
|
||||
|
||||
boolean enabled = this.radius != null && !this.radius.isEmpty();
|
||||
@@ -112,7 +111,7 @@ public class ContentButcher extends Content
|
||||
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.BUTCHER_PRESETS.withBuilder(this.builderButcher).withRadius(Integer.parseInt(this.radius)).withParent(Contents.BUTCHER)));
|
||||
ActionHelper.open(Contents.BUTCHER_PRESETS.withBuilder(this.builderButcher).withRadius(Integer.parseInt(this.radius)));
|
||||
}));
|
||||
slaughter.active = enabled;
|
||||
}
|
||||
|
||||
@@ -48,22 +48,22 @@ public class ContentButcherPresets extends ContentChild
|
||||
container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.passive_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MONSTER.equals(entity.getClassification()) && !EntityClassification.MISC.equals(entity.getClassification())).collect(Collectors.toList()), this.radius);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MONSTER.equals(entity.getClassification())).collect(Collectors.toList()), this.radius);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.players"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.entities"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getClassification()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class ContentContinue extends ContentChild
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builder, this.special);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.container.impl.GuiWorldHandler;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.gui.widget.button.EnumIcon;
|
||||
@@ -35,57 +34,27 @@ public class ContentMain extends Content
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.settings"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SETTINGS.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.settings"), () -> ActionHelper.open(Contents.SETTINGS)));
|
||||
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.potions"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.POTIONS.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.command_stack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.COMMAND_STACK.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.potions"), () -> ActionHelper.open(Contents.POTIONS)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.command_stack"), () -> ActionHelper.open(Contents.COMMAND_STACK)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.items"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CUSTOM_ITEM));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, new TranslationTextComponent("gui.worldhandler.blocks"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.EDIT_BLOCKS));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.entities"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SUMMON));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.items"), () -> ActionHelper.open(Contents.CUSTOM_ITEM)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, new TranslationTextComponent("gui.worldhandler.blocks"), () -> ActionHelper.open(Contents.EDIT_BLOCKS)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.entities"), () -> ActionHelper.open(Contents.SUMMON)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.world"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.WORLD_INFO));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, new TranslationTextComponent("gui.worldhandler.player"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.PLAYER));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.scoreboard"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SCOREBOARD_OBJECTIVES));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.world"), () -> ActionHelper.open(Contents.WORLD_INFO)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, new TranslationTextComponent("gui.worldhandler.player"), () -> ActionHelper.open(Contents.PLAYER)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.scoreboard"), () -> ActionHelper.open(Contents.SCOREBOARD_OBJECTIVES)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.change_world"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CHANGE_WORLD.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, new TranslationTextComponent("gui.worldhandler.resourcepack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().gameSettings.saveOptions();
|
||||
|
||||
@@ -2,6 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.realmsclient.gui.RealmsServerSlotButton.Action;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderGeneric;
|
||||
@@ -214,11 +215,11 @@ public class ContentMultiplayer extends Content
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).mergeStyle(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSaveOff).withParent(Contents.MULTIPLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSaveOff));
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.stop_server").mergeStyle(TextFormatting.RED), new StringTextComponent(this.builderStop.toActualCommand()), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderStop).withParent(Contents.MULTIPLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderStop));
|
||||
}));
|
||||
|
||||
button4.active = false;
|
||||
|
||||
@@ -135,19 +135,19 @@ public class ContentPlayer extends Content
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSpawnpoint).withParent(Contents.PLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSpawnpoint));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSetworldspawn).withParent(Contents.PLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSetworldspawn));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.kill").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderKill).withParent(Contents.PLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderKill));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").mergeStyle(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderClear).withParent(Contents.PLAYER)));
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderClear));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ public class ActionHelper
|
||||
{
|
||||
if(content.getBackContent() != null)
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(content.getBackContent()));
|
||||
ActionHelper.open(content.getBackContent());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,15 +181,15 @@ public class ActionHelper
|
||||
{
|
||||
if(BlockHelper.getFocusedBlock() instanceof AbstractSignBlock)
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SIGN_EDITOR));
|
||||
ActionHelper.open(Contents.SIGN_EDITOR);
|
||||
}
|
||||
else if(BlockHelper.getFocusedBlock() instanceof NoteBlock)
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.NOTE_EDITOR));
|
||||
ActionHelper.open(Contents.NOTE_EDITOR);
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.MAIN));
|
||||
ActionHelper.open(Contents.MAIN);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user