Update to 1.19.3
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
mod_id = worldhandler
|
||||
mod_name = WorldHandler
|
||||
version = 3.4.1
|
||||
minecraft_version = 1.19.2
|
||||
minecraft_version = 1.19.3
|
||||
group = exopandora.worldhandler
|
||||
main_class = exopandora.worldhandler.Main
|
||||
author = Exopandora
|
||||
|
||||
# Forge
|
||||
forge_version = 43.0.0
|
||||
forge_version = 44.0.1
|
||||
|
||||
# Gradle
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
|
||||
@@ -13,6 +13,7 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.util.AdvancementHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterClientCommandsEvent;
|
||||
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
|
||||
@@ -28,6 +29,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig.Type;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
@@ -61,6 +63,7 @@ public class WorldHandler
|
||||
modLoadingContext.registerExtensionPoint(DisplayTest.class, () -> new DisplayTest(() -> "ANY", (remote, isServer) -> true));
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
modEventBus.addListener(this::commonSetup);
|
||||
modEventBus.addListener(this::loadComplete);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -77,6 +80,12 @@ public class WorldHandler
|
||||
MinecraftForge.EVENT_BUS.addListener(this::registerCommands);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void loadComplete(FMLLoadCompleteEvent event)
|
||||
{
|
||||
RegistryHelper.init();
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerKeyMappingsEvent(RegisterKeyMappingsEvent event)
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ package exopandora.worldhandler.builder.argument;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -26,7 +26,7 @@ public class DimensionArgument implements IDeserializableArgument
|
||||
{
|
||||
if(dimension != null)
|
||||
{
|
||||
this.set(ResourceKey.create(Registry.DIMENSION_REGISTRY, dimension));
|
||||
this.set(ResourceKey.create(Registries.DIMENSION, dimension));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -77,7 +77,7 @@ public class CommandWorldHandler
|
||||
throw COMMANDS_ALREADY_ALLOWED.create();
|
||||
}
|
||||
|
||||
worldData.settings = new LevelSettings(settings.levelName(), settings.gameType(), settings.hardcore(), settings.difficulty(), true, settings.gameRules(), settings.getDataPackConfig(), settings.getLifecycle());
|
||||
worldData.settings = new LevelSettings(settings.levelName(), settings.gameType(), settings.hardcore(), settings.difficulty(), true, settings.gameRules(), settings.getDataConfiguration(), settings.getLifecycle());
|
||||
int operatorPermissionLevel = server.getOperatorUserPermissionLevel();
|
||||
Minecraft.getInstance().player.setPermissionLevel(operatorPermissionLevel);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.usercontent.UsercontentConfig;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.usercontent.model.JsonTab;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import exopandora.worldhandler.util.TranslationHelper;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -91,13 +91,13 @@ public class Category
|
||||
{
|
||||
if(event.getRegistryKey().equals(REGISTRY_KEY))
|
||||
{
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "main", () -> new Category("main", "containers", "multiplayer"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "entities", () -> new Category("summon", "butcher"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "items", () -> new Category("custom_item", "enchantment", "recipes"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "blocks", () -> new Category("edit_blocks", "sign_editor", "note_editor"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "world", () -> new Category("world", "gamerules", "locate"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "player", () -> new Category("player", "experience", "advancements"));
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "scoreboard", () -> new Category("scoreboard_objectives", "scoreboard_teams", "scoreboard_players"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "main", () -> new Category("main", "containers", "multiplayer"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "entities", () -> new Category("summon", "butcher"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "items", () -> new Category("custom_item", "enchantment", "recipes"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "blocks", () -> new Category("edit_blocks", "sign_editor", "note_editor"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "world", () -> new Category("world", "gamerules", "locate"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "player", () -> new Category("player", "experience", "advancements"));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "scoreboard", () -> new Category("scoreboard_objectives", "scoreboard_teams", "scoreboard_players"));
|
||||
|
||||
for(UsercontentConfig config : UsercontentLoader.CONFIGS)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ public class Category
|
||||
{
|
||||
if(!Categories.isRegistered(tab.getCategory()))
|
||||
{
|
||||
RegistryHelper.register(event, REGISTRY_KEY, tab.getCategory(), () -> new Category(id));
|
||||
TranslationHelper.register(event, REGISTRY_KEY, tab.getCategory(), () -> new Category(id));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -5,9 +5,7 @@ import java.util.List;
|
||||
|
||||
import exopandora.worldhandler.gui.widget.menu.IMenu;
|
||||
import exopandora.worldhandler.gui.widget.menu.Menu;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
@@ -16,41 +14,44 @@ import net.minecraft.network.chat.Component;
|
||||
public abstract class Container extends Screen implements IContainer
|
||||
{
|
||||
protected final List<IMenu> menus = new ArrayList<IMenu>();
|
||||
protected final List<AbstractWidget> widgetButtons = new ArrayList<AbstractWidget>();
|
||||
|
||||
protected Container(Component title)
|
||||
{
|
||||
super(title);
|
||||
}
|
||||
|
||||
// Workaround protected modifier
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
}
|
||||
|
||||
// Workaround protected modifier
|
||||
@Override
|
||||
public <T extends GuiEventListener & Widget & NarratableEntry> T add(T button)
|
||||
public <T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T widget)
|
||||
{
|
||||
return super.addRenderableWidget(button);
|
||||
return super.addRenderableWidget(widget);
|
||||
}
|
||||
|
||||
public <T extends EditBox> T add(T textfield)
|
||||
// Workaround protected modifier
|
||||
@Override
|
||||
public <T extends Renderable> T addRenderableOnly(T widget)
|
||||
{
|
||||
return super.addWidget(textfield);
|
||||
return super.addRenderableOnly(widget);
|
||||
}
|
||||
|
||||
// Workaround protected modifier
|
||||
@Override
|
||||
public <T extends GuiEventListener & NarratableEntry> T addWidget(T widget)
|
||||
{
|
||||
return super.addWidget(widget);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Menu add(Menu menu)
|
||||
public Menu addMenu(Menu menu)
|
||||
{
|
||||
this.menus.add(menu);
|
||||
return menu;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractWidget addWidget(AbstractWidget button)
|
||||
{
|
||||
this.widgetButtons.add(button);
|
||||
return button;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,18 +2,18 @@ package exopandora.worldhandler.gui.container;
|
||||
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.widget.menu.Menu;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
|
||||
public interface IContainer
|
||||
{
|
||||
<T extends GuiEventListener & Widget & NarratableEntry> T add(T button);
|
||||
|
||||
void initButtons();
|
||||
Menu add(Menu menu);
|
||||
AbstractWidget addWidget(AbstractWidget button);
|
||||
|
||||
<T extends GuiEventListener & Renderable & NarratableEntry> T addRenderableWidget(T widget);
|
||||
<T extends Renderable> T addRenderableOnly(T widget);
|
||||
<T extends GuiEventListener & NarratableEntry> T addWidget(T widget);
|
||||
Menu addMenu(Menu menu);
|
||||
|
||||
String getPlayer();
|
||||
void setPlayer(String text);
|
||||
|
||||
@@ -27,7 +27,7 @@ import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class GuiWorldHandler extends Container
|
||||
@@ -56,7 +56,6 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
ActionHelper.tryRun(() ->
|
||||
{
|
||||
this.widgetButtons.clear();
|
||||
this.menus.clear();
|
||||
this.clearWidgets();
|
||||
|
||||
@@ -90,7 +89,6 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
this.clearWidgets();
|
||||
this.content.initButtons(this, this.getContentX(), this.getContentY());
|
||||
this.widgetButtons.forEach(w -> this.addRenderableWidget(w));
|
||||
|
||||
int x = this.getContentX();
|
||||
int y = this.getContentY();
|
||||
@@ -205,11 +203,11 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
if(Config.getSettings().tooltips())
|
||||
{
|
||||
for(Widget button : this.renderables)
|
||||
for(Renderable renderable : this.renderables)
|
||||
{
|
||||
if(button instanceof GuiButtonTooltip)
|
||||
if(renderable instanceof GuiButtonTooltip)
|
||||
{
|
||||
((GuiButtonTooltip) button).renderTooltip(this, stack, mouseX, mouseY);
|
||||
((GuiButtonTooltip) renderable).renderTooltip(this, stack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import exopandora.worldhandler.gui.content.impl.ContentSummon;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentUsercontent;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentWorldInfo;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import exopandora.worldhandler.util.TranslationHelper;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
@@ -64,54 +64,54 @@ public abstract class Content implements IContent
|
||||
if(event.getRegistryKey().equals(REGISTRY_KEY))
|
||||
{
|
||||
//MAIN
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "main", () -> new ContentMain());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "containers", () -> new ContentContainers());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "multiplayer", () -> new ContentMultiplayer());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "main", () -> new ContentMain());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "containers", () -> new ContentContainers());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "multiplayer", () -> new ContentMultiplayer());
|
||||
|
||||
//ENTITIES
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "summon", () -> new ContentSummon());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "butcher", () -> new ContentButcher());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "butcher_settings", () -> new ContentButcherSettings());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "butcher_presets", () -> new ContentButcherPresets());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "summon", () -> new ContentSummon());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "butcher", () -> new ContentButcher());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "butcher_settings", () -> new ContentButcherSettings());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "butcher_presets", () -> new ContentButcherPresets());
|
||||
|
||||
//ITEMS
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "custom_item", () -> new ContentCustomItem());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "enchantment", () -> new ContentEnchantment());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "recipes", () -> new ContentRecipes());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "custom_item", () -> new ContentCustomItem());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "enchantment", () -> new ContentEnchantment());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "recipes", () -> new ContentRecipes());
|
||||
|
||||
//BLOCKS
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "edit_blocks", () -> new ContentEditBlocks());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "sign_editor", () -> new ContentSignEditor());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "note_editor", () -> new ContentNoteEditor());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "edit_blocks", () -> new ContentEditBlocks());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "sign_editor", () -> new ContentSignEditor());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "note_editor", () -> new ContentNoteEditor());
|
||||
|
||||
//WORLD
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "world", () -> new ContentWorldInfo());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "gamerules", () -> new ContentGamerules());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "locate", () -> new ContentLocate());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "world", () -> new ContentWorldInfo());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "gamerules", () -> new ContentGamerules());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "locate", () -> new ContentLocate());
|
||||
|
||||
//PLAYER
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "player", () -> new ContentPlayer());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "experience", () -> new ContentExperience());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "advancements", () -> new ContentAdvancements());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "player", () -> new ContentPlayer());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "experience", () -> new ContentExperience());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "advancements", () -> new ContentAdvancements());
|
||||
|
||||
//SCOREBOARD
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "scoreboard_objectives", () -> new ContentScoreboardObjectives());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "scoreboard_teams", () -> new ContentScoreboardTeams());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "scoreboard_players", () -> new ContentScoreboardPlayers());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "scoreboard_objectives", () -> new ContentScoreboardObjectives());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "scoreboard_teams", () -> new ContentScoreboardTeams());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "scoreboard_players", () -> new ContentScoreboardPlayers());
|
||||
|
||||
//MISC
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "change_world", () -> new ContentChangeWorld());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "continue", () -> new ContentContinue());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "change_world", () -> new ContentChangeWorld());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "continue", () -> new ContentContinue());
|
||||
|
||||
//NO CATEGORY
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "potions", () -> new ContentPotions());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "command_stack", () -> new ContentCommandStack());
|
||||
RegistryHelper.register(event, REGISTRY_KEY, "settings", () -> new ContentSettings());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "potions", () -> new ContentPotions());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "command_stack", () -> new ContentCommandStack());
|
||||
TranslationHelper.register(event, REGISTRY_KEY, "settings", () -> new ContentSettings());
|
||||
|
||||
//USERCONTENT
|
||||
UsercontentLoader.CONFIGS.forEach(config ->
|
||||
{
|
||||
RegistryHelper.register(event, REGISTRY_KEY, config.getId(), () ->
|
||||
TranslationHelper.register(event, REGISTRY_KEY, config.getId(), () ->
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -81,16 +81,16 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(list);
|
||||
container.addMenu(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonList<Mode>(x + 118, y, Arrays.asList(Mode.values()), 114, 20, container, new ILogicMapped<Mode>()
|
||||
container.addRenderableWidget(new GuiButtonList<Mode>(x + 118, y, Arrays.asList(Mode.values()), 114, 20, container, new ILogicMapped<Mode>()
|
||||
{
|
||||
@Override
|
||||
public MutableComponent translate(Mode mode)
|
||||
@@ -117,15 +117,15 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.advancements.grant"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.advancements.grant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement, this.mode.getGrant());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.advancements.revoke"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.advancements.revoke"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement, this.mode.getRevoke());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderAdvancement, AdvancementCommandBuilder.Label.REVOKE_EVERYTHING));
|
||||
}));
|
||||
|
||||
@@ -90,25 +90,25 @@ public class ContentButcher extends Content
|
||||
{
|
||||
GuiButtonBase slaughter;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(this.radiusField);
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, Component.translatable("gui.worldhandler.butcher.configure"), () ->
|
||||
container.addRenderableWidget(this.radiusField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 58, y + 24, 114, 20, Component.translatable("gui.worldhandler.butcher.configure"), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.BUTCHER_SETTINGS);
|
||||
}));
|
||||
|
||||
boolean enabled = this.radius != null && !this.radius.isEmpty();
|
||||
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.slaughter"), () ->
|
||||
container.addRenderableWidget(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.slaughter"), () ->
|
||||
{
|
||||
Collection<EntityType<?>> entities = Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITY_TYPES::getValue).filter(Predicates.notNull()).collect(Collectors.toList());
|
||||
ContentButcher.slaughter(container.getPlayer(), entities, Integer.parseInt(this.radius));
|
||||
}));
|
||||
slaughter.active = enabled && !Config.getButcher().getEntities().isEmpty();
|
||||
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 72, 114, 20, Component.translatable("gui.worldhandler.butcher.presets"), () ->
|
||||
container.addRenderableWidget(slaughter = new GuiButtonBase(x + 58, y + 72, 114, 20, Component.translatable("gui.worldhandler.butcher.presets"), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.BUTCHER_PRESETS.withBuilder(this.builderKill, KillCommandBuilder.Label.KILL_TARGETS).withRadius(Double.parseDouble(this.radius)));
|
||||
}));
|
||||
|
||||
@@ -37,25 +37,25 @@ public class ContentButcherPresets extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 58, y, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.passive_mobs"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 58, y, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.passive_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> !MobCategory.MONSTER.equals(entity.getCategory()) && !MobCategory.MISC.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 58, y + 24, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> MobCategory.MONSTER.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.players"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 58, y + 48, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.players"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.entities"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 58, y + 72, 114, 20, Component.translatable("gui.worldhandler.butcher.presets.entities"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITY_TYPES.getValues().stream().filter(entity -> MobCategory.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ContentButcherSettings extends ContentChild
|
||||
}
|
||||
});
|
||||
|
||||
container.add(entities);
|
||||
container.addMenu(entities);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -69,15 +69,15 @@ public class ContentButcherSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().addEntity(this.entity);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().removeEntity(this.entity);
|
||||
container.initButtons();
|
||||
|
||||
@@ -26,16 +26,16 @@ public class ContentChangeWorld extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, Component.translatable("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, Component.translatable("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
{
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
Minecraft.getInstance().setScreen(new SelectWorldScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, Component.translatable("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, Component.translatable("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
{
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
DummyScreen dummy = new DummyScreen(() -> ContentChangeWorld.reconnect(connection));
|
||||
|
||||
@@ -130,8 +130,8 @@ public class ContentCommandStack extends ContentChild
|
||||
GuiButtonBase buttonScrollUp;
|
||||
GuiButtonBase buttonScrollDown;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
this.iterate(index ->
|
||||
{
|
||||
@@ -139,17 +139,17 @@ public class ContentCommandStack extends ContentChild
|
||||
GuiButtonBase buttonDown;
|
||||
GuiButtonBase buttonRemove;
|
||||
|
||||
container.add(buttonUp = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 - 1, 20, 10, EnumIcon.ARROW_UP, Component.translatable("gui.worldhandler.actions.move_up"), () ->
|
||||
container.addRenderableWidget(buttonUp = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 - 1, 20, 10, EnumIcon.ARROW_UP, Component.translatable("gui.worldhandler.actions.move_up"), () ->
|
||||
{
|
||||
this.swapCommands(index + this.scroll, index + this.scroll - 1);
|
||||
container.init();
|
||||
}));
|
||||
container.add(buttonDown = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 + 11, 20, 10, EnumIcon.ARROW_DOWN, Component.translatable("gui.worldhandler.actions.move_down"), () ->
|
||||
container.addRenderableWidget(buttonDown = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 + 11, 20, 10, EnumIcon.ARROW_DOWN, Component.translatable("gui.worldhandler.actions.move_down"), () ->
|
||||
{
|
||||
this.swapCommands(index + this.scroll, index + this.scroll + 1);
|
||||
container.init();
|
||||
}));
|
||||
container.add(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, MINUS, Component.translatable("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
container.addRenderableWidget(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, MINUS, Component.translatable("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll;
|
||||
this.removeCommand(pos);
|
||||
@@ -161,7 +161,7 @@ public class ContentCommandStack extends ContentChild
|
||||
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, PLUS, Component.translatable("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, PLUS, Component.translatable("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll + 1;
|
||||
this.addCommand(pos);
|
||||
@@ -173,23 +173,23 @@ public class ContentCommandStack extends ContentChild
|
||||
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.textfields.get(index));
|
||||
container.addRenderableWidget(this.textfields.get(index));
|
||||
|
||||
buttonRemove.active = this.getCommandCount() > 1;
|
||||
buttonUp.active = index + this.scroll > 0;
|
||||
buttonDown.active = index + this.scroll + 1 < this.getCommandCount();
|
||||
});
|
||||
|
||||
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
container.addRenderableWidget(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard(this.builderCommandStack.toCommand(SummonCommandBuilder.Label.SUMMON_POS_NBT, false));
|
||||
}));
|
||||
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, Component.translatable("gui.worldhandler.actions.move_up"), () ->
|
||||
container.addRenderableWidget(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, Component.translatable("gui.worldhandler.actions.move_up"), () ->
|
||||
{
|
||||
this.scrollUp();
|
||||
container.init();
|
||||
}));
|
||||
container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, Component.translatable("gui.worldhandler.actions.move_down"), () ->
|
||||
container.addRenderableWidget(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, Component.translatable("gui.worldhandler.actions.move_down"), () ->
|
||||
{
|
||||
this.scrollDown();
|
||||
container.init();
|
||||
|
||||
@@ -28,12 +28,12 @@ public class ContentContainers extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 232, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 232, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.CRAFTING_TABLE)));
|
||||
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.ENDER_CHEST)));
|
||||
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.ANVIL)));
|
||||
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.getName(), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.CRAFTING_TABLE)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.ENDER_CHEST)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.getName(), () -> this.placeBlock(container.getPlayer(), Blocks.ANVIL)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.getName(), () ->
|
||||
{
|
||||
double angle = Minecraft.getInstance().player.getDirection().get2DDataValue() * Math.PI / 2;
|
||||
double sin = Math.sin(angle);
|
||||
@@ -87,10 +87,10 @@ public class ContentContainers extends Content
|
||||
ActionHelper.backToGame();
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonItem(x, y, 20, 20, new ItemStack(Blocks.CRAFTING_TABLE), () -> this.giveItem(container.getPlayer(), Items.CRAFTING_TABLE)));
|
||||
container.add(new GuiButtonItem(x, y + 24, 20, 20, new ItemStack(Blocks.ENDER_CHEST), () -> this.giveItem(container.getPlayer(), Items.ENDER_CHEST)));
|
||||
container.add(new GuiButtonItem(x, y + 48, 20, 20, new ItemStack(Blocks.ANVIL), () -> this.giveItem(container.getPlayer(), Items.ANVIL)));
|
||||
container.add(new GuiButtonItem(x, y + 72, 20, 20, new ItemStack(Blocks.ENCHANTING_TABLE), () -> this.giveItem(container.getPlayer(), Items.ENCHANTING_TABLE)));
|
||||
container.addRenderableWidget(new GuiButtonItem(x, y, 20, 20, new ItemStack(Blocks.CRAFTING_TABLE), () -> this.giveItem(container.getPlayer(), Items.CRAFTING_TABLE)));
|
||||
container.addRenderableWidget(new GuiButtonItem(x, y + 24, 20, 20, new ItemStack(Blocks.ENDER_CHEST), () -> this.giveItem(container.getPlayer(), Items.ENDER_CHEST)));
|
||||
container.addRenderableWidget(new GuiButtonItem(x, y + 48, 20, 20, new ItemStack(Blocks.ANVIL), () -> this.giveItem(container.getPlayer(), Items.ANVIL)));
|
||||
container.addRenderableWidget(new GuiButtonItem(x, y + 72, 20, 20, new ItemStack(Blocks.ENCHANTING_TABLE), () -> this.giveItem(container.getPlayer(), Items.ENCHANTING_TABLE)));
|
||||
}
|
||||
|
||||
private void giveItem(String player, Item item)
|
||||
|
||||
@@ -50,16 +50,16 @@ public class ContentContinue extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, Component.translatable("gui.worldhandler.generic.yes").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(this.commandField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, Component.translatable("gui.worldhandler.generic.yes").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builder, this.label, this.special);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, Component.translatable("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, Component.translatable("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -127,7 +127,7 @@ public class ContentCustomItem extends Content
|
||||
{
|
||||
if(this.startPage == 1)
|
||||
{
|
||||
container.add(new MenuColorField(x, y, "gui.worldhandler.items.custom_item.start.custom_name", this.display.getName()));
|
||||
container.addMenu(new MenuColorField(x, y, "gui.worldhandler.items.custom_item.start.custom_name", this.display.getName()));
|
||||
}
|
||||
}
|
||||
else if(Page.ENCHANT.equals(this.page))
|
||||
@@ -173,7 +173,7 @@ public class ContentCustomItem extends Content
|
||||
return "enchantments";
|
||||
}
|
||||
});
|
||||
container.add(enchantments);
|
||||
container.addMenu(enchantments);
|
||||
}
|
||||
else if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
@@ -219,7 +219,7 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(attributes);
|
||||
container.addMenu(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,20 +233,20 @@ public class ContentCustomItem extends Content
|
||||
GuiButtonBase button5;
|
||||
GuiButtonBase button6;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
{
|
||||
this.page = Page.ENCHANT;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
{
|
||||
this.page = Page.ATTRIBUTES;
|
||||
container.init();
|
||||
@@ -256,12 +256,12 @@ public class ContentCustomItem extends Content
|
||||
{
|
||||
button1.active = false;
|
||||
|
||||
container.add(button5 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
container.addRenderableWidget(button5 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.startPage--;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button6 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
container.addRenderableWidget(button6 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.startPage++;
|
||||
container.init();
|
||||
@@ -270,9 +270,9 @@ public class ContentCustomItem extends Content
|
||||
if(this.startPage == 0)
|
||||
{
|
||||
button5.active = false;
|
||||
container.add(this.itemField);
|
||||
container.add(this.itemLore1Field);
|
||||
container.add(this.itemLore2Field);
|
||||
container.addRenderableWidget(this.itemField);
|
||||
container.addRenderableWidget(this.itemLore1Field);
|
||||
container.addRenderableWidget(this.itemLore2Field);
|
||||
}
|
||||
else if(this.startPage == 1)
|
||||
{
|
||||
@@ -290,11 +290,11 @@ public class ContentCustomItem extends Content
|
||||
|
||||
if(!this.builderCutomItem.needsCommandBlock(GiveCommandBuilder.Label.GIVE, false) && !this.display.getName().isStyled())
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.custom_item"), () -> this.giveItem(container.getPlayer())));
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.items.custom_item.custom_item"), () -> this.giveItem(container.getPlayer())));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () -> this.giveItem(container.getPlayer())));
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () -> this.giveItem(container.getPlayer())));
|
||||
}
|
||||
|
||||
button4.active = this.builderCutomItem.item().hasValue();
|
||||
|
||||
@@ -141,25 +141,25 @@ public class ContentEditBlocks extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
{
|
||||
this.page = Page.COORDINATES;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
this.page = Page.FILL;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
this.page = Page.REPLACE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
this.page = Page.CLONE;
|
||||
container.init();
|
||||
@@ -181,12 +181,12 @@ public class ContentEditBlocks extends Content
|
||||
width2 = 56;
|
||||
xOffset2 = 58;
|
||||
|
||||
container.add(this.x1Field);
|
||||
container.add(this.y1Field);
|
||||
container.add(this.z1Field);
|
||||
container.add(this.x2Field);
|
||||
container.add(this.y2Field);
|
||||
container.add(this.z2Field);
|
||||
container.addRenderableWidget(this.x1Field);
|
||||
container.addRenderableWidget(this.y1Field);
|
||||
container.addRenderableWidget(this.z1Field);
|
||||
container.addRenderableWidget(this.x2Field);
|
||||
container.addRenderableWidget(this.y2Field);
|
||||
container.addRenderableWidget(this.z2Field);
|
||||
}
|
||||
else if(Page.FILL.equals(this.page))
|
||||
{
|
||||
@@ -198,8 +198,8 @@ public class ContentEditBlocks extends Content
|
||||
width2 = 114;
|
||||
xOffset2 = 0;
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.addRenderableWidget(this.block1Field);
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderFill, FillCommandBuilder.Label.FILL);
|
||||
}));
|
||||
@@ -215,9 +215,9 @@ public class ContentEditBlocks extends Content
|
||||
width2 = 56;
|
||||
xOffset2 = 58;
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(this.block2Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.addRenderableWidget(this.block1Field);
|
||||
container.addRenderableWidget(this.block2Field);
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderFill, FillCommandBuilder.Label.REPLACE);
|
||||
}));
|
||||
@@ -235,15 +235,15 @@ public class ContentEditBlocks extends Content
|
||||
|
||||
if(Mask.FILTERED.equals(this.mask))
|
||||
{
|
||||
container.add(this.filterField);
|
||||
container.addRenderableWidget(this.filterField);
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.empty(), null));
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.empty(), null));
|
||||
button1.active = false;
|
||||
}
|
||||
|
||||
container.add(new GuiButtonList<Mask>(x + 118, y, Arrays.asList(Mask.values()), 114, 20, container, new ILogicMapped<Mask>()
|
||||
container.addRenderableWidget(new GuiButtonList<Mask>(x + 118, y, Arrays.asList(Mask.values()), 114, 20, container, new ILogicMapped<Mask>()
|
||||
{
|
||||
@Override
|
||||
public MutableComponent translate(Mask mask)
|
||||
@@ -271,7 +271,7 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
System.out.println(this.builderClone.toCommand(this.mask.getLabel(), false));
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderClone, this.mask.getLabel());
|
||||
@@ -283,13 +283,13 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, Component.translatable("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, Component.translatable("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
{
|
||||
BlockHelper.pos1().set(BlockHelper.getFocusedBlockPos());
|
||||
this.updatePositions();
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, Component.translatable("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, Component.translatable("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
{
|
||||
BlockHelper.pos2().set(BlockHelper.getFocusedBlockPos());
|
||||
this.updatePositions();
|
||||
|
||||
@@ -71,21 +71,21 @@ public class ContentEnchantment extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(enchantments);
|
||||
container.addMenu(enchantments);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 1, this.builderEnchantment.enchantment().getEnchantment().getMaxLevel(), 1, container, new LogicSliderSimple("enchantment", Component.translatable("gui.worldhandler.items.enchantment.level"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 1, this.builderEnchantment.enchantment().getEnchantment().getMaxLevel(), 1, container, new LogicSliderSimple("enchantment", Component.translatable("gui.worldhandler.items.enchantment.level"), value ->
|
||||
{
|
||||
this.builderEnchantment.level().set(value.intValue());
|
||||
})));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderEnchantment, EnchantCommandBuilder.Label.ENCHANT_LEVEL);
|
||||
}));
|
||||
|
||||
@@ -47,27 +47,27 @@ public class ContentExperience extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiSlider(x + 116 / 2, y, 114, 20, 0, Config.getSliders().getMaxExperience(), 0, container, new LogicSliderSimple("experience", Component.translatable("gui.worldhandler.title.player.experience"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 116 / 2, y, 114, 20, 0, Config.getSliders().getMaxExperience(), 0, container, new LogicSliderSimple("experience", Component.translatable("gui.worldhandler.title.player.experience"), value ->
|
||||
{
|
||||
this.builderExperience.amount().set(value);
|
||||
})));
|
||||
|
||||
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
container.addRenderableWidget(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderExperience, ExperienceCommandBuilder.Label.ADD_LEVELS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
container.addRenderableWidget(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
ExperienceCommandBuilder builder = new ExperienceCommandBuilder();
|
||||
builder.targets().setTarget(this.builderExperience.targets().getTarget());
|
||||
builder.amount().set(-this.builderExperience.amount().get());
|
||||
CommandHelper.sendCommand(container.getPlayer(), builder, ExperienceCommandBuilder.Label.ADD_LEVELS);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset"), Component.translatable("gui.worldhandler.actions.set_to_0"), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset"), Component.translatable("gui.worldhandler.actions.set_to_0"), () ->
|
||||
{
|
||||
ExperienceCommandBuilder builder = new ExperienceCommandBuilder();
|
||||
builder.amount().set(0);
|
||||
|
||||
@@ -113,30 +113,30 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(rules);
|
||||
container.addMenu(rules);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.booleanValue)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
this.setGameRule(container.getPlayer(), String.valueOf(true));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
this.setGameRule(container.getPlayer(), String.valueOf(false));
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
container.addRenderableWidget(this.valueField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
this.setGameRule(container.getPlayer(), this.value);
|
||||
}));
|
||||
|
||||
@@ -2,6 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.LocateCommandBuilder;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
@@ -17,10 +18,11 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import exopandora.worldhandler.util.TranslationHelper;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@@ -56,7 +58,7 @@ public class ContentLocate extends Content
|
||||
{
|
||||
if(Page.BIOME.equals(this.page))
|
||||
{
|
||||
List<ResourceLocation> biomes = new ArrayList<ResourceLocation>(ForgeRegistries.BIOMES.getKeys());
|
||||
List<ResourceLocation> biomes = RegistryHelper.getLookupProvider().lookup(Registries.BIOME).get().listElementIds().map(ResourceKey::location).collect(Collectors.toList());
|
||||
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, biomes, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
||||
{
|
||||
@Override
|
||||
@@ -90,11 +92,12 @@ public class ContentLocate extends Content
|
||||
return "biomes";
|
||||
}
|
||||
});
|
||||
container.add(list);
|
||||
container.addMenu(list);
|
||||
}
|
||||
else if(Page.STRUCTURE.equals(this.page))
|
||||
{
|
||||
List<ResourceLocation> structures = new ArrayList<ResourceLocation>(RegistryAccess.BUILTIN.get().registry(Registry.STRUCTURE_REGISTRY).get().keySet());
|
||||
List<ResourceLocation> structures = RegistryHelper.getLookupProvider().lookup(Registries.STRUCTURE).get().listElementIds().map(ResourceKey::location).collect(Collectors.toList());
|
||||
|
||||
MenuPageList<ResourceLocation> list = new MenuPageList<ResourceLocation>(x + 118, y, structures, 114, 20, 3, container, new ILogicPageList<ResourceLocation>()
|
||||
{
|
||||
@Override
|
||||
@@ -128,7 +131,7 @@ public class ContentLocate extends Content
|
||||
return "structures";
|
||||
}
|
||||
});
|
||||
container.add(list);
|
||||
container.addMenu(list);
|
||||
}
|
||||
else if(Page.POI.equals(this.page))
|
||||
{
|
||||
@@ -138,7 +141,7 @@ public class ContentLocate extends Content
|
||||
@Override
|
||||
public MutableComponent translate(ResourceLocation poi)
|
||||
{
|
||||
String result = RegistryHelper.translate(poi);
|
||||
String result = TranslationHelper.translate(poi);
|
||||
|
||||
if(result != null)
|
||||
{
|
||||
@@ -173,7 +176,7 @@ public class ContentLocate extends Content
|
||||
return "pois";
|
||||
}
|
||||
});
|
||||
container.add(list);
|
||||
container.addMenu(list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,13 +186,13 @@ public class ContentLocate extends Content
|
||||
GuiButtonBase button2;
|
||||
GuiButtonBase button3;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, "gui.worldhandler.generic.back", () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, "gui.worldhandler.generic.backToGame", ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, "gui.worldhandler.generic.back", () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, "gui.worldhandler.generic.backToGame", ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, "gui.worldhandler.locate.biome", () -> this.changePage(container, Page.BIOME)));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, "gui.worldhandler.locate.structure", () -> this.changePage(container, Page.STRUCTURE)));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, "gui.worldhandler.locate.poi", () -> this.changePage(container, Page.POI)));
|
||||
container.add(new GuiButtonBase(x, y + 72, 114, 20, "gui.worldhandler.locate.locate", () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, "gui.worldhandler.locate.biome", () -> this.changePage(container, Page.BIOME)));
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, "gui.worldhandler.locate.structure", () -> this.changePage(container, Page.STRUCTURE)));
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, "gui.worldhandler.locate.poi", () -> this.changePage(container, Page.POI)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 72, 114, 20, "gui.worldhandler.locate.locate", () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderLocate, this.page.getLabel());
|
||||
}));
|
||||
|
||||
@@ -22,36 +22,36 @@ public class ContentMain extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonIcon(x, y, 22, 20, EnumIcon.TIME_DAWN, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
container.add(new GuiButtonIcon(x + 26, y, 22, 20, EnumIcon.TIME_NOON, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y, 22, 20, EnumIcon.TIME_SUNSET, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y, 23, 20, EnumIcon.TIME_MIDNIGHT, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y, 24, 20, EnumIcon.DIFFICULTY_PEACEFUL, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, Component.translatable("gui.worldhandler.shortcuts.tooltip.settings"), () -> ActionHelper.open(Contents.SETTINGS)));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x, y, 22, 20, EnumIcon.TIME_DAWN, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26, y, 22, 20, EnumIcon.TIME_NOON, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 2, y, 22, 20, EnumIcon.TIME_SUNSET, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 3, y, 23, 20, EnumIcon.TIME_MIDNIGHT, Component.translatable("gui.worldhandler.shortcuts.tooltip.time", Component.translatable("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 4, y, 24, 20, EnumIcon.DIFFICULTY_PEACEFUL, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty", Component.translatable("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, Component.translatable("gui.worldhandler.shortcuts.tooltip.settings"), () -> ActionHelper.open(Contents.SETTINGS)));
|
||||
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, Component.translatable("gui.worldhandler.shortcuts.tooltip.potions"), () -> ActionHelper.open(Contents.POTIONS)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, Component.translatable("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, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, Component.translatable("gui.worldhandler.shortcuts.tooltip.weather", Component.translatable("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, Component.translatable("gui.worldhandler.shortcuts.tooltip.potions"), () -> ActionHelper.open(Contents.POTIONS)));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, Component.translatable("gui.worldhandler.shortcuts.tooltip.command_stack"), () -> ActionHelper.open(Contents.COMMAND_STACK)));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode", Component.translatable("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, Component.translatable("gui.worldhandler.items"), () -> ActionHelper.open(Contents.CUSTOM_ITEM)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, Component.translatable("gui.worldhandler.blocks"), () -> ActionHelper.open(Contents.EDIT_BLOCKS)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, Component.translatable("gui.worldhandler.entities"), () -> ActionHelper.open(Contents.SUMMON)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 48, 74, 20, Component.translatable("gui.worldhandler.items"), () -> ActionHelper.open(Contents.CUSTOM_ITEM)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 78, y + 48, 76, 20, Component.translatable("gui.worldhandler.blocks"), () -> ActionHelper.open(Contents.EDIT_BLOCKS)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 158, y + 48, 74, 20, Component.translatable("gui.worldhandler.entities"), () -> ActionHelper.open(Contents.SUMMON)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, Component.translatable("gui.worldhandler.world"), () -> ActionHelper.open(Contents.WORLD_INFO)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, Component.translatable("gui.worldhandler.player"), () -> ActionHelper.open(Contents.PLAYER)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, Component.translatable("gui.worldhandler.scoreboard"), () -> ActionHelper.open(Contents.SCOREBOARD_OBJECTIVES)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 72, 74, 20, Component.translatable("gui.worldhandler.world"), () -> ActionHelper.open(Contents.WORLD_INFO)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 78, y + 72, 76, 20, Component.translatable("gui.worldhandler.player"), () -> ActionHelper.open(Contents.PLAYER)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 158, y + 72, 74, 20, Component.translatable("gui.worldhandler.scoreboard"), () -> ActionHelper.open(Contents.SCOREBOARD_OBJECTIVES)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, Component.translatable("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, Component.translatable("gui.worldhandler.resourcepack"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 74, 20, Component.translatable("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 78, y + 96, 76, 20, Component.translatable("gui.worldhandler.resourcepack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().options.save();
|
||||
Minecraft.getInstance().setScreen(new PackSelectionScreen(container, Minecraft.getInstance().getResourcePackRepository(), resourcePackList ->
|
||||
@@ -61,7 +61,7 @@ public class ContentMain extends Content
|
||||
optionsScreen.updatePackList(resourcePackList);
|
||||
}, Minecraft.getInstance().getResourcePackDirectory(), Component.translatable("resourcePack.title")));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 158, y + 96, 74, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -125,29 +125,29 @@ public class ContentMultiplayer extends Content
|
||||
GuiButtonBase button6;
|
||||
GuiButtonBase button7;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.literal(I18n.get("gui.worldhandler.multiplayer.kick") + " / " + I18n.get("gui.worldhandler.multiplayer.ban")), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.literal(I18n.get("gui.worldhandler.multiplayer.kick") + " / " + I18n.get("gui.worldhandler.multiplayer.ban")), () ->
|
||||
{
|
||||
this.page = Page.KICK_AND_BAN;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
{
|
||||
this.page = Page.PARDON;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
{
|
||||
this.page = Page.PERMISSIONS;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
{
|
||||
this.page = Page.RUNTIME;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
container.addRenderableWidget(button5 = new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
{
|
||||
this.page = Page.WHITELIST;
|
||||
container.init();
|
||||
@@ -155,13 +155,13 @@ public class ContentMultiplayer extends Content
|
||||
|
||||
if(Page.KICK_AND_BAN.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(this.reasonField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.kick"), Component.literal(this.builderKick.toCommand(KickCommandBuilder.Label.KICK_REASON, false)), () ->
|
||||
container.addRenderableWidget(this.playerField);
|
||||
container.addRenderableWidget(this.reasonField);
|
||||
container.addRenderableWidget(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.kick"), Component.literal(this.builderKick.toCommand(KickCommandBuilder.Label.KICK_REASON, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderKick, KickCommandBuilder.Label.KICK_REASON);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.ban"), Component.literal(this.builderBan.toCommand(BanCommandBuilder.Label.BAN_REASON, false)), () ->
|
||||
container.addRenderableWidget(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.ban"), Component.literal(this.builderBan.toCommand(BanCommandBuilder.Label.BAN_REASON, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderBan, BanCommandBuilder.Label.BAN_REASON);
|
||||
}));
|
||||
@@ -176,8 +176,8 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
else if(Page.PARDON.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.pardon"), Component.literal(this.builderPardon.toCommand(PardonCommandBuilder.Label.PARDON, false)), () ->
|
||||
container.addRenderableWidget(this.playerField);
|
||||
container.addRenderableWidget(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.pardon"), Component.literal(this.builderPardon.toCommand(PardonCommandBuilder.Label.PARDON, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPardon, PardonCommandBuilder.Label.PARDON);
|
||||
}));
|
||||
@@ -191,12 +191,12 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
else if(Page.PERMISSIONS.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions.give"), Component.literal(this.builderOp.toCommand(OpCommandBuilder.Label.OP, false)), () ->
|
||||
container.addRenderableWidget(this.playerField);
|
||||
container.addRenderableWidget(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions.give"), Component.literal(this.builderOp.toCommand(OpCommandBuilder.Label.OP, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderOp, OpCommandBuilder.Label.OP);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions.take"), Component.literal(this.builderDeop.toCommand(DeOpCommandBuilder.Label.DEOP, false)), () ->
|
||||
container.addRenderableWidget(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, Component.translatable("gui.worldhandler.multiplayer.permissions.take"), Component.literal(this.builderDeop.toCommand(DeOpCommandBuilder.Label.DEOP, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderDeop, DeOpCommandBuilder.Label.DEOP);
|
||||
}));
|
||||
@@ -211,19 +211,19 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
else if(Page.RUNTIME.equals(this.page))
|
||||
{
|
||||
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.save_world"), Component.literal(this.builderSaveAll.toCommand(SaveAllCommandBuilder.Label.SAVE_ALL, false)), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.save_world"), Component.literal(this.builderSaveAll.toCommand(SaveAllCommandBuilder.Label.SAVE_ALL, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSaveAll, SaveAllCommandBuilder.Label.SAVE_ALL);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.autosave", Component.translatable("gui.worldhandler.generic.on")), Component.literal(this.builderSaveOn.toCommand(SaveOnCommandBuilder.Label.SAVE_ON, false)), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.autosave", Component.translatable("gui.worldhandler.generic.on")), Component.literal(this.builderSaveOn.toCommand(SaveOnCommandBuilder.Label.SAVE_ON, false)), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSaveOn, SaveOnCommandBuilder.Label.SAVE_ON);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.autosave", Component.translatable("gui.worldhandler.generic.off")).withStyle(ChatFormatting.RED), Component.literal(this.builderSaveOff.toCommand(SaveOffCommandBuilder.Label.SAVE_OFF, false)), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.autosave", Component.translatable("gui.worldhandler.generic.off")).withStyle(ChatFormatting.RED), Component.literal(this.builderSaveOff.toCommand(SaveOffCommandBuilder.Label.SAVE_OFF, false)), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSaveOff, SaveOffCommandBuilder.Label.SAVE_OFF));
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.stop_server").withStyle(ChatFormatting.RED), Component.literal(this.builderStop.toCommand(StopCommandBuilder.Label.STOP, false)), () ->
|
||||
container.addRenderableWidget(new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.runtime.stop_server").withStyle(ChatFormatting.RED), Component.literal(this.builderStop.toCommand(StopCommandBuilder.Label.STOP, false)), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderStop, StopCommandBuilder.Label.STOP));
|
||||
}));
|
||||
@@ -232,26 +232,26 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
else if(Page.WHITELIST.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
container.addRenderableWidget(this.playerField);
|
||||
container.addRenderableWidget(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist, WhitelistCommandBuilder.Label.ADD);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
container.addRenderableWidget(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist, WhitelistCommandBuilder.Label.REMOVE);
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.whitelist", Component.translatable("gui.worldhandler.generic.on")), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.whitelist", Component.translatable("gui.worldhandler.generic.on")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist, WhitelistCommandBuilder.Label.ON);
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.whitelist", Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.multiplayer.whitelist.whitelist", Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist, WhitelistCommandBuilder.Label.OFF);
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, Component.translatable("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, Component.translatable("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist, WhitelistCommandBuilder.Label.RELOAD);
|
||||
}));
|
||||
|
||||
@@ -59,53 +59,54 @@ public class ContentNoteEditor extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
BlockPos pos = this.builderNoteEditor.pos().getBlockPos();
|
||||
SoundEvent sound = this.getSoundEvent(pos.below());
|
||||
SoundEvent sound = getSoundEvent(pos.below()).getSoundEvent().get();
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 1)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 3)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 5)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 1)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 3)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 5)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () -> this.setNote(container.getPlayer(), 6)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 8)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 10)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () -> this.setNote(container.getPlayer(), 11)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 13)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 15)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 17)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () -> this.setNote(container.getPlayer(), 6)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 8)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 10)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () -> this.setNote(container.getPlayer(), 11)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 13)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 15)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 17)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () -> this.setNote(container.getPlayer(), 18)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 20)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 22)));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () -> this.setNote(container.getPlayer(), 23)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () -> this.setNote(container.getPlayer(), 18)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () -> this.setNote(container.getPlayer(), 20)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () -> this.setNote(container.getPlayer(), 22)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, Component.translatable("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () -> this.setNote(container.getPlayer(), 23)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, Component.literal("F#"), sound, 0.5F, Type.BLACK, () -> this.setNote(container.getPlayer(), 0)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, Component.literal("G#"), sound, 0.56F, Type.BLACK, () -> this.setNote(container.getPlayer(), 2)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, Component.literal("A#"), sound, 0.63F, Type.BLACK, () -> this.setNote(container.getPlayer(), 4)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, Component.literal("F#"), sound, 0.5F, Type.BLACK, () -> this.setNote(container.getPlayer(), 0)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, Component.literal("G#"), sound, 0.56F, Type.BLACK, () -> this.setNote(container.getPlayer(), 2)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, Component.literal("A#"), sound, 0.63F, Type.BLACK, () -> this.setNote(container.getPlayer(), 4)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, Component.literal("C#"), sound, 0.75F, Type.BLACK, () -> this.setNote(container.getPlayer(), 7)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, Component.literal("D#"), sound, 0.85F, Type.BLACK, () -> this.setNote(container.getPlayer(), 9)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, Component.literal("C#"), sound, 0.75F, Type.BLACK, () -> this.setNote(container.getPlayer(), 7)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, Component.literal("D#"), sound, 0.85F, Type.BLACK, () -> this.setNote(container.getPlayer(), 9)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, Component.literal("F#"), sound, 1.0F, Type.BLACK, () -> this.setNote(container.getPlayer(), 12)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, Component.literal("G#"), sound, 1.1F, Type.BLACK, () -> this.setNote(container.getPlayer(), 14)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, Component.literal("A#"), sound, 1.25F, Type.BLACK, () -> this.setNote(container.getPlayer(), 16)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, Component.literal("F#"), sound, 1.0F, Type.BLACK, () -> this.setNote(container.getPlayer(), 12)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, Component.literal("G#"), sound, 1.1F, Type.BLACK, () -> this.setNote(container.getPlayer(), 14)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, Component.literal("A#"), sound, 1.25F, Type.BLACK, () -> this.setNote(container.getPlayer(), 16)));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, Component.literal("C#"), sound, 1.5F, Type.BLACK, () -> this.setNote(container.getPlayer(), 19)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, Component.literal("D#"), sound, 1.7F, Type.BLACK, () -> this.setNote(container.getPlayer(), 21)));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, Component.literal("F#"), sound, 2.0F, Type.BLACK, () -> this.setNote(container.getPlayer(), 24)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, Component.literal("C#"), sound, 1.5F, Type.BLACK, () -> this.setNote(container.getPlayer(), 19)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, Component.literal("D#"), sound, 1.7F, Type.BLACK, () -> this.setNote(container.getPlayer(), 21)));
|
||||
container.addRenderableWidget(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, Component.literal("F#"), sound, 2.0F, Type.BLACK, () -> this.setNote(container.getPlayer(), 24)));
|
||||
}
|
||||
}
|
||||
|
||||
private void setNote(String player, int note)
|
||||
{
|
||||
SetBlockCommandBuilder builder = new SetBlockCommandBuilder();
|
||||
builder.pos().set(this.builderNoteEditor.pos().getBlockPos());
|
||||
NoteBlockInstrument instrument = NoteBlockInstrument.byState(Minecraft.getInstance().level.getBlockState(this.builderNoteEditor.pos().getBlockPos().below()));
|
||||
BlockPos pos = this.builderNoteEditor.pos().getBlockPos();
|
||||
builder.pos().set(pos);
|
||||
NoteBlockInstrument instrument = getSoundEvent(pos);
|
||||
BlockState state = Blocks.NOTE_BLOCK.defaultBlockState()
|
||||
.setValue(BlockStateProperties.NOTEBLOCK_INSTRUMENT, instrument)
|
||||
.setValue(BlockStateProperties.NOTE, note);
|
||||
@@ -150,13 +151,16 @@ public class ContentNoteEditor extends Content
|
||||
}
|
||||
}
|
||||
|
||||
private SoundEvent getSoundEvent(BlockPos blockPos)
|
||||
private static NoteBlockInstrument getSoundEvent(BlockPos blockPos)
|
||||
{
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
if(level != null)
|
||||
{
|
||||
return NoteBlockInstrument.byState(level.getBlockState(blockPos)).getSoundEvent();
|
||||
return NoteBlockInstrument.byStateAbove(level.getBlockState(blockPos.above())).orElseGet(() ->
|
||||
{
|
||||
return NoteBlockInstrument.byStateBelow(level.getBlockState(blockPos.below()));
|
||||
});
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -79,25 +79,25 @@ public class ContentPlayer extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.entities.player.start"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.entities.player.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.entities.player.score"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.entities.player.score"), () ->
|
||||
{
|
||||
this.page = Page.SCORE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.player.position"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.player.position"), () ->
|
||||
{
|
||||
this.page = Page.POSITION;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
{
|
||||
this.page = Page.MISC;
|
||||
container.init();
|
||||
@@ -115,7 +115,7 @@ public class ContentPlayer extends Content
|
||||
{
|
||||
button3.active = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
{
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
@@ -130,19 +130,19 @@ public class ContentPlayer extends Content
|
||||
{
|
||||
button4.active = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.set_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.set_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSpawnpoint, SetSpawnCommandBuilder.Label.SPAWNPOINT));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSetWorldSpawn, SetWorldSpawnCommandBuilder.Label.SET_WORLD_SPAWN));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.kill").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.kill").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderKill, KillCommandBuilder.Label.KILL));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.clear_inventory").withStyle(ChatFormatting.RED), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.miscellaneous.clear_inventory").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderClear, ClearInventoryCommandBuilder.Label.CLEAR));
|
||||
}));
|
||||
|
||||
@@ -106,7 +106,7 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
});
|
||||
|
||||
container.add(potions);
|
||||
container.addMenu(potions);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -118,26 +118,26 @@ public class ContentPotions extends ContentChild
|
||||
GuiButtonBase button4;
|
||||
GuiButtonBase button5;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.potionPage == 0)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.potions.effect.give"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.potions.effect.give"), () ->
|
||||
{
|
||||
this.next(container);
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.potions.effect.remove"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.potions.effect.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion, EffectCommandBuilder.Label.CLEAR_TARGETS_EFFECT);
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion, EffectCommandBuilder.Label.CLEAR);
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset_all"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset_all"), () ->
|
||||
{
|
||||
this.builderPotion.amplifier().set((byte) 1);
|
||||
this.builderPotion.seconds().set(0);
|
||||
@@ -152,18 +152,18 @@ public class ContentPotions extends ContentChild
|
||||
MobEffect effect = this.builderPotion.effect().getEffect();
|
||||
EffectInstance tag = this.effects.getOrCreate(effect);
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.potions.effect.ambient", tag.isAmbient() ? Component.translatable("gui.worldhandler.generic.on") : Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.potions.effect.ambient", tag.isAmbient() ? Component.translatable("gui.worldhandler.generic.on") : Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
tag.setAmbient(!tag.isAmbient());
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.particles", this.builderPotion.hideParticles().get() ? Component.translatable("gui.worldhandler.generic.off") : Component.translatable("gui.worldhandler.generic.on")), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.particles", this.builderPotion.hideParticles().get() ? Component.translatable("gui.worldhandler.generic.off") : Component.translatable("gui.worldhandler.generic.on")), () ->
|
||||
{
|
||||
this.builderPotion.hideParticles().set(!this.builderPotion.hideParticles().get());
|
||||
tag.setShowParticles(!tag.doShowParticles());
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 1, Config.getSliders().getMaxPotionAmplifier(), 1, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potions.effect.amplifier"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 1, Config.getSliders().getMaxPotionAmplifier(), 1, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potions.effect.amplifier"), value ->
|
||||
{
|
||||
this.builderPotion.amplifier().set((byte) (value.byteValue() - 1));
|
||||
tag.setAmplifier(value.byteValue());
|
||||
@@ -174,17 +174,17 @@ public class ContentPotions extends ContentChild
|
||||
MobEffect effect = this.builderPotion.effect().getEffect();
|
||||
EffectInstance tag = this.effects.getOrCreate(effect);
|
||||
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.seconds"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.seconds"), value ->
|
||||
{
|
||||
tag.setSeconds(value.intValue());
|
||||
this.builderPotion.seconds().set(tag.toSeconds());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value ->
|
||||
{
|
||||
tag.setMinutes(value.intValue());
|
||||
this.builderPotion.seconds().set(tag.toSeconds());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.hours"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.hours"), value ->
|
||||
{
|
||||
tag.setHours(value.intValue());
|
||||
this.builderPotion.seconds().set(tag.toSeconds());
|
||||
@@ -192,31 +192,31 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
else if(this.potionPage == 3)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.potions.effect"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y, 114, 20, Component.translatable("gui.worldhandler.potions.effect"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion, EffectCommandBuilder.Label.GIVE_SECONDS_AMPLIFIER_HIDEPARTICLES);
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonTooltip(x + 118, y + 24, 56, 20, Component.translatable("gui.worldhandler.potions.effect.tipped_arrow"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonTooltip(x + 118, y + 24, 56, 20, Component.translatable("gui.worldhandler.potions.effect.tipped_arrow"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
{
|
||||
this.giveItem(container.getPlayer(), Items.TIPPED_ARROW, 0.125F, Screen.hasShiftDown());
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, Component.translatable("gui.worldhandler.potions.effect.bottle"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, Component.translatable("gui.worldhandler.potions.effect.bottle"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
{
|
||||
this.giveItem(container.getPlayer(), Items.POTION, 1.0F, Screen.hasShiftDown());
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.potions.effect.splash"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.potions.effect.splash"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
{
|
||||
this.giveItem(container.getPlayer(), Items.SPLASH_POTION, 1.0F, Screen.hasShiftDown());
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, Component.translatable("gui.worldhandler.potions.effect.lingering"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
container.addRenderableWidget(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, Component.translatable("gui.worldhandler.potions.effect.lingering"), Component.translatable("gui.worldhandler.potions.effect.hold_shift_to_apply_all_effects_at_once"), () ->
|
||||
{
|
||||
this.giveItem(container.getPlayer(), Items.LINGERING_POTION, 0.25F, Screen.hasShiftDown());
|
||||
this.potionPage = 0;
|
||||
@@ -234,12 +234,12 @@ public class ContentPotions extends ContentChild
|
||||
|
||||
if(this.potionPage > 0)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.potionPage--;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.next(container);
|
||||
}));
|
||||
|
||||
@@ -80,21 +80,21 @@ public class ContentRecipes extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(list);
|
||||
container.addMenu(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.recipes.give"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.recipes.give"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe, RecipeCommandBuilder.Label.GIVE);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.recipes.take"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.recipes.take"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe, RecipeCommandBuilder.Label.TAKE);
|
||||
container.initButtons();
|
||||
|
||||
@@ -18,7 +18,7 @@ import exopandora.worldhandler.gui.widget.menu.impl.ILogicButtonList;
|
||||
import exopandora.worldhandler.gui.widget.menu.impl.MenuButtonList;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import exopandora.worldhandler.util.TranslationHelper;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -84,7 +84,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
return Component.translatable(type.getTranslationKey());
|
||||
}
|
||||
|
||||
String translation = RegistryHelper.translate(resource);
|
||||
String translation = TranslationHelper.translate(resource);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
});
|
||||
|
||||
container.add(objectives);
|
||||
container.addMenu(objectives);
|
||||
}
|
||||
else if(Page.DISPLAY.equals(this.page) || Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
@@ -193,7 +193,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
});
|
||||
|
||||
container.add(slots);
|
||||
container.addMenu(slots);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,25 +205,25 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
{
|
||||
this.page = Page.CREATE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
{
|
||||
this.page = Page.DISPLAY;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
{
|
||||
this.page = Page.UNDISPLAY;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
{
|
||||
this.page = Page.REMOVE;
|
||||
container.init();
|
||||
@@ -236,10 +236,10 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
|
||||
if(!Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
container.add(this.objectField);
|
||||
container.addRenderableWidget(this.objectField);
|
||||
}
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), BUILDER, this.page.getLabel());
|
||||
container.init();
|
||||
|
||||
@@ -103,20 +103,20 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
GuiButtonBase button2;
|
||||
GuiButtonBase button3;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y + 12, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y + 12, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
{
|
||||
this.page = Page.ADD_SET_REMOVE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
{
|
||||
this.page = Page.TAG;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
{
|
||||
this.page = Page.ENABLE;
|
||||
container.init();
|
||||
@@ -130,21 +130,21 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
|
||||
if(Page.ADD_SET_REMOVE.equals(this.page))
|
||||
{
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxPlayerPoints(), 0, container, new LogicSliderSimple("points", Component.translatable("gui.worldhandler.scoreboard.players.points"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxPlayerPoints(), 0, container, new LogicSliderSimple("points", Component.translatable("gui.worldhandler.scoreboard.players.points"), value ->
|
||||
{
|
||||
BUILDER.score().set(value);
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
container.addRenderableWidget(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), BUILDER, ScoreboardCommandBuilder.Label.PLAYERS_ADD_SCORE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
container.addRenderableWidget(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), BUILDER, ScoreboardCommandBuilder.Label.PLAYERS_REMOVE_SCORE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset"), Component.translatable("gui.worldhandler.actions.set_to_0"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.reset"), Component.translatable("gui.worldhandler.actions.set_to_0"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), BUILDER, ScoreboardCommandBuilder.Label.PLAYERS_RESET_SCORE);
|
||||
container.init();
|
||||
@@ -158,12 +158,12 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
else if(Page.TAG.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTag, TagCommandBuilder.Label.ADD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTag, TagCommandBuilder.Label.REMOVE);
|
||||
container.init();
|
||||
@@ -176,21 +176,21 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
else if(Page.ENABLE.equals(this.page))
|
||||
{
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxTriggerValue(), 0, container, new LogicSliderSimple("enable", Component.translatable("gui.worldhandler.generic.value"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxTriggerValue(), 0, container, new LogicSliderSimple("enable", Component.translatable("gui.worldhandler.generic.value"), value ->
|
||||
{
|
||||
this.builderTrigger.value().set(value);
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
container.addRenderableWidget(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger, TriggerCommandBuilder.Label.ADD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.set"), () ->
|
||||
container.addRenderableWidget(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, Component.translatable("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger, TriggerCommandBuilder.Label.SET);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), BUILDER, ScoreboardCommandBuilder.Label.PLAYERS_ENABLE_OBJECTIVE);
|
||||
container.init();
|
||||
@@ -203,11 +203,11 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
|
||||
if(Page.TAG.equals(this.page))
|
||||
{
|
||||
container.add(this.tagField);
|
||||
container.addRenderableWidget(this.tagField);
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.objectField);
|
||||
container.addRenderableWidget(this.objectField);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
}
|
||||
});
|
||||
|
||||
container.add(options);
|
||||
container.addMenu(options);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,25 +129,25 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
{
|
||||
this.page = Page.ADD;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.literal(I18n.get("gui.worldhandler.scoreboard.team.join") + " / " + I18n.get("gui.worldhandler.scoreboard.team.leave")), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.literal(I18n.get("gui.worldhandler.scoreboard.team.join") + " / " + I18n.get("gui.worldhandler.scoreboard.team.leave")), () ->
|
||||
{
|
||||
this.page = Page.JOIN_OR_LEAVE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.literal(I18n.get("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.get("gui.worldhandler.scoreboard.team.empty")), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.literal(I18n.get("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.get("gui.worldhandler.scoreboard.team.empty")), () ->
|
||||
{
|
||||
this.page = Page.REMOVE_OR_EMPTY;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
{
|
||||
this.page = Page.OPTION;
|
||||
container.init();
|
||||
@@ -162,12 +162,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
|
||||
if(Page.JOIN_OR_LEAVE.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams, TeamCommandBuilder.Label.JOIN);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams, TeamCommandBuilder.Label.LEAVE);
|
||||
container.initButtons();
|
||||
@@ -177,12 +177,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
}
|
||||
else if(Page.REMOVE_OR_EMPTY.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams, TeamCommandBuilder.Label.REMOVE);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams, TeamCommandBuilder.Label.EMPTY);
|
||||
container.initButtons();
|
||||
@@ -194,7 +194,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
|
||||
if(Page.ADD.equals(this.page) || Page.OPTION.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
if(Page.ADD.equals(this.page))
|
||||
{
|
||||
@@ -209,7 +209,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
button1.active = enabled;
|
||||
}
|
||||
|
||||
container.add(this.teamField);
|
||||
container.addRenderableWidget(this.teamField);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -82,7 +82,7 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
});
|
||||
|
||||
container.add(settings);
|
||||
container.addMenu(settings);
|
||||
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.value"));
|
||||
this.valueField.setFilter(string ->
|
||||
@@ -114,19 +114,19 @@ public class ContentSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.setting instanceof BooleanSetting)
|
||||
{
|
||||
BooleanSetting setting = (BooleanSetting) this.setting;
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, Component.translatable("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
setting.set(true);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
setting.set(false);
|
||||
container.init();
|
||||
@@ -142,8 +142,8 @@ public class ContentSettings extends ContentChild
|
||||
IntegerSetting setting = (IntegerSetting) this.setting;
|
||||
this.valueField.setValue(String.valueOf(setting.get()));
|
||||
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.set"), () ->
|
||||
container.addRenderableWidget(this.valueField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
String text = this.valueField.getValue();
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ContentSignEditor extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(colors);
|
||||
container.addMenu(colors);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,27 +116,27 @@ public class ContentSignEditor extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x, y, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
{
|
||||
this.selectedLine = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x, y + 24, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
{
|
||||
this.selectedLine = 1;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
{
|
||||
this.selectedLine = 2;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y + 72, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
{
|
||||
this.selectedLine = 3;
|
||||
container.init();
|
||||
@@ -144,13 +144,13 @@ public class ContentSignEditor extends Content
|
||||
|
||||
if(this.editColor)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.generic.done"), () -> this.toggleEditColor(container)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.generic.done"), () -> this.toggleEditColor(container)));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () ->
|
||||
container.addRenderableWidget(this.commandField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.actions.place_command_block"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSignEditor, DataCommandBuilder.Label.MERGE_BLOCK, Arrays.stream(this.texts).anyMatch(text -> text.getComponent().isStyled()));
|
||||
}));
|
||||
|
||||
@@ -231,7 +231,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(customName);
|
||||
container.addMenu(customName);
|
||||
}
|
||||
else if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
@@ -277,7 +277,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
});
|
||||
|
||||
container.add(attributes);
|
||||
container.addMenu(attributes);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,13 +292,13 @@ public class ContentSummon extends Content
|
||||
GuiButtonBase button6;
|
||||
GuiButtonBase button7;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, "gui.worldhandler.generic.back", () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, "gui.worldhandler.generic.backToGame", ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, "gui.worldhandler.generic.back", () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, "gui.worldhandler.generic.backToGame", ActionHelper::backToGame));
|
||||
|
||||
container.add(button4 = new GuiButtonBase(x, y, 114, 20, "gui.worldhandler.entities.summon.start", () -> this.changePage(container, Page.START)));
|
||||
container.add(button5 = new GuiButtonBase(x, y + 24, 114, 20, "gui.worldhandler.entities.summon.potion_effects", () -> this.changePage(container, Page.POTIONS)));
|
||||
container.add(button6 = new GuiButtonBase(x, y + 48, 114, 20, "gui.worldhandler.entities.summon.attributes", () -> this.changePage(container, Page.ATTRIBUTES)));
|
||||
container.add(button7 = new GuiButtonBase(x, y + 72, 114, 20, "gui.worldhandler.entities.summon.equipment", () -> this.changePage(container, Page.EQUIPMENT)));
|
||||
container.addRenderableWidget(button4 = new GuiButtonBase(x, y, 114, 20, "gui.worldhandler.entities.summon.start", () -> this.changePage(container, Page.START)));
|
||||
container.addRenderableWidget(button5 = new GuiButtonBase(x, y + 24, 114, 20, "gui.worldhandler.entities.summon.potion_effects", () -> this.changePage(container, Page.POTIONS)));
|
||||
container.addRenderableWidget(button6 = new GuiButtonBase(x, y + 48, 114, 20, "gui.worldhandler.entities.summon.attributes", () -> this.changePage(container, Page.ATTRIBUTES)));
|
||||
container.addRenderableWidget(button7 = new GuiButtonBase(x, y + 72, 114, 20, "gui.worldhandler.entities.summon.equipment", () -> this.changePage(container, Page.EQUIPMENT)));
|
||||
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
@@ -306,21 +306,21 @@ public class ContentSummon extends Content
|
||||
|
||||
if(this.editColor)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.generic.done", () -> this.toggleEditColor(container)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.generic.done", () -> this.toggleEditColor(container)));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.mobField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, "gui.worldhandler.entities.summon.start.custom_name", () -> this.toggleEditColor(container)));
|
||||
container.add(this.nbtField);
|
||||
container.addRenderableWidget(this.mobField);
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24, 114, 20, "gui.worldhandler.entities.summon.start.custom_name", () -> this.toggleEditColor(container)));
|
||||
container.addRenderableWidget(this.nbtField);
|
||||
|
||||
if(!this.builderSummon.needsCommandBlock(SummonCommandBuilder.Label.SUMMON_POS_NBT, false) && !this.entity.getCustomName().isStyled())
|
||||
{
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.title.entities.summon", () -> this.send(container.getPlayer())));
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.title.entities.summon", () -> this.send(container.getPlayer())));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.actions.place_command_block", () -> this.send(container.getPlayer())));
|
||||
container.addRenderableWidget(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, "gui.worldhandler.actions.place_command_block", () -> this.send(container.getPlayer())));
|
||||
}
|
||||
|
||||
button3.active = this.builderSummon.entity().hasValue();
|
||||
@@ -330,12 +330,12 @@ public class ContentSummon extends Content
|
||||
{
|
||||
button5.active = false;
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.potionPage--;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
container.addRenderableWidget(button2 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.potionPage++;
|
||||
container.init();
|
||||
@@ -366,15 +366,15 @@ public class ContentSummon extends Content
|
||||
{
|
||||
EffectInstance tag = this.effects.getOrCreate(effect);
|
||||
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable(effect.getDescriptionId()), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable(effect.getDescriptionId()), value ->
|
||||
{
|
||||
tag.setAmplifier(value.byteValue());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value ->
|
||||
container.addRenderableWidget(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + ForgeRegistries.MOB_EFFECTS.getKey(effect), Component.translatable("gui.worldhandler.potion.time.minutes"), value ->
|
||||
{
|
||||
tag.setMinutes(value.intValue());
|
||||
})));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.particles", tag.doShowParticles() ? Component.translatable("gui.worldhandler.generic.on") : Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 48, 114, 20, Component.translatable("gui.worldhandler.potions.effect.particles", tag.doShowParticles() ? Component.translatable("gui.worldhandler.generic.on") : Component.translatable("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
tag.setShowParticles(!tag.doShowParticles());
|
||||
container.init();
|
||||
@@ -395,13 +395,13 @@ public class ContentSummon extends Content
|
||||
{
|
||||
final int index = i;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24 * i, 20, 20, TextUtils.ARROW_LEFT, () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 24 * i, 20, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.entity.setArmorItem(3 - index, ARMOR[index][Math.floorMod(ArrayUtils.indexOf(ARMOR[index], this.entity.getArmorItem(3 - index)) - 1, ARMOR[index].length)]);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonItem(x + 118 + 24, y + 24 * i, 20, 20, this.entity.getArmorItem(3 - i), null));
|
||||
container.add(new GuiButtonBase(x + 118 + 47, y + 24 * i, 20, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonItem(x + 118 + 24, y + 24 * i, 20, 20, this.entity.getArmorItem(3 - i), null));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118 + 47, y + 24 * i, 20, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.entity.setArmorItem(3 - index, ARMOR[index][Math.floorMod(ArrayUtils.indexOf(ARMOR[index], this.entity.getArmorItem(3 - index)) + 1, ARMOR[index].length)]);
|
||||
container.init();
|
||||
@@ -414,13 +414,13 @@ public class ContentSummon extends Content
|
||||
{
|
||||
final int index = i;
|
||||
|
||||
container.add(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 12, 20, 20, EnumIcon.ARROW_UP, null, () ->
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 12, 20, 20, EnumIcon.ARROW_UP, null, () ->
|
||||
{
|
||||
this.entity.setHandItem(index, HANDS[index][Math.floorMod(ArrayUtils.indexOf(HANDS[index], this.entity.getHandItem(index)) - 1, HANDS[index].length)]);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonItem(x + 118 + 70 + 24 * i, y + 36, 20, 20, this.entity.getHandItem(i), null));
|
||||
container.add(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 60, 20, 20, EnumIcon.ARROW_DOWN, null, () ->
|
||||
container.addRenderableWidget(button1 = new GuiButtonItem(x + 118 + 70 + 24 * i, y + 36, 20, 20, this.entity.getHandItem(i), null));
|
||||
container.addRenderableWidget(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 60, 20, 20, EnumIcon.ARROW_DOWN, null, () ->
|
||||
{
|
||||
this.entity.setHandItem(index, HANDS[index][Math.floorMod(ArrayUtils.indexOf(HANDS[index], this.entity.getHandItem(index)) + 1, HANDS[index].length)]);
|
||||
container.init();
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ContentUsercontent extends Content
|
||||
|
||||
for(JsonMenu menu : this.getWidgets(this.content.getGui().getMenus(), AbstractJsonWidget.Type.MENU))
|
||||
{
|
||||
container.add(this.menuFactory.createMenu(menu, this, container, x, y));
|
||||
container.addMenu(this.menuFactory.createMenu(menu, this, container, x, y));
|
||||
}
|
||||
|
||||
this.updateTextfields();
|
||||
@@ -118,7 +118,7 @@ public class ContentUsercontent extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
Stream.concat(this.textfields.values().stream(), this.widgets.stream()).map(VisibleObject::get).forEach(container::add);
|
||||
Stream.concat(this.textfields.values().stream(), this.widgets.stream()).map(VisibleObject::get).forEach(container::addRenderableWidget);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -71,20 +71,20 @@ public class ContentWorldInfo extends Content
|
||||
GuiButtonBase world;
|
||||
GuiButtonBase stats;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.addRenderableWidget(new GuiButtonBase(x, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 96, 114, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(start = new GuiButtonBase(x, y + 12, 114, 20, Component.translatable("gui.worldhandler.world_info.start"), () ->
|
||||
container.addRenderableWidget(start = new GuiButtonBase(x, y + 12, 114, 20, Component.translatable("gui.worldhandler.world_info.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(world = new GuiButtonBase(x, y + 36, 114, 20, Component.translatable("gui.worldhandler.world_info.world"), () ->
|
||||
container.addRenderableWidget(world = new GuiButtonBase(x, y + 36, 114, 20, Component.translatable("gui.worldhandler.world_info.world"), () ->
|
||||
{
|
||||
this.page = Page.WORLD;
|
||||
container.init();
|
||||
}));
|
||||
container.add(stats = new GuiButtonBase(x, y + 60, 114, 20, Component.translatable("gui.worldhandler.world_info.statistics"), () ->
|
||||
container.addRenderableWidget(stats = new GuiButtonBase(x, y + 60, 114, 20, Component.translatable("gui.worldhandler.world_info.statistics"), () ->
|
||||
{
|
||||
this.page = Page.STATS;
|
||||
container.init();
|
||||
@@ -100,7 +100,7 @@ public class ContentWorldInfo extends Content
|
||||
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
|
||||
|
||||
world.active = false;
|
||||
container.add(seed = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
container.addRenderableWidget(seed = new GuiButtonBase(x + 118, y + 60, 114, 20, Component.translatable("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard(String.valueOf(server.overworld().getSeed()));
|
||||
}));
|
||||
|
||||
@@ -24,7 +24,7 @@ public class WidgetCommandSyntax implements IContainerWidget
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(this.syntaxField);
|
||||
container.addRenderableWidget(this.syntaxField);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,7 +29,7 @@ public class WidgetNameField implements IContainerWidget
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(this.nameField);
|
||||
container.addWidget(this.nameField);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ import net.minecraft.network.chat.Component;
|
||||
public class WidgetShortcuts implements IContainerWidget
|
||||
{
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
int start = container.width / 2 - 157;
|
||||
EnumShortcuts shortcuts[] = EnumShortcuts.values();
|
||||
@@ -21,7 +21,7 @@ public class WidgetShortcuts implements IContainerWidget
|
||||
for(int i = 0; i < shortcuts.length; i++)
|
||||
{
|
||||
EnumShortcuts shortcut = shortcuts[i];
|
||||
container.addWidget(new GuiButtonIcon(start + i * 21, 0, 20, 20, shortcut.getIcon(), shortcut.getTextSupplier().get(), shortcut.getActionHandler()));
|
||||
container.addRenderableWidget(new GuiButtonIcon(start + i * 21, 0, 20, 20, shortcut.getIcon(), shortcut.getTextSupplier().get(), shortcut.getActionHandler()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
private static final int WEDGE_HEIGHT = 10;
|
||||
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
Content content = container.getContent();
|
||||
Category category = content.getCategory();
|
||||
|
||||
@@ -15,25 +15,25 @@ import net.minecraft.network.chat.Component;
|
||||
|
||||
public class GuiButtonBase extends Button
|
||||
{
|
||||
public GuiButtonBase(int x, int y, int widthIn, int heightIn, String translationKey, ActionHandler actionHandler)
|
||||
public GuiButtonBase(int x, int y, int width, int height, String translationKey, ActionHandler actionHandler)
|
||||
{
|
||||
this(x, y, widthIn, heightIn, Component.translatable(translationKey), actionHandler);
|
||||
this(x, y, width, height, Component.translatable(translationKey), actionHandler);
|
||||
}
|
||||
|
||||
public GuiButtonBase(int x, int y, int widthIn, int heightIn, Component buttonText, ActionHandler actionHandler)
|
||||
public GuiButtonBase(int x, int y, int width, int height, Component buttonText, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, button -> ActionHelper.tryRun(actionHandler));
|
||||
super(x, y, width, height, buttonText, button -> ActionHelper.tryRun(actionHandler), Button.DEFAULT_NARRATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
|
||||
GuiComponent.drawCenteredString(matrix, Minecraft.getInstance().font, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, this.getFGColor());
|
||||
this.renderBg(poseStack, Minecraft.getInstance(), mouseX, mouseY);
|
||||
GuiComponent.drawCenteredString(poseStack, Minecraft.getInstance().font, this.getMessage(), this.getX() + this.width / 2, this.getY() + (this.height - 8) / 2, this.getFGColor());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(PoseStack matrix, Minecraft minecraft, int mouseX, int mouseY)
|
||||
protected void renderBg(PoseStack poseStack, Minecraft minecraft, int mouseX, int mouseY)
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
RenderUtils.colorDefaultButton();
|
||||
@@ -48,19 +48,19 @@ public class GuiButtonBase extends Button
|
||||
{
|
||||
int textureOffset = 46 + hovered * 20;
|
||||
|
||||
this.blit(matrix, this.x, this.y, 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(matrix, this.x, this.y + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(matrix, this.x + hWidth, this.y, 200 - hWidth, textureOffset, hWidth, hHeight);
|
||||
this.blit(matrix, this.x + hWidth, this.y + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
int textureOffset = hovered * 20;
|
||||
|
||||
this.blit(matrix, this.x, this.y, 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(matrix, this.x, this.y + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(matrix, this.x + hWidth, this.y, 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
||||
this.blit(matrix, this.x + hWidth, this.y + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
||||
this.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
@@ -12,24 +12,24 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
||||
{
|
||||
private final EnumIcon icon;
|
||||
|
||||
public GuiButtonIcon(int x, int y, int widthIn, int heightIn, EnumIcon icon, Component tooltip, ActionHandler actionHandler)
|
||||
public GuiButtonIcon(int x, int y, int width, int height, EnumIcon icon, Component tooltip, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, tooltip, tooltip, actionHandler);
|
||||
super(x, y, width, height, tooltip, tooltip, actionHandler);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
|
||||
super.renderBg(poseStack, Minecraft.getInstance(), mouseX, mouseY);
|
||||
|
||||
if(this.icon != null)
|
||||
{
|
||||
this.renderIcon(matrix);
|
||||
this.renderIcon(poseStack);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderIcon(PoseStack matrix)
|
||||
private void renderIcon(PoseStack poseStack)
|
||||
{
|
||||
RenderSystem.setShaderTexture(0, ResourceHelper.iconTexture());
|
||||
|
||||
@@ -42,6 +42,6 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
||||
RenderSystem.setShaderColor(0.8F, 0.8F, 0.8F, 1.0F);
|
||||
}
|
||||
|
||||
this.blit(matrix, this.x + this.width / 2 - 4, this.y + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
||||
this.blit(poseStack, this.getX() + this.width / 2 - 4, this.getY() + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ public class GuiButtonItem extends GuiButtonBase
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(this.stack, this.x + this.width / 2 - 8, this.y + 2);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(this.stack, this.getX() + this.width / 2 - 8, this.getY() + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,9 +36,9 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
|
||||
this.renderBg(poseStack, Minecraft.getInstance(), mouseX, mouseY);
|
||||
this.updateMessage();
|
||||
|
||||
Font font = Minecraft.getInstance().font;
|
||||
@@ -52,11 +52,11 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
int spaceWidth = font.width(" ");
|
||||
|
||||
Component display = TextUtils.stripText((MutableComponent) this.getMessage(), maxWidth, font);
|
||||
int yPos = this.y + (this.height - 8) / 2;
|
||||
int yPos = this.getY() + (this.height - 8) / 2;
|
||||
|
||||
GuiComponent.drawCenteredString(matrix, font, display, this.x + this.width / 2, yPos, this.getFGColor());
|
||||
GuiComponent.drawCenteredString(matrix, font, leftArrow, this.x + this.width / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
||||
GuiComponent.drawCenteredString(matrix, font, rightArrow, this.x + this.width / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
||||
GuiComponent.drawCenteredString(poseStack, font, display, this.getX() + this.width / 2, yPos, this.getFGColor());
|
||||
GuiComponent.drawCenteredString(poseStack, font, leftArrow, this.getX() + this.width / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
||||
GuiComponent.drawCenteredString(poseStack, font, rightArrow, this.getX() + this.width / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,17 +134,17 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
|
||||
private boolean isHoveringLeft(double mouseX, double mouseY)
|
||||
{
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.x && mouseX < this.x + Math.ceil(this.width / 2);
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.getX() && mouseX < this.getX() + Math.ceil(this.width / 2);
|
||||
}
|
||||
|
||||
private boolean isHoveringRight(double mouseX, double mouseY)
|
||||
{
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.x + Math.ceil(this.width / 2) && mouseX < this.x + this.width;
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.getX() + Math.ceil(this.width / 2) && mouseX < this.getX() + this.width;
|
||||
}
|
||||
|
||||
private boolean isHoveringVertical(double mouseY)
|
||||
{
|
||||
return mouseY >= this.y && mouseY < this.y + this.height;
|
||||
return mouseY >= this.getY() && mouseY < this.getY() + this.height;
|
||||
}
|
||||
|
||||
public static class Persistence
|
||||
|
||||
@@ -21,16 +21,16 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
private final SoundEvent sound;
|
||||
private final float pitch;
|
||||
|
||||
public GuiButtonPiano(int x, int y, int widthIn, int heightIn, Component buttonText, SoundEvent sound, float pitch, Type type, ActionHandler actionHandler)
|
||||
public GuiButtonPiano(int x, int y, int width, int height, Component buttonText, SoundEvent sound, float pitch, Type type, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, actionHandler);
|
||||
super(x, y, width, height, buttonText, actionHandler);
|
||||
this.sound = sound;
|
||||
this.pitch = pitch;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
switch(this.type)
|
||||
{
|
||||
@@ -60,28 +60,28 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
case LEFT:
|
||||
case NORMAL:
|
||||
case RIGHT:
|
||||
this.drawWhiteKey(matrix, hovered);
|
||||
this.drawWhiteKey(poseStack, hovered);
|
||||
break;
|
||||
case BLACK:
|
||||
this.drawBlackKey(matrix, hovered);
|
||||
this.drawBlackKey(poseStack, hovered);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawWhiteKey(PoseStack matrix, int hoverstate)
|
||||
protected void drawWhiteKey(PoseStack poseStack, int hoverstate)
|
||||
{
|
||||
int textColor = this.getFGColor();
|
||||
Font font = Minecraft.getInstance().font;
|
||||
|
||||
this.blit(matrix, this.x, this.y, 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||
font.draw(matrix, this.getMessage(), (float) (this.x + this.width / 2 - font.width(this.getMessage()) / 2), (float) (this.y + (this.height - 8) / 2 + 36), textColor);
|
||||
this.blit(poseStack, this.getX(), this.getY(), 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||
font.draw(poseStack, this.getMessage(), (float) (this.getX() + this.width / 2 - font.width(this.getMessage()) / 2), (float) (this.getY() + (this.height - 8) / 2 + 36), textColor);
|
||||
}
|
||||
|
||||
protected void drawBlackKey(PoseStack matrix, int hoverstate)
|
||||
protected void drawBlackKey(PoseStack poseStack, int hoverstate)
|
||||
{
|
||||
this.blit(matrix, this.x, this.y, 55 - hoverstate * 9 + 18, 0, 9, 58);
|
||||
this.blit(poseStack, this.getX(), this.getY(), 55 - hoverstate * 9 + 18, 0, 9, 58);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -112,22 +112,22 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
|
||||
private boolean isHoveringBlack(double mouseX, double mouseY)
|
||||
{
|
||||
return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
return mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + this.width && mouseY < this.getY() + this.height;
|
||||
}
|
||||
|
||||
private boolean isHoveringLeft(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 10 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.getX() && mouseY >= this.getY() && mouseX < this.getX() + 10 && mouseY < this.getY() + 60) || (mouseX >= this.getX() && mouseY >= this.getY() + 58 && mouseX < this.getX() + 14 && mouseY < this.getY() + 93);
|
||||
}
|
||||
|
||||
private boolean isHoveringNormal(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x + 4 && mouseY >= this.y && mouseX < this.x + 10 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.getX() + 4 && mouseY >= this.getY() && mouseX < this.getX() + 10 && mouseY < this.getY() + 60) || (mouseX >= this.getX() && mouseY >= this.getY() + 58 && mouseX < this.getX() + 14 && mouseY < this.getY() + 93);
|
||||
}
|
||||
|
||||
private boolean isHoveringRight(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x + 4 && mouseY >= this.y && mouseX < this.x + 14 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.getX() + 4 && mouseY >= this.getY() && mouseX < this.getX() + 14 && mouseY < this.getY() + 60) || (mouseX >= this.getX() && mouseY >= this.getY() + 58 && mouseX < this.getX() + 14 && mouseY < this.getY() + 93);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -8,13 +8,13 @@ import net.minecraft.network.chat.Component;
|
||||
|
||||
public class GuiButtonTab extends GuiButtonBase
|
||||
{
|
||||
public GuiButtonTab(int x, int y, int widthIn, int heightIn, Component narration, ActionHandler actionHandler)
|
||||
public GuiButtonTab(int x, int y, int width, int height, Component narration, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, narration, actionHandler);
|
||||
super(x, y, width, height, narration, actionHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -10,17 +10,17 @@ public class GuiButtonTooltip extends GuiButtonBase
|
||||
{
|
||||
protected Component tooltip;
|
||||
|
||||
public GuiButtonTooltip(int x, int y, int widthIn, int heightIn, Component buttonText, Component tooltip, ActionHandler actionHandler)
|
||||
public GuiButtonTooltip(int x, int y, int width, int height, Component buttonText, Component tooltip, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, actionHandler);
|
||||
super(x, y, width, height, buttonText, actionHandler);
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public void renderTooltip(Screen screen, PoseStack matrix, int mouseX, int mouseY)
|
||||
public void renderTooltip(Screen screen, PoseStack poseStack, int mouseX, int mouseY)
|
||||
{
|
||||
if(this.isHoveredOrFocused() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
||||
{
|
||||
screen.renderTooltip(matrix, this.tooltip, mouseX, mouseY);
|
||||
screen.renderTooltip(poseStack, this.tooltip, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,21 +21,21 @@ public class GuiSlider extends GuiButtonBase
|
||||
private final ILogicSlider logic;
|
||||
private final Container container;
|
||||
|
||||
public GuiSlider(int x, int y, int widthIn, int heightIn, double min, double max, double start, Container container, ILogicSlider logic)
|
||||
public GuiSlider(int x, int y, int width, int height, double min, double max, double start, Container container, ILogicSlider logic)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, Component.empty(), null);
|
||||
super(x, y, width, height, Component.empty(), null);
|
||||
this.logic = Objects.requireNonNull(logic);
|
||||
this.container = Objects.requireNonNull(container);
|
||||
this.persistence = this.container.getContent().getPersistence(this.logic.getId(), () -> new Persistence(min, max, min == max ? 0.0 : ((start - min) / (max - min))));
|
||||
this.persistence.validate(min, max);
|
||||
this.logic.onChangeSliderValue(this.persistence.getValueInt());
|
||||
this.logic.onChangeSliderValue(this.persistence.getIntValue());
|
||||
this.updateDisplayString();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(PoseStack matrix, Minecraft minecraft, int mouseX, int mouseY)
|
||||
protected void renderBg(PoseStack poseStack, Minecraft minecraft, int mouseX, int mouseY)
|
||||
{
|
||||
super.renderBg(matrix, minecraft, mouseX, mouseY);
|
||||
super.renderBg(poseStack, minecraft, mouseX, mouseY);
|
||||
|
||||
int hovered = super.getYImage(this.isHoveredOrFocused());
|
||||
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 46 : 0) + hovered * 20;
|
||||
@@ -43,8 +43,8 @@ public class GuiSlider extends GuiButtonBase
|
||||
RenderSystem.enableBlend();
|
||||
RenderUtils.colorDefaultButton();
|
||||
|
||||
this.blit(matrix, this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.y, 0, textureOffset, 4, 20);
|
||||
this.blit(matrix, this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.y, 196, textureOffset, 4, 20);
|
||||
this.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.getY(), 0, textureOffset, 4, 20);
|
||||
this.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.getY(), 196, textureOffset, 4, 20);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
@@ -64,7 +64,7 @@ public class GuiSlider extends GuiButtonBase
|
||||
|
||||
protected void updateSlider(double mouseX)
|
||||
{
|
||||
this.persistence.setValue((mouseX - (this.x + 4)) / (float) (this.width - 8));
|
||||
this.persistence.setValue((mouseX - (this.getX() + 4)) / (float) (this.width - 8));
|
||||
|
||||
if(this.persistence.getValue() < 0.0F)
|
||||
{
|
||||
@@ -77,7 +77,7 @@ public class GuiSlider extends GuiButtonBase
|
||||
}
|
||||
|
||||
this.updateDisplayString();
|
||||
this.logic.onChangeSliderValue(this.persistence.getValueInt());
|
||||
this.logic.onChangeSliderValue(this.persistence.getIntValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,7 +88,7 @@ public class GuiSlider extends GuiButtonBase
|
||||
|
||||
private void updateDisplayString()
|
||||
{
|
||||
int value = this.persistence.getValueInt();
|
||||
int value = this.persistence.getIntValue();
|
||||
MutableComponent suffix = this.logic.formatValue(value).append(this.logic.formatSuffix(value));
|
||||
Font fontRenderer = Minecraft.getInstance().font;
|
||||
MutableComponent text = TextUtils.stripText(this.logic.formatPrefix(value), this.width - fontRenderer.width(suffix), fontRenderer).append(suffix);
|
||||
@@ -142,12 +142,12 @@ public class GuiSlider extends GuiButtonBase
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public int getValueInt()
|
||||
public int getIntValue()
|
||||
{
|
||||
return (int) Math.round(this.min + (this.max - this.min) * this.value);
|
||||
}
|
||||
|
||||
public void setValueInt(int value)
|
||||
public void setIntValue(int value)
|
||||
{
|
||||
this.value = this.intToValue(value);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@ public class GuiTextFieldTooltip extends EditBox
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
super.renderButton(poseStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
if(this.isVisible() && !this.isFocused() && this.tooltip != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty())
|
||||
{
|
||||
int x = this.x;
|
||||
int y = this.y;
|
||||
int x = this.getX();
|
||||
int y = this.getY();
|
||||
|
||||
if(this.getInnerWidth() != this.width)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ public class GuiTextFieldTooltip extends EditBox
|
||||
y += (this.height - 8) / 2;
|
||||
}
|
||||
|
||||
Minecraft.getInstance().font.drawShadow(matrix, this.tooltip, (float) x, (float) y, 0x7F7F7F); //drawStringWithShadow
|
||||
Minecraft.getInstance().font.drawShadow(poseStack, this.tooltip, (float) x, (float) y, 0x7F7F7F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,12 +53,6 @@ public class GuiTextFieldTooltip extends EditBox
|
||||
return this.tooltip;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
public void setText(Component text)
|
||||
{
|
||||
if(text != null)
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MenuButtonList extends Menu
|
||||
@Override
|
||||
public void initButtons(Container container)
|
||||
{
|
||||
container.add(new GuiButtonList<Node>(this.x, this.y, this.items, 114, 20, container, new ILogicMapped<Node>()
|
||||
container.addRenderableWidget(new GuiButtonList<Node>(this.x, this.y, this.items, 114, 20, container, new ILogicMapped<Node>()
|
||||
{
|
||||
@Override
|
||||
public MutableComponent translate(Node item)
|
||||
@@ -98,7 +98,7 @@ public class MenuButtonList extends Menu
|
||||
{
|
||||
GuiButtonBase button = new GuiButtonBase(this.x, this.y + 24 * x, 114, 20, Component.empty(), null);
|
||||
button.active = false;
|
||||
container.add(button);
|
||||
container.addRenderableWidget(button);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,12 +75,12 @@ public class MenuColorField extends Menu
|
||||
{
|
||||
if(this.logic.doDrawTextField())
|
||||
{
|
||||
container.add(this.textField);
|
||||
container.addRenderableWidget(this.textField);
|
||||
}
|
||||
|
||||
if(this.logic.doDrawButtons())
|
||||
{
|
||||
container.add(new GuiButtonList<ChatFormatting>(this.x + 118, this.y + 24, COLORS, 114, 20, container, new ILogicMapped<ChatFormatting>()
|
||||
container.addRenderableWidget(new GuiButtonList<ChatFormatting>(this.x + 118, this.y + 24, COLORS, 114, 20, container, new ILogicMapped<ChatFormatting>()
|
||||
{
|
||||
@Override
|
||||
public MutableComponent translate(ChatFormatting item)
|
||||
@@ -113,27 +113,27 @@ public class MenuColorField extends Menu
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, Component.literal("I").setStyle(Style.EMPTY.withItalic(this.component.getStyle().isItalic())), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, Component.literal("I").setStyle(Style.EMPTY.withItalic(this.component.getStyle().isItalic())), () ->
|
||||
{
|
||||
this.component.setStyle(this.component.getStyle().withItalic(!this.component.getStyle().isItalic()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, Component.literal("B").setStyle(Style.EMPTY.withBold(this.component.getStyle().isBold())), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, Component.literal("B").setStyle(Style.EMPTY.withBold(this.component.getStyle().isBold())), () ->
|
||||
{
|
||||
this.component.setStyle(this.component.getStyle().withBold(!this.component.getStyle().isBold()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, Component.literal("U").setStyle(Style.EMPTY.withUnderlined(this.component.getStyle().isUnderlined())), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, Component.literal("U").setStyle(Style.EMPTY.withUnderlined(this.component.getStyle().isUnderlined())), () ->
|
||||
{
|
||||
this.component.setStyle(this.component.getStyle().withUnderlined(!this.component.getStyle().isUnderlined()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, Component.literal("S").setStyle(Style.EMPTY.withStrikethrough(this.component.getStyle().isStrikethrough())), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, Component.literal("S").setStyle(Style.EMPTY.withStrikethrough(this.component.getStyle().isStrikethrough())), () ->
|
||||
{
|
||||
this.component.setStyle(this.component.getStyle().withStrikethrough(!this.component.getStyle().isStrikethrough()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, Component.literal("O").setStyle(Style.EMPTY.withObfuscated(this.component.getStyle().isObfuscated())), () ->
|
||||
container.addRenderableWidget(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, Component.literal("O").setStyle(Style.EMPTY.withObfuscated(this.component.getStyle().isObfuscated())), () ->
|
||||
{
|
||||
this.component.setStyle(this.component.getStyle().withObfuscated(!this.component.getStyle().isObfuscated()));
|
||||
container.init();
|
||||
|
||||
@@ -58,11 +58,11 @@ public class MenuPageList<T> extends Menu
|
||||
|
||||
GuiButtonBase left = new GuiButtonBase(this.x, this.y + (this.height + 4) * this.length, buttonWidth + 1, this.height, TextUtils.ARROW_LEFT, () -> this.goLeft(container));
|
||||
left.active = this.persistence.getPage() > 0;
|
||||
container.add(left);
|
||||
container.addRenderableWidget(left);
|
||||
|
||||
GuiButtonBase right = new GuiButtonBase(this.x + 5 + buttonWidth, this.y + (this.height + 4) * this.length, buttonWidth, this.height, TextUtils.ARROW_RIGHT, () -> this.goRight(container));
|
||||
right.active = this.persistence.getPage() < this.getTotalPages() - 1;
|
||||
container.add(right);
|
||||
container.addRenderableWidget(right);
|
||||
}
|
||||
|
||||
int length = (extended ? this.length + 1 : this.length);
|
||||
@@ -93,7 +93,7 @@ public class MenuPageList<T> extends Menu
|
||||
button.active = false;
|
||||
}
|
||||
|
||||
container.add(button);
|
||||
container.addRenderableWidget(button);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.argument.Coordinate;
|
||||
import exopandora.worldhandler.builder.impl.ExecuteCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.ExecuteCommandBuilder.AtOptionalArgument;
|
||||
import exopandora.worldhandler.builder.impl.FillCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.SetBlockCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.ExecuteCommandBuilder.AtOptionalArgument;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
@@ -97,7 +97,7 @@ public class BlockHelper
|
||||
remove.to().setZ(new Coordinate.Ints(0, Coordinate.Type.RELATIVE));
|
||||
remove.block().set(Blocks.AIR);
|
||||
|
||||
Minecraft.getInstance().player.commandUnsigned(place.toCommand(FillCommandBuilder.Label.FILL, false).substring(1));
|
||||
Minecraft.getInstance().player.connection.sendCommand(place.toCommand(FillCommandBuilder.Label.FILL, false).substring(1));
|
||||
|
||||
ExecuteCommandBuilder execute = new ExecuteCommandBuilder();
|
||||
AtOptionalArgument at = new AtOptionalArgument(AtOptionalArgument.Label.AT);
|
||||
|
||||
@@ -51,7 +51,7 @@ public class CommandHelper
|
||||
}
|
||||
else if(Minecraft.getInstance().player != null)
|
||||
{
|
||||
Minecraft.getInstance().player.commandUnsigned(command.substring(1));
|
||||
Minecraft.getInstance().player.connection.sendCommand(command.substring(1));
|
||||
}
|
||||
|
||||
WorldHandler.LOGGER.info("Command: " + command);
|
||||
|
||||
@@ -1,67 +1,25 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
import net.minecraft.core.HolderLookup.Provider;
|
||||
import net.minecraft.data.registries.VanillaRegistries;
|
||||
|
||||
public class RegistryHelper
|
||||
{
|
||||
private static final Map<IForgeRegistry<?>, Function<?, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<?, String>>();
|
||||
private static final RegistryHelper INSTANCE = new RegistryHelper();
|
||||
private static Provider provider;
|
||||
|
||||
static
|
||||
public static void init()
|
||||
{
|
||||
registerRegistry(ForgeRegistries.BLOCKS, Block::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.ITEMS, Item::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.MOB_EFFECTS, MobEffect::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.BIOMES, biome -> ForgeRegistries.BIOMES.getKey(biome).toLanguageKey("biome"));
|
||||
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.ENTITY_TYPES, EntityType::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.'));
|
||||
registerRegistry(ForgeRegistries.VILLAGER_PROFESSIONS, profession ->
|
||||
{
|
||||
ResourceLocation profName = ForgeRegistries.VILLAGER_PROFESSIONS.getKey(profession);
|
||||
return EntityType.VILLAGER.getDescriptionId() + '.' + (!"minecraft".equals(profName.getNamespace()) ? profName.getNamespace() + '.' : "") + profName.getPath();
|
||||
});
|
||||
provider = VanillaRegistries.createLookup();
|
||||
}
|
||||
|
||||
private static <T> void registerRegistry(IForgeRegistry<T> registry, Function<T, String> mapper)
|
||||
public static Provider getLookupProvider()
|
||||
{
|
||||
FORGE.put(registry, mapper);
|
||||
return provider;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> String translate(ResourceLocation resource)
|
||||
public static RegistryHelper getInstance()
|
||||
{
|
||||
for(IForgeRegistry<?> registry : FORGE.keySet())
|
||||
{
|
||||
if(registry.containsKey(resource))
|
||||
{
|
||||
return ((Function<T, String>) FORGE.get(registry)).apply((T) registry.getValue(resource));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> void register(RegisterEvent event, ResourceKey<Registry<T>> key, String location, Supplier<T> valueSupplier)
|
||||
{
|
||||
event.register(key, new ResourceLocation(Main.MODID, location), valueSupplier);
|
||||
return INSTANCE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.util;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.math.Vector3f;
|
||||
import com.mojang.math.Axis;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
@@ -29,13 +29,13 @@ public class RenderUtils
|
||||
matrix.translate(width + 5, height + 5, 0F);
|
||||
matrix.scale(0.25F, 0.25F, 0.25F);
|
||||
|
||||
matrix.mulPose(Vector3f.ZP.rotationDegrees(rotationHour));
|
||||
matrix.mulPose(Axis.ZP.rotationDegrees(rotationHour));
|
||||
GuiComponent.fill(matrix, -1, -1, 1, 11, 0xFF383838);
|
||||
matrix.mulPose(Vector3f.ZN.rotationDegrees(rotationHour));
|
||||
matrix.mulPose(Axis.ZN.rotationDegrees(rotationHour));
|
||||
|
||||
matrix.mulPose(Vector3f.ZP.rotationDegrees(rotationMinute));
|
||||
matrix.mulPose(Axis.ZP.rotationDegrees(rotationMinute));
|
||||
GuiComponent.fill(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
|
||||
matrix.mulPose(Vector3f.ZN.rotationDegrees(rotationMinute));
|
||||
matrix.mulPose(Axis.ZN.rotationDegrees(rotationMinute));
|
||||
|
||||
matrix.popPose();
|
||||
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
import net.minecraftforge.registries.RegisterEvent;
|
||||
|
||||
public class TranslationHelper
|
||||
{
|
||||
private static final Map<IForgeRegistry<?>, Function<?, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<?, String>>();
|
||||
|
||||
static
|
||||
{
|
||||
registerRegistry(ForgeRegistries.BLOCKS, Block::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.ITEMS, Item::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.MOB_EFFECTS, MobEffect::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.BIOMES, biome -> ForgeRegistries.BIOMES.getKey(biome).toLanguageKey("biome"));
|
||||
registerRegistry(ForgeRegistries.ENCHANTMENTS, Enchantment::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.ENTITY_TYPES, EntityType::getDescriptionId);
|
||||
registerRegistry(ForgeRegistries.STAT_TYPES, stat -> "stat." + stat.toString().replace(':', '.'));
|
||||
registerRegistry(ForgeRegistries.VILLAGER_PROFESSIONS, profession ->
|
||||
{
|
||||
ResourceLocation profName = ForgeRegistries.VILLAGER_PROFESSIONS.getKey(profession);
|
||||
return EntityType.VILLAGER.getDescriptionId() + '.' + (!"minecraft".equals(profName.getNamespace()) ? profName.getNamespace() + '.' : "") + profName.getPath();
|
||||
});
|
||||
}
|
||||
|
||||
private static <T> void registerRegistry(IForgeRegistry<T> registry, Function<T, String> mapper)
|
||||
{
|
||||
FORGE.put(registry, mapper);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> String translate(ResourceLocation resource)
|
||||
{
|
||||
for(IForgeRegistry<?> registry : FORGE.keySet())
|
||||
{
|
||||
if(registry.containsKey(resource))
|
||||
{
|
||||
return ((Function<T, String>) FORGE.get(registry)).apply((T) registry.getValue(resource));
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> void register(RegisterEvent event, ResourceKey<Registry<T>> key, String location, Supplier<T> valueSupplier)
|
||||
{
|
||||
event.register(key, new ResourceLocation(Main.MODID, location), valueSupplier);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[42,)"
|
||||
loaderVersion="[44,)"
|
||||
updateJSONURL="https://raw.githubusercontent.com/Exopandora/worldhandler/master/version.json"
|
||||
issueTrackerURL="https://github.com/Exopandora/WorldHandler/issues"
|
||||
displayURL="https://minecraft.curseforge.com/projects/world-handler-command-gui"
|
||||
@@ -11,13 +11,13 @@ license="GPL v3.0"
|
||||
|
||||
[[mods]]
|
||||
modId="worldhandler"
|
||||
version="1.19.2-${version}"
|
||||
version="1.19.3-${version}"
|
||||
displayName="World Handler"
|
||||
description="The World Handler provides a simple and easy to use graphical user interface for commands. It lets you create powerful and complex sub-commands alongside NBT-structures within seconds."
|
||||
|
||||
[[dependencies.worldhandler]]
|
||||
modId="minecraft"
|
||||
mandatory=true
|
||||
versionRange="[1.19.1,)"
|
||||
versionRange="[1.19.3,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "World Handler",
|
||||
"pack_format": 9
|
||||
"pack_format": 11
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user