Update to 1.19.4
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
mod_id = worldhandler
|
||||
mod_name = WorldHandler
|
||||
version = 3.4.3
|
||||
minecraft_version = 1.19.3
|
||||
minecraft_version = 1.19.4
|
||||
group = exopandora.worldhandler
|
||||
main_class = exopandora.worldhandler.Main
|
||||
author = Exopandora
|
||||
|
||||
# Forge
|
||||
forge_version = 44.0.1
|
||||
forge_version = 45.0.1
|
||||
|
||||
# Gradle
|
||||
org.gradle.jvmargs = -Xmx3G
|
||||
|
||||
@@ -11,8 +11,8 @@ public class Main
|
||||
{
|
||||
public static final String NAME = "World Handler";
|
||||
public static final String MODID = "worldhandler";
|
||||
public static final String MC_VERSION = "1.19.3";
|
||||
public static final String MOD_VERSION = "3.4.2";
|
||||
public static final String MC_VERSION = "1.19.4";
|
||||
public static final String MOD_VERSION = "3.4.3";
|
||||
public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui";
|
||||
|
||||
public static void main(String[] args)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exopandora.worldhandler;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -50,7 +51,7 @@ public class WorldHandler
|
||||
public void run()
|
||||
{
|
||||
Config.setupDirectories(WorldHandler.USERCONTENT_PATH);
|
||||
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml");
|
||||
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + File.pathSeparator + Main.MODID + ".toml");
|
||||
UsercontentLoader.load(WorldHandler.USERCONTENT_PATH);
|
||||
modEventBus.addListener(WorldHandler.this::registerKeyMappingsEvent);
|
||||
modEventBus.addListener(WorldHandler.this::registerClientReloadListeners);
|
||||
|
||||
@@ -334,4 +334,9 @@ public class Arguments
|
||||
{
|
||||
return new BlockPosArgument();
|
||||
}
|
||||
|
||||
public static DimensionArgument dimension()
|
||||
{
|
||||
return new DimensionArgument();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public class BlockPosArgument implements IArgument
|
||||
return null;
|
||||
}
|
||||
|
||||
return new BlockPos(this.x.getValue().doubleValue(), this.y.getValue().doubleValue(), this.z.getValue().doubleValue());
|
||||
return new BlockPos(this.x.getValue().intValue(), this.y.getValue().intValue(), this.z.getValue().intValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -63,9 +63,4 @@ public class DimensionArgument implements IDeserializableArgument
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DimensionArgument dimension()
|
||||
{
|
||||
return new DimensionArgument();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,23 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
.label(Label.MODIFY_BLOCK_FROM_STORAGE_PATH)))))
|
||||
.then(CommandNode.literal("value")
|
||||
.then(CommandNode.argument("value", this.value)
|
||||
.label(Label.MODIFY_BLOCK_VALUE)))))))
|
||||
.label(Label.MODIFY_BLOCK_VALUE)))
|
||||
.then(CommandNode.literal("string")
|
||||
.then(CommandNode.literal("block")
|
||||
.then(CommandNode.argument("sourcePos", this.sourcePos)
|
||||
.label(Label.MODIFY_BLOCK_STRING_BLOCK)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_BLOCK_STRING_BLOCK_PATH))))
|
||||
.then(CommandNode.literal("entity")
|
||||
.then(CommandNode.argument("sourceTarget", this.sourceTarget)
|
||||
.label(Label.MODIFY_BLOCK_STRING_ENTITY)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_BLOCK_STRING_ENTITY_PATH))))
|
||||
.then(CommandNode.literal("storage")
|
||||
.then(CommandNode.argument("source", this.sourceTarget)
|
||||
.label(Label.MODIFY_BLOCK_STRING_STORAGE)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_BLOCK_STRING_STORAGE_PATH)))))))))
|
||||
.then(CommandNode.literal("entity")
|
||||
.then(CommandNode.argument("target", this.target)
|
||||
.then(CommandNode.argument("path", this.path)
|
||||
@@ -107,7 +123,23 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
.label(Label.MODIFY_ENTITY_FROM_STORAGE_PATH)))))
|
||||
.then(CommandNode.literal("value")
|
||||
.then(CommandNode.argument("value", this.value)
|
||||
.label(Label.MODIFY_ENTITY_VALUE)))))))
|
||||
.label(Label.MODIFY_ENTITY_VALUE)))
|
||||
.then(CommandNode.literal("string")
|
||||
.then(CommandNode.literal("block")
|
||||
.then(CommandNode.argument("sourcePos", this.sourcePos)
|
||||
.label(Label.MODIFY_ENTITY_STRING_BLOCK)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_ENTITY_STRING_BLOCK_PATH))))
|
||||
.then(CommandNode.literal("entity")
|
||||
.then(CommandNode.argument("sourceTarget", this.sourceTarget)
|
||||
.label(Label.MODIFY_ENTITY_STRING_ENTITY)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_ENTITY_STRING_ENTITY_PATH))))
|
||||
.then(CommandNode.literal("storage")
|
||||
.then(CommandNode.argument("source", this.sourceTarget)
|
||||
.label(Label.MODIFY_ENTITY_STRING_STORAGE)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_ENTITY_STRING_STORAGE_PATH)))))))))
|
||||
.then(CommandNode.literal("storage")
|
||||
.then(CommandNode.argument("target", this.target)
|
||||
.then(CommandNode.argument("path", this.path)
|
||||
@@ -130,7 +162,23 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
.label(Label.MODIFY_STORAGE_FROM_STORAGE_PATH)))))
|
||||
.then(CommandNode.literal("value")
|
||||
.then(CommandNode.argument("value", this.value)
|
||||
.label(Label.MODIFY_STORAGE_VALUE))))))))
|
||||
.label(Label.MODIFY_STORAGE_VALUE)))
|
||||
.then(CommandNode.literal("string")
|
||||
.then(CommandNode.literal("block")
|
||||
.then(CommandNode.argument("sourcePos", this.sourcePos)
|
||||
.label(Label.MODIFY_STORAGE_STRING_BLOCK)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_STORAGE_STRING_BLOCK_PATH))))
|
||||
.then(CommandNode.literal("entity")
|
||||
.then(CommandNode.argument("sourceTarget", this.sourceTarget)
|
||||
.label(Label.MODIFY_STORAGE_STRING_ENTITY)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_STORAGE_STRING_ENTITY_PATH))))
|
||||
.then(CommandNode.literal("storage")
|
||||
.then(CommandNode.argument("source", this.sourceTarget)
|
||||
.label(Label.MODIFY_STORAGE_STRING_STORAGE)
|
||||
.then(CommandNode.argument("sourcePath", this.sourcePath)
|
||||
.label(Label.MODIFY_STORAGE_STRING_STORAGE_PATH))))))))))
|
||||
.then(CommandNode.literal("remove")
|
||||
.then(CommandNode.literal("block")
|
||||
.then(CommandNode.argument("targetPos", this.targetPos)
|
||||
@@ -227,6 +275,12 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
MODIFY_BLOCK_FROM_STORAGE,
|
||||
MODIFY_BLOCK_FROM_STORAGE_PATH,
|
||||
MODIFY_BLOCK_VALUE,
|
||||
MODIFY_BLOCK_STRING_BLOCK,
|
||||
MODIFY_BLOCK_STRING_BLOCK_PATH,
|
||||
MODIFY_BLOCK_STRING_ENTITY,
|
||||
MODIFY_BLOCK_STRING_ENTITY_PATH,
|
||||
MODIFY_BLOCK_STRING_STORAGE,
|
||||
MODIFY_BLOCK_STRING_STORAGE_PATH,
|
||||
MODIFY_ENTITY_FROM_BLOCK,
|
||||
MODIFY_ENTITY_FROM_BLOCK_PATH,
|
||||
MODIFY_ENTITY_FROM_ENTITY,
|
||||
@@ -234,6 +288,12 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
MODIFY_ENTITY_FROM_STORAGE,
|
||||
MODIFY_ENTITY_FROM_STORAGE_PATH,
|
||||
MODIFY_ENTITY_VALUE,
|
||||
MODIFY_ENTITY_STRING_BLOCK,
|
||||
MODIFY_ENTITY_STRING_BLOCK_PATH,
|
||||
MODIFY_ENTITY_STRING_ENTITY,
|
||||
MODIFY_ENTITY_STRING_ENTITY_PATH,
|
||||
MODIFY_ENTITY_STRING_STORAGE,
|
||||
MODIFY_ENTITY_STRING_STORAGE_PATH,
|
||||
MODIFY_STORAGE_FROM_BLOCK,
|
||||
MODIFY_STORAGE_FROM_BLOCK_PATH,
|
||||
MODIFY_STORAGE_FROM_ENTITY,
|
||||
@@ -241,6 +301,12 @@ public class DataCommandBuilder extends CommandBuilder
|
||||
MODIFY_STORAGE_FROM_STORAGE,
|
||||
MODIFY_STORAGE_FROM_STORAGE_PATH,
|
||||
MODIFY_STORAGE_VALUE,
|
||||
MODIFY_STORAGE_STRING_BLOCK,
|
||||
MODIFY_STORAGE_STRING_BLOCK_PATH,
|
||||
MODIFY_STORAGE_STRING_ENTITY,
|
||||
MODIFY_STORAGE_STRING_ENTITY_PATH,
|
||||
MODIFY_STORAGE_STRING_STORAGE,
|
||||
MODIFY_STORAGE_STRING_STORAGE_PATH,
|
||||
REMOVE_BLOCK,
|
||||
REMOVE_ENTITY,
|
||||
REMOVE_STORAGE;
|
||||
|
||||
@@ -26,7 +26,13 @@ public class EffectCommandBuilder extends CommandBuilder
|
||||
.then(CommandNode.argument("amplifier", this.amplifier)
|
||||
.label(Label.GIVE_SECONDS_AMPLIFIER)
|
||||
.then(CommandNode.argument("hideParticles", this.hideParticles)
|
||||
.label(Label.GIVE_SECONDS_AMPLIFIER_HIDEPARTICLES)))))))
|
||||
.label(Label.GIVE_SECONDS_AMPLIFIER_HIDEPARTICLES))))
|
||||
.then(CommandNode.literal("infinite")
|
||||
.label(Label.GIVE_INFINITE)
|
||||
.then(CommandNode.argument("amplifier", this.amplifier)
|
||||
.label(Label.GIVE_INFINITE_AMPLIFIER)
|
||||
.then(CommandNode.argument("hideParticles", this.hideParticles)
|
||||
.label(Label.GIVE_INFINITE_AMPLIFIER_HIDEPARTICLES)))))))
|
||||
.then(CommandNode.literal("clear")
|
||||
.label(Label.CLEAR)
|
||||
.then(CommandNode.argument("targets", this.targets)
|
||||
@@ -71,6 +77,9 @@ public class EffectCommandBuilder extends CommandBuilder
|
||||
GIVE_SECONDS,
|
||||
GIVE_SECONDS_AMPLIFIER,
|
||||
GIVE_SECONDS_AMPLIFIER_HIDEPARTICLES,
|
||||
GIVE_INFINITE,
|
||||
GIVE_INFINITE_AMPLIFIER,
|
||||
GIVE_INFINITE_AMPLIFIER_HIDEPARTICLES,
|
||||
CLEAR,
|
||||
CLEAR_TARGETS,
|
||||
CLEAR_TARGETS_EFFECT;
|
||||
|
||||
@@ -8,6 +8,7 @@ import exopandora.worldhandler.builder.argument.Arguments;
|
||||
import exopandora.worldhandler.builder.argument.BlockPosArgument;
|
||||
import exopandora.worldhandler.builder.argument.CommandArgument;
|
||||
import exopandora.worldhandler.builder.argument.DimensionArgument;
|
||||
import exopandora.worldhandler.builder.argument.EntitySummonArgument;
|
||||
import exopandora.worldhandler.builder.argument.NbtPathArgument;
|
||||
import exopandora.worldhandler.builder.argument.PrimitiveArgument;
|
||||
import exopandora.worldhandler.builder.argument.RangeArgument;
|
||||
@@ -213,7 +214,7 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
|
||||
public static class InOptionalArgument extends OptionalCommandBuilder<InOptionalArgument.Label>
|
||||
{
|
||||
private final DimensionArgument dimension = DimensionArgument.dimension();
|
||||
private final DimensionArgument dimension = Arguments.dimension();
|
||||
private final CommandNodeLiteral root = CommandNode.literal("in")
|
||||
.then(CommandNode.argument("dimension", this.dimension)
|
||||
.label(Label.IN));
|
||||
@@ -249,7 +250,16 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
.label(Label.POS))
|
||||
.then(CommandNode.literal("as")
|
||||
.then(CommandNode.argument("targets", this.targets)
|
||||
.label(Label.AS)));
|
||||
.label(Label.AS)))
|
||||
.then(CommandNode.literal("over")
|
||||
.then(CommandNode.literal("world_surface")
|
||||
.label(Label.OVER_WORLD_SURFACE))
|
||||
.then(CommandNode.literal("motion_blocking")
|
||||
.label(Label.OVER_MOTION_BLOCKING))
|
||||
.then(CommandNode.literal("motion_blocking_no_leaves")
|
||||
.label(Label.OVER_MOTION_BLOCKING_NO_LEAVES))
|
||||
.then(CommandNode.literal("ocean_floor")
|
||||
.label(Label.OVER_OCEAN_FLOOR)));
|
||||
|
||||
public PositionedOptionalArgument(Label label)
|
||||
{
|
||||
@@ -275,7 +285,11 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
public static enum Label
|
||||
{
|
||||
POS,
|
||||
AS;
|
||||
AS,
|
||||
OVER_WORLD_SURFACE,
|
||||
OVER_MOTION_BLOCKING,
|
||||
OVER_MOTION_BLOCKING_NO_LEAVES,
|
||||
OVER_OCEAN_FLOOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,6 +330,7 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
private final BlockPosArgument start = Arguments.blockPos();
|
||||
private final BlockPosArgument end = Arguments.blockPos();
|
||||
private final BlockPosArgument destination = Arguments.blockPos();
|
||||
private final DimensionArgument dimension = Arguments.dimension();
|
||||
private final NbtPathArgument path = Arguments.nbtPath();
|
||||
private final PrimitiveArgument<ResourceLocation> predicate = Arguments.resourceLocation();
|
||||
private final TargetArgument target = Arguments.target();
|
||||
@@ -354,9 +369,15 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
.then(CommandNode.argument("source", this.target)
|
||||
.then(CommandNode.argument("sourcePath", this.path)
|
||||
.label(Label.DATA_STORAGE)))))
|
||||
.then(CommandNode.literal("dimension")
|
||||
.then(CommandNode.argument("dimension", this.dimension)
|
||||
.label(Label.DIMENSION)))
|
||||
.then(CommandNode.literal("entity")
|
||||
.then(CommandNode.argument("entites", this.target)
|
||||
.label(Label.ENTITY)))
|
||||
.then(CommandNode.literal("loaded")
|
||||
.then(CommandNode.argument("pos", this.pos)
|
||||
.label(Label.LOADED)))
|
||||
.then(CommandNode.literal("predicate")
|
||||
.then(CommandNode.argument("predicate", this.predicate)
|
||||
.label(Label.PREDICATE)))
|
||||
@@ -462,7 +483,9 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
DATA_BLOCK,
|
||||
DATA_ENTITY,
|
||||
DATA_STORAGE,
|
||||
DIMENSION,
|
||||
ENTITY,
|
||||
LOADED,
|
||||
PREDICATE,
|
||||
SCORE_LT,
|
||||
SCORE_LE,
|
||||
@@ -621,4 +644,78 @@ public class ExecuteCommandBuilder extends CommandBuilder
|
||||
SUCCESS_STORAGE;
|
||||
}
|
||||
}
|
||||
|
||||
public static class OnOptionalArgument extends OptionalCommandBuilder<OnOptionalArgument.Label>
|
||||
{
|
||||
private final CommandNodeLiteral root = CommandNode.literal("on")
|
||||
.then(CommandNode.literal("attacker")
|
||||
.label(Label.ATTACKER))
|
||||
.then(CommandNode.literal("controller")
|
||||
.label(Label.CONTROLLER))
|
||||
.then(CommandNode.literal("leasher")
|
||||
.label(Label.LEASHER))
|
||||
.then(CommandNode.literal("origin")
|
||||
.label(Label.ORIGIN))
|
||||
.then(CommandNode.literal("owner")
|
||||
.label(Label.OWNER))
|
||||
.then(CommandNode.literal("passengers")
|
||||
.label(Label.PASSENGERS))
|
||||
.then(CommandNode.literal("target")
|
||||
.label(Label.TARGET))
|
||||
.then(CommandNode.literal("vehicle")
|
||||
.label(Label.VEHICLE));
|
||||
|
||||
public OnOptionalArgument(Label label)
|
||||
{
|
||||
super(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandNodeLiteral root()
|
||||
{
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public static enum Label
|
||||
{
|
||||
ATTACKER,
|
||||
CONTROLLER,
|
||||
LEASHER,
|
||||
ORIGIN,
|
||||
OWNER,
|
||||
PASSENGERS,
|
||||
TARGET,
|
||||
VEHICLE;
|
||||
}
|
||||
}
|
||||
|
||||
public static class SummonOptionalArgument extends OptionalCommandBuilder<SummonOptionalArgument.Label>
|
||||
{
|
||||
private final EntitySummonArgument entity = Arguments.entitySummon();
|
||||
|
||||
private final CommandNodeLiteral root = CommandNode.literal("on")
|
||||
.then(CommandNode.argument("entity", this.entity)
|
||||
.label(Label.SUMMON));
|
||||
|
||||
public SummonOptionalArgument(Label label)
|
||||
{
|
||||
super(label);
|
||||
}
|
||||
|
||||
public EntitySummonArgument entity()
|
||||
{
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CommandNodeLiteral root()
|
||||
{
|
||||
return this.root;
|
||||
}
|
||||
|
||||
public static enum Label
|
||||
{
|
||||
SUMMON;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,16 +3,26 @@ package exopandora.worldhandler.builder.impl;
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandNode;
|
||||
import exopandora.worldhandler.builder.CommandNodeLiteral;
|
||||
import exopandora.worldhandler.builder.argument.Arguments;
|
||||
import exopandora.worldhandler.builder.argument.TimeArgument;
|
||||
|
||||
public class WeatherCommandBuilder extends CommandBuilder
|
||||
{
|
||||
private final TimeArgument duration = Arguments.time();
|
||||
|
||||
private final CommandNodeLiteral root = CommandNode.literal("weather")
|
||||
.then(CommandNode.literal("clear")
|
||||
.label(Label.CLEAR))
|
||||
.label(Label.CLEAR)
|
||||
.then(CommandNode.argument("duration", this.duration)
|
||||
.label(Label.CLEAR_DURATION)))
|
||||
.then(CommandNode.literal("rain")
|
||||
.label(Label.RAIN))
|
||||
.label(Label.RAIN)
|
||||
.then(CommandNode.argument("duration", this.duration)
|
||||
.label(Label.RAIN_DURATION)))
|
||||
.then(CommandNode.literal("thunder")
|
||||
.label(Label.THUNDER));
|
||||
.label(Label.THUNDER)
|
||||
.then(CommandNode.argument("duration", this.duration)
|
||||
.label(Label.THUNDER_DURATION)));
|
||||
|
||||
@Override
|
||||
protected CommandNodeLiteral root()
|
||||
@@ -23,7 +33,10 @@ public class WeatherCommandBuilder extends CommandBuilder
|
||||
public static enum Label
|
||||
{
|
||||
CLEAR,
|
||||
CLEAR_DURATION,
|
||||
RAIN,
|
||||
THUNDER;
|
||||
RAIN_DURATION,
|
||||
THUNDER,
|
||||
THUNDER_DURATION;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import exopandora.worldhandler.util.ResourceHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Renderable;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -152,7 +153,6 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
if(Config.getSkin().drawBackground())
|
||||
{
|
||||
this.setBlitOffset(-1);
|
||||
super.renderBackground(stack);
|
||||
}
|
||||
|
||||
@@ -160,7 +160,7 @@ public class GuiWorldHandler extends Container
|
||||
RenderUtils.colorDefaultBackground();
|
||||
|
||||
this.bindBackground();
|
||||
this.blit(stack, backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
|
||||
GuiComponent.blit(stack, backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
|
||||
|
||||
final String label = Main.MC_VERSION + "-" + Main.MOD_VERSION;
|
||||
final int versionWidth = this.width - this.font.width(label) - 2;
|
||||
@@ -181,9 +181,9 @@ public class GuiWorldHandler extends Container
|
||||
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.width(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
|
||||
this.font.draw(stack, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
|
||||
for(int i = 0; i < this.renderables.size(); i++)
|
||||
for(Renderable renderable : this.renderables)
|
||||
{
|
||||
this.renderables.get(i).render(stack, mouseX, mouseY, partialTicks);
|
||||
renderable.render(stack, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
this.content.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
||||
@@ -319,14 +319,7 @@ public class GuiWorldHandler extends Container
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
|
||||
{
|
||||
boolean focused = this.getFocused() != null;
|
||||
|
||||
if(focused && this.getFocused() instanceof AbstractWidget)
|
||||
{
|
||||
focused = ((AbstractWidget) this.getFocused()).isFocused();
|
||||
}
|
||||
|
||||
if(!focused && KeyHandler.KEY_WORLD_HANDLER.matches(keyCode, scanCode) && KeyHandler.KEY_WORLD_HANDLER.getKeyModifier().isActive(null))
|
||||
if(!(this.getFocused() instanceof AbstractWidget) && KeyHandler.KEY_WORLD_HANDLER.matches(keyCode, scanCode) && KeyHandler.KEY_WORLD_HANDLER.getKeyModifier().isActive(null))
|
||||
{
|
||||
Minecraft.getInstance().setScreen(null);
|
||||
return true;
|
||||
@@ -386,25 +379,6 @@ public class GuiWorldHandler extends Container
|
||||
return super.charTyped(charTyped, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changeFocus(boolean focus)
|
||||
{
|
||||
for(IContainerWidget widget : WIDGETS)
|
||||
{
|
||||
if(widget.isEnabled() && widget.changeFocus(focus))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if(this.content.changeFocus(focus))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.changeFocus(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY)
|
||||
{
|
||||
|
||||
@@ -143,4 +143,16 @@ public abstract class Content implements IContent
|
||||
{
|
||||
this.persistence.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.argument.TargetArgument.SelectorTypes;
|
||||
import exopandora.worldhandler.builder.impl.KillCommandBuilder;
|
||||
@@ -147,12 +146,6 @@ public class ContentButcher extends Content
|
||||
this.radiusField.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.radiusField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory()
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.argument.Coordinate;
|
||||
import exopandora.worldhandler.builder.argument.TargetArgument.SelectorTypes;
|
||||
@@ -209,15 +208,6 @@ public class ContentCommandStack extends ContentChild
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.iterate(index ->
|
||||
{
|
||||
this.textfields.get(index).renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
});
|
||||
}
|
||||
|
||||
private void iterate(Consumer<Integer> consumer)
|
||||
{
|
||||
for(int x = 0; x < this.textfields.size() && x + this.scroll < this.getCommandCount(); x++)
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
@@ -41,7 +39,7 @@ public class ContentContinue extends ContentChild
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.commandField = new GuiTextFieldTooltip(x + 116 / 2, y + 12, 116, 20);
|
||||
this.commandField.setFocus(false);
|
||||
this.commandField.setFocused(false);
|
||||
this.commandField.setValue(this.builder.toCommand(this.label, false));
|
||||
this.commandField.moveCursorToStart();
|
||||
this.commandField.setFilter(text -> text.equals(this.commandField.getValue()));
|
||||
@@ -61,10 +59,4 @@ public class ContentContinue extends ContentChild
|
||||
}));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, Component.translatable("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.commandField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.argument.tag.AbstractAttributeTag;
|
||||
import exopandora.worldhandler.builder.argument.tag.AttributeModifiersTag;
|
||||
@@ -316,17 +315,6 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page) && this.startPage == 0)
|
||||
{
|
||||
this.itemField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.itemLore1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.itemLore2Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.CloneCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.CloneCommandBuilder.Label;
|
||||
@@ -338,37 +337,6 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.COORDINATES.equals(this.page))
|
||||
{
|
||||
this.x1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.y1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.z1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
|
||||
this.x2Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.y2Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.z2Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.FILL.equals(this.page))
|
||||
{
|
||||
this.block1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.REPLACE.equals(this.page))
|
||||
{
|
||||
this.block1Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.block2Field.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.CLONE.equals(this.page))
|
||||
{
|
||||
if(Mask.FILTERED.equals(this.mask))
|
||||
{
|
||||
this.filterField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Predicate<String> coordinatePredicate(String coordinate)
|
||||
{
|
||||
return string -> string.matches(coordinate + ": [-]?[0-9]*");
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
|
||||
@@ -160,15 +159,6 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!this.booleanValue)
|
||||
{
|
||||
this.valueField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory()
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.OptionsScreen;
|
||||
import net.minecraft.client.gui.screens.packs.PackSelectionScreen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
@@ -53,13 +52,13 @@ public class ContentMain extends Content
|
||||
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 ->
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
minecraft.options.save();
|
||||
minecraft.setScreen(new PackSelectionScreen(Minecraft.getInstance().getResourcePackRepository(), resourcePackList ->
|
||||
{
|
||||
OptionsScreen optionsScreen = new OptionsScreen(container, Minecraft.getInstance().options);
|
||||
optionsScreen.init(Minecraft.getInstance(), 0, 0);
|
||||
optionsScreen.updatePackList(resourcePackList);
|
||||
}, Minecraft.getInstance().getResourcePackDirectory(), Component.translatable("resourcePack.title")));
|
||||
minecraft.options.updateResourcePacks(resourcePackList);
|
||||
ActionHelper.tryRun(() -> ActionHelper.open(Contents.MAIN));
|
||||
}, minecraft.getResourcePackDirectory(), Component.translatable("resourcePack.title")));
|
||||
}));
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 158, y + 96, 74, 20, Component.translatable("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.BanCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.DeOpCommandBuilder;
|
||||
@@ -94,7 +93,7 @@ public class ContentMultiplayer extends Content
|
||||
{
|
||||
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.username"));
|
||||
this.playerField.setFilter(Predicates.notNull());
|
||||
this.playerField.setFocus(false);
|
||||
this.playerField.setFocused(false);
|
||||
this.playerField.setValue(this.builderKick.targets().getTarget());
|
||||
this.playerField.setMaxLength(16);
|
||||
this.playerField.setResponder(text ->
|
||||
@@ -105,7 +104,7 @@ public class ContentMultiplayer extends Content
|
||||
|
||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, Component.translatable("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||
this.reasonField.setFilter(Predicates.notNull());
|
||||
this.reasonField.setFocus(false);
|
||||
this.reasonField.setFocused(false);
|
||||
this.reasonField.setValue(this.builderKick.reason().get());
|
||||
this.reasonField.setResponder(text ->
|
||||
{
|
||||
@@ -280,20 +279,6 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.KICK_AND_BAN.equals(this.page))
|
||||
{
|
||||
this.reasonField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
if(!Page.RUNTIME.equals(this.page))
|
||||
{
|
||||
this.playerField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
private void setPlayer(String player)
|
||||
{
|
||||
this.builderBan.targets().setTarget(player);
|
||||
|
||||
@@ -20,6 +20,7 @@ import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
@@ -122,14 +123,14 @@ public class ContentNoteEditor extends Content
|
||||
RenderSystem.setShaderTexture(0, NOTE);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
container.blit(matrix, x - 1, y - 1, 0, 0, 8, 59);
|
||||
container.blit(matrix, x - 1, y - 1 + 59, 0, 59, 13, 35);
|
||||
GuiComponent.blit(matrix, x - 1, y - 1, 0, 0, 8, 59);
|
||||
GuiComponent.blit(matrix, x - 1, y - 1 + 59, 0, 59, 13, 35);
|
||||
|
||||
container.blit(matrix, x - 1 + 232 - 5, y - 1, 18, 0, 7, 59);
|
||||
container.blit(matrix, x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35);
|
||||
GuiComponent.blit(matrix, x - 1 + 232 - 5, y - 1, 18, 0, 7, 59);
|
||||
GuiComponent.blit(matrix, x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35);
|
||||
|
||||
container.blit(matrix, x - 1 + 8, y - 1, 0, 94, 219, 1);
|
||||
container.blit(matrix, x - 1 + 13, y - 1 + 93, 0, 94, 209, 1);
|
||||
GuiComponent.blit(matrix, x - 1 + 8, y - 1, 0, 94, 219, 1);
|
||||
GuiComponent.blit(matrix, x - 1 + 13, y - 1 + 93, 0, 94, 209, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -140,7 +141,7 @@ public class ContentNoteEditor extends Content
|
||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
posestack.scale(scale, scale, scale);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(new ItemStack(Items.NOTE_BLOCK), 0, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(matrix, new ItemStack(Items.NOTE_BLOCK), 0, 0);
|
||||
|
||||
posestack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
@@ -110,11 +110,19 @@ public class ContentPlayer extends Content
|
||||
else if(Page.SCORE.equals(this.page))
|
||||
{
|
||||
button2.active = false;
|
||||
|
||||
container.addRenderableWidget(this.scoreField);
|
||||
container.addRenderableWidget(this.xpField);
|
||||
container.addRenderableWidget(this.coinsField);
|
||||
}
|
||||
else if(Page.POSITION.equals(this.page))
|
||||
{
|
||||
button3.active = false;
|
||||
|
||||
container.addRenderableWidget(this.posXField);
|
||||
container.addRenderableWidget(this.posYField);
|
||||
container.addRenderableWidget(this.posZField);
|
||||
|
||||
container.addRenderableWidget(new GuiButtonBase(x + 118, y + 72, 114, 20, Component.translatable("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
{
|
||||
Player player = Minecraft.getInstance().player;
|
||||
@@ -180,21 +188,9 @@ public class ContentPlayer extends Content
|
||||
Minecraft.getInstance().font.draw(matrix, Minecraft.getInstance().player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
||||
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
InventoryScreen.renderEntityInInventory(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
|
||||
InventoryScreen.renderEntityInInventoryFollowsMouse(matrix, xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
else if(Page.SCORE.equals(this.page))
|
||||
{
|
||||
this.scoreField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.xpField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.coinsField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.POSITION.equals(this.page))
|
||||
{
|
||||
this.posXField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.posYField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.posZField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -262,7 +262,6 @@ public class ContentPotions extends ContentChild
|
||||
{
|
||||
for(MobEffect effect : this.effects.getMobEffects())
|
||||
{
|
||||
System.out.println(effect);
|
||||
EffectInstance source = this.effects.getOrCreate(effect);
|
||||
EffectInstance target = effects.getOrCreate(effect);
|
||||
source.copyTo(target, modifier);
|
||||
|
||||
@@ -17,6 +17,7 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
@@ -46,9 +47,11 @@ public class ContentRecipes extends Content
|
||||
@Override
|
||||
public MutableComponent translate(Recipe<?> recipe)
|
||||
{
|
||||
if(!ItemStack.EMPTY.equals(recipe.getResultItem()))
|
||||
RegistryAccess registryAccess = Minecraft.getInstance().level.registryAccess();
|
||||
|
||||
if(!ItemStack.EMPTY.equals(recipe.getResultItem(registryAccess)))
|
||||
{
|
||||
return (MutableComponent) recipe.getResultItem().getHoverName();
|
||||
return (MutableComponent) recipe.getResultItem(registryAccess).getHoverName();
|
||||
}
|
||||
|
||||
return Component.literal(recipe.getId().toString());
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.ScoreboardCommandBuilder;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
@@ -256,15 +255,6 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
this.objectField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.ScoreboardCommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.TagCommandBuilder;
|
||||
@@ -239,19 +238,6 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.TAG.equals(this.page))
|
||||
{
|
||||
this.tagField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.objectField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
|
||||
@@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.TeamCommandBuilder;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
@@ -218,12 +217,6 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
this.teamField.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.teamField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
|
||||
@@ -5,8 +5,6 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentSettings.Setting.BooleanSetting;
|
||||
@@ -170,15 +168,6 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.setting instanceof IntegerSetting)
|
||||
{
|
||||
this.valueField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ public class ContentSignEditor extends Content
|
||||
{
|
||||
if(!this.editColor)
|
||||
{
|
||||
this.commandField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.commandField.render(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -197,7 +197,7 @@ public class ContentSignEditor extends Content
|
||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
posestack.scale(scale, scale, scale);
|
||||
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(posestack, new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
|
||||
posestack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
@@ -42,6 +42,7 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
@@ -514,15 +515,7 @@ public class ContentSummon extends Content
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
if(!this.editColor)
|
||||
{
|
||||
this.mobField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.nbtField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
else if(Page.POTIONS.equals(this.page))
|
||||
if(Page.POTIONS.equals(this.page))
|
||||
{
|
||||
Minecraft.getInstance().font.draw(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.MOB_EFFECTS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
}
|
||||
@@ -530,13 +523,12 @@ public class ContentSummon extends Content
|
||||
{
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderTexture(0, BEACON_LOCATION);
|
||||
container.setBlitOffset(0);
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if(Items.AIR.equals(this.entity.getArmorItem(3 - i)))
|
||||
{
|
||||
container.blit(matrix, x + 118 + 24 + 2, y + 2 + 24 * i, 112, 221, 16, 16);
|
||||
GuiComponent.blit(matrix, x + 118 + 24 + 2, y + 2 + 24 * i, 112, 221, 16, 16);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,7 +536,7 @@ public class ContentSummon extends Content
|
||||
{
|
||||
if(Items.AIR.equals(this.entity.getHandItem(i)))
|
||||
{
|
||||
container.blit(matrix, x + 118 + 70 + 2 + 24 * i, y + 2 + 36, 112, 221, 16, 16);
|
||||
GuiComponent.blit(matrix, x + 118 + 70 + 2 + 24 * i, y + 2 + 36, 112, 221, 16, 16);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -553,8 +545,8 @@ public class ContentSummon extends Content
|
||||
private List<ResourceLocation> sortedEffects()
|
||||
{
|
||||
return ForgeRegistries.MOB_EFFECTS.getKeys().stream()
|
||||
.sorted((a, b) -> I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(b).getDescriptionId())))
|
||||
.collect(Collectors.toList());
|
||||
.sorted((a, b) -> I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(a).getDescriptionId()).compareTo(I18n.get(ForgeRegistries.MOB_EFFECTS.getValue(b).getDescriptionId())))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private void toggleEditColor(Container container)
|
||||
|
||||
@@ -139,14 +139,6 @@ public class ContentUsercontent extends Content
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
for(VisibleObject<EditBox> textfield : this.textfields.values())
|
||||
{
|
||||
if(textfield.get().visible)
|
||||
{
|
||||
textfield.get().renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
if(this.content.getGui() != null && this.content.getGui().getLabels() != null)
|
||||
{
|
||||
for(JsonLabel label : this.content.getGui().getLabels())
|
||||
|
||||
@@ -2,8 +2,6 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
@@ -93,6 +91,9 @@ public class ContentWorldInfo extends Content
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
start.active = false;
|
||||
container.addRenderableWidget(this.posXField);
|
||||
container.addRenderableWidget(this.posYField);
|
||||
container.addRenderableWidget(this.posZField);
|
||||
}
|
||||
else if(Page.WORLD.equals(this.page))
|
||||
{
|
||||
@@ -106,10 +107,16 @@ public class ContentWorldInfo extends Content
|
||||
}));
|
||||
|
||||
seed.active = server != null;
|
||||
|
||||
container.addRenderableWidget(this.worldField);
|
||||
container.addRenderableWidget(this.seedField);
|
||||
}
|
||||
else if(Page.STATS.equals(this.page))
|
||||
{
|
||||
stats.active = false;
|
||||
|
||||
container.addRenderableWidget(this.totalTimeField);
|
||||
container.addRenderableWidget(this.currentTimeField);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,27 +128,6 @@ public class ContentWorldInfo extends Content
|
||||
this.seedField.tick();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
this.posXField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.posYField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.posZField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.WORLD.equals(this.page))
|
||||
{
|
||||
this.worldField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.seedField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.STATS.equals(this.page))
|
||||
{
|
||||
this.totalTimeField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
this.currentTimeField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCurrentTime()
|
||||
{
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package exopandora.worldhandler.gui.widget;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.WorldHandlerCommandBuilder;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
@@ -38,15 +37,6 @@ public class WidgetCommandSyntax implements IContainerWidget
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.syntaxField != null)
|
||||
{
|
||||
this.syntaxField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateSyntax(Container container)
|
||||
{
|
||||
if(this.syntaxField != null && !this.syntaxField.isFocused())
|
||||
@@ -78,4 +68,16 @@ public class WidgetCommandSyntax implements IContainerWidget
|
||||
{
|
||||
return EnumLayer.FOREGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
this.syntaxField.setFocused(focused);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return this.syntaxField.isFocused();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,4 +98,16 @@ public class WidgetNameField implements IContainerWidget
|
||||
|
||||
container.getContent().onPlayerNameChanged(container.getPlayer());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
this.nameField.setFocused(focused);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return this.nameField.isFocused();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,4 +126,16 @@ public class WidgetShortcuts implements IContainerWidget
|
||||
return this.actionHandler;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,13 +7,14 @@ import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTab;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
@@ -42,7 +43,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
int width = WidgetTabRenderer.width(container, index, size);
|
||||
int offset = WidgetTabRenderer.offset(container, index, size);
|
||||
|
||||
container.addWidget(new GuiButtonTab(xPos + offset, yPos, width, 21, tab.getTabTitle(), () -> ActionHelper.open(tab)));
|
||||
container.addWidget(new GuiButtonBase(xPos + offset, yPos, width, 21, tab.getTabTitle(), () -> ActionHelper.open(tab)));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,15 +59,13 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
|
||||
int size = category.getSize();
|
||||
|
||||
container.setBlitOffset(0);
|
||||
|
||||
for(int index = 0; index < size; index++)
|
||||
{
|
||||
int width = WidgetTabRenderer.width(container, index, size);
|
||||
int offset = WidgetTabRenderer.offset(container, index, size);
|
||||
|
||||
Content tab = category.getContent(index);
|
||||
Component title = TextUtils.stripText(tab.getTabTitle().withStyle(ChatFormatting.UNDERLINE), width, Minecraft.getInstance().font);
|
||||
Component title = tab.getTabTitle().withStyle(ChatFormatting.UNDERLINE);
|
||||
|
||||
if(content.getActiveContent().equals(tab))
|
||||
{
|
||||
@@ -121,7 +120,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
this.drawTabTitle(matrix, container, title, x + width / 2, y + 9, 0xFFFFFF);
|
||||
this.drawTabTitle(matrix, container, title, true, x, y, width, y + height, 0xFFFFFF);
|
||||
}
|
||||
|
||||
private void drawInactiveTab(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height, Component title)
|
||||
@@ -136,7 +135,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
this.drawTabTitle(matrix, container, title, x + width / 2, y + 7, 0xE0E0E0);
|
||||
this.drawTabTitle(matrix, container, title, false, x, y + 2, width, y + height, 0xE0E0E0);
|
||||
}
|
||||
|
||||
private void drawTabBackgroundMerge(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height)
|
||||
@@ -155,23 +154,23 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
private void drawTabBackground(PoseStack matrix, Container container, int x, int y, int width, int height)
|
||||
{
|
||||
container.bindBackground();
|
||||
container.setBlitOffset(-1);
|
||||
|
||||
int left = Mth.ceil(width / 2D);
|
||||
int right = Mth.floor(width / 2D);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
container.blit(matrix, x, y, 0, 0, left, height);
|
||||
container.blit(matrix, x + left, y, container.getBackgroundWidth() - right, 0, right, height);
|
||||
GuiComponent.blit(matrix, x, y, 0, 0, left, height);
|
||||
GuiComponent.blit(matrix, x + left, y, container.getBackgroundWidth() - right, 0, right, height);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private void drawTabTitle(PoseStack matrix, GuiComponent gui, Component title, int x, int y, int color)
|
||||
private void drawTabTitle(PoseStack matrix, GuiComponent gui, Component title, boolean isActive, int x, int y, int width, int height, int color)
|
||||
{
|
||||
gui.setBlitOffset(0);
|
||||
GuiComponent.drawCenteredString(matrix, Minecraft.getInstance().font, title, x, y, color);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Font font = Minecraft.getInstance().font;
|
||||
AbstractWidget.renderScrollingString(matrix, font, title, x + 5, y, x + width - 5, height, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -196,4 +195,16 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
{
|
||||
return (int) Math.round(index * (double) (container.getBackgroundWidth() + SPACING) / size);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import net.minecraft.network.chat.Component;
|
||||
|
||||
public class WidgetWatch implements IContainerWidget
|
||||
{
|
||||
private boolean focused = false;
|
||||
|
||||
@Override
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
@@ -43,4 +45,16 @@ public class WidgetWatch implements IContainerWidget
|
||||
{
|
||||
return EnumLayer.BACKGROUND;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocused(boolean focused)
|
||||
{
|
||||
this.focused = focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFocused()
|
||||
{
|
||||
return this.focused;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,11 +10,15 @@ import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.components.Button;
|
||||
import net.minecraft.client.gui.components.AbstractButton;
|
||||
import net.minecraft.client.gui.narration.NarrationElementOutput;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public class GuiButtonBase extends Button
|
||||
public class GuiButtonBase extends AbstractButton
|
||||
{
|
||||
private final ActionHandler actionHandler;
|
||||
|
||||
public GuiButtonBase(int x, int y, int width, int height, String translationKey, ActionHandler actionHandler)
|
||||
{
|
||||
this(x, y, width, height, Component.translatable(translationKey), actionHandler);
|
||||
@@ -22,23 +26,23 @@ public class GuiButtonBase extends Button
|
||||
|
||||
public GuiButtonBase(int x, int y, int width, int height, Component buttonText, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, width, height, buttonText, button -> ActionHelper.tryRun(actionHandler), Button.DEFAULT_NARRATION);
|
||||
super(x, y, width, height, buttonText);
|
||||
this.actionHandler = actionHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
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());
|
||||
this.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
||||
this.renderString(poseStack, Minecraft.getInstance().font, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(PoseStack poseStack, Minecraft minecraft, int mouseX, int mouseY)
|
||||
protected void renderBackground(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
RenderUtils.colorDefaultButton();
|
||||
|
||||
int hovered = this.getYImage(this.isHoveredOrFocused());
|
||||
int textureY = this.getTextureY();
|
||||
RenderSystem.setShaderTexture(0, ResourceHelper.buttonTexture());
|
||||
|
||||
int hWidth = this.width / 2;
|
||||
@@ -46,24 +50,52 @@ public class GuiButtonBase extends Button
|
||||
|
||||
if(Config.getSkin().getTextureType().equals("resourcepack"))
|
||||
{
|
||||
int textureOffset = 46 + hovered * 20;
|
||||
int textureOffset = 46 + textureY * 20;
|
||||
|
||||
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);
|
||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, hWidth, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
}
|
||||
else
|
||||
{
|
||||
int textureOffset = hovered * 20;
|
||||
int textureOffset = textureY * 20;
|
||||
|
||||
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);
|
||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 0, textureOffset, hWidth, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX(), this.getY() + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY(), 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
||||
GuiComponent.blit(poseStack, this.getX() + hWidth, this.getY() + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
protected int getTextureY()
|
||||
{
|
||||
int i = 1;
|
||||
|
||||
if(!this.active)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
else if(this.isHoveredOrFocused())
|
||||
{
|
||||
i = 2;
|
||||
}
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPress()
|
||||
{
|
||||
ActionHelper.tryRun(this.actionHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateWidgetNarration(NarrationElementOutput narrationElementOutput)
|
||||
{
|
||||
this.defaultButtonNarrationText(narrationElementOutput);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class GuiButtonIcon extends GuiButtonTooltip
|
||||
@@ -19,9 +19,9 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderBg(poseStack, Minecraft.getInstance(), mouseX, mouseY);
|
||||
super.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
if(this.icon != null)
|
||||
{
|
||||
@@ -42,6 +42,6 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
||||
RenderSystem.setShaderColor(0.8F, 0.8F, 0.8F, 1.0F);
|
||||
}
|
||||
|
||||
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);
|
||||
GuiComponent.blit(poseStack, this.getX() + this.width / 2 - 4, this.getY() + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,9 +23,9 @@ public class GuiButtonItem extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderWidget(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderBg(matrix, Minecraft.getInstance(), mouseX, mouseY);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(this.stack, this.getX() + this.width / 2 - 8, this.getY() + 2);
|
||||
super.renderBackground(matrix, mouseX, mouseY, partialTicks);
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(matrix, this.stack, this.getX() + this.width / 2 - 8, this.getY() + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.util.Mth;
|
||||
|
||||
public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
{
|
||||
@@ -36,9 +36,9 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.renderBg(poseStack, Minecraft.getInstance(), mouseX, mouseY);
|
||||
this.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
||||
this.updateMessage();
|
||||
|
||||
Font font = Minecraft.getInstance().font;
|
||||
@@ -48,13 +48,13 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
Component leftArrow = this.isHoveringLeft(mouseX, mouseY) ? TextUtils.ARROW_LEFT_BOLD : TextUtils.ARROW_LEFT;
|
||||
Component rightArrow = this.isHoveringRight(mouseX, mouseY) ? TextUtils.ARROW_RIGHT_BOLD : TextUtils.ARROW_RIGHT;
|
||||
|
||||
int maxWidth = Math.max(0, this.width - font.width("< >"));
|
||||
int combinedArrowWidth = font.width("< >");
|
||||
int maxWidth = Math.max(0, this.width - combinedArrowWidth);
|
||||
int spaceWidth = font.width(" ");
|
||||
|
||||
Component display = TextUtils.stripText((MutableComponent) this.getMessage(), maxWidth, font);
|
||||
int yPos = this.getY() + (this.height - 8) / 2;
|
||||
|
||||
GuiComponent.drawCenteredString(poseStack, font, display, this.getX() + this.width / 2, yPos, this.getFGColor());
|
||||
this.renderScrollingString(poseStack, font, combinedArrowWidth / 2 + 2, this.getFGColor() | Mth.ceil(this.alpha * 255.0F) << 24);
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.resources.sounds.SimpleSoundInstance;
|
||||
import net.minecraft.client.sounds.SoundManager;
|
||||
import net.minecraft.network.chat.Component;
|
||||
@@ -30,7 +31,7 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void renderWidget(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
switch(this.type)
|
||||
{
|
||||
@@ -50,7 +51,7 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
break;
|
||||
}
|
||||
|
||||
int hovered = this.getYImage(this.isHoveredOrFocused());
|
||||
int hovered = this.getTextureY();
|
||||
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlpha());
|
||||
RenderSystem.setShaderTexture(0, NOTE);
|
||||
@@ -75,13 +76,13 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
int textColor = this.getFGColor();
|
||||
Font font = Minecraft.getInstance().font;
|
||||
|
||||
this.blit(poseStack, this.getX(), this.getY(), 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||
GuiComponent.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 poseStack, int hoverstate)
|
||||
{
|
||||
this.blit(poseStack, this.getX(), this.getY(), 55 - hoverstate * 9 + 18, 0, 9, 58);
|
||||
GuiComponent.blit(poseStack, this.getX(), this.getY(), 55 - hoverstate * 9 + 18, 0, 9, 58);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
package exopandora.worldhandler.gui.widget.button;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.client.sounds.SoundManager;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public class GuiButtonTab extends GuiButtonBase
|
||||
{
|
||||
public GuiButtonTab(int x, int y, int width, int height, Component narration, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, width, height, narration, actionHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playDownSound(SoundManager soundManager)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,7 @@ public class GuiButtonTooltip extends GuiButtonBase
|
||||
|
||||
public void renderTooltip(Screen screen, PoseStack poseStack, int mouseX, int mouseY)
|
||||
{
|
||||
if(this.isHoveredOrFocused() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
||||
if(this.isHovered() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
||||
{
|
||||
screen.renderTooltip(poseStack, this.tooltip, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
|
||||
@@ -33,22 +34,32 @@ public class GuiSlider extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(PoseStack poseStack, Minecraft minecraft, int mouseX, int mouseY)
|
||||
public void renderBackground(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderBg(poseStack, minecraft, mouseX, mouseY);
|
||||
super.renderBackground(poseStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
int hovered = super.getYImage(this.isHoveredOrFocused());
|
||||
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 46 : 0) + hovered * 20;
|
||||
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 66 : 20);
|
||||
|
||||
if(this.isHoveredOrFocused())
|
||||
{
|
||||
textureOffset += 20;
|
||||
}
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderUtils.colorDefaultButton();
|
||||
|
||||
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);
|
||||
GuiComponent.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.getY(), 0, textureOffset, 4, 20);
|
||||
GuiComponent.blit(poseStack, this.getX() + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.getY(), 196, textureOffset, 4, 20);
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getTextureY()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY)
|
||||
{
|
||||
@@ -80,18 +91,12 @@ public class GuiSlider extends GuiButtonBase
|
||||
this.logic.onChangeSliderValue(this.persistence.getIntValue());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYImage(boolean mouseOver)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private void updateDisplayString()
|
||||
{
|
||||
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);
|
||||
MutableComponent text = TextUtils.stripText(this.logic.formatPrefix(value), this.width - fontRenderer.width(suffix) - 2, fontRenderer).append(suffix);
|
||||
this.setMessage(text);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ public class GuiTextFieldTooltip extends EditBox
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack poseStack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
super.renderButton(poseStack, mouseX, mouseY, partialTicks);
|
||||
super.render(poseStack, mouseX, mouseY, partialTicks);
|
||||
|
||||
if(this.isVisible() && !this.isFocused() && this.tooltip != null && ChatFormatting.stripFormatting(this.getValue()).isEmpty())
|
||||
{
|
||||
|
||||
@@ -153,9 +153,6 @@ public class MenuColorField extends Menu
|
||||
@Override
|
||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.logic.doDrawTextField())
|
||||
{
|
||||
this.textField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public class MenuPageList<T> extends Menu
|
||||
if(index < this.items.size())
|
||||
{
|
||||
T item = this.items.get(index);
|
||||
MutableComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().font);
|
||||
MutableComponent text = this.logic.translate(item);
|
||||
button = this.logic.onRegister(this.x, this.y + (this.height + 4) * x, this.width, this.height, text, item, () ->
|
||||
{
|
||||
this.persistence.setSelectedIndex(index);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class RenderUtils
|
||||
RenderUtils.colorDefaultButton();
|
||||
RenderSystem.setShaderTexture(0, ResourceHelper.iconTexture());
|
||||
|
||||
gui.blit(matrix, width + 0, height, 48, 0, 10, 10);
|
||||
GuiComponent.blit(matrix, width + 0, height, 48, 0, 10, 10);
|
||||
|
||||
matrix.pushPose();
|
||||
matrix.scale(0.5F, 0.5F, 0.5F);
|
||||
@@ -89,7 +89,7 @@ public class RenderUtils
|
||||
{
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
gui.blit(matrix, x, y + i, textureX, textureY + i, i + 1, 1);
|
||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY + i, i + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class RenderUtils
|
||||
{
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
gui.blit(matrix, x + size - i - 1, y + i, textureX + size - i - 1, textureY + i, i + 1, 1);
|
||||
GuiComponent.blit(matrix, x + size - i - 1, y + i, textureX + size - i - 1, textureY + i, i + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ public class RenderUtils
|
||||
{
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
gui.blit(matrix, x, y + i, textureX, textureY, size - i, 1);
|
||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY, size - i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class RenderUtils
|
||||
{
|
||||
for(int i = 0; i < size; i++)
|
||||
{
|
||||
gui.blit(matrix, x + i, y + i, textureX + i, textureY, size - i, 1);
|
||||
GuiComponent.blit(matrix, x + i, y + i, textureX + i, textureY, size - i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class RenderUtils
|
||||
int z = width - (int) (w * width);
|
||||
|
||||
RenderUtils.colorDefaultBackground(w);
|
||||
gui.blit(matrix, x + z, y + i, textureX + z, textureY + i, width - z, 1);
|
||||
GuiComponent.blit(matrix, x + z, y + i, textureX + z, textureY + i, width - z, 1);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
@@ -143,7 +143,7 @@ public class RenderUtils
|
||||
int z = (int) (w * width);
|
||||
|
||||
RenderUtils.colorDefaultBackground(w);
|
||||
gui.blit(matrix, x, y + i, textureX, textureY + i, z, 1);
|
||||
GuiComponent.blit(matrix, x, y + i, textureX, textureY + i, z, 1);
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
|
||||
@@ -7,3 +7,4 @@ public net.minecraft.advancements.critereon.MinMaxBounds$Doubles <init>(Ljava/la
|
||||
public net.minecraft.network.chat.MutableComponent <init>(Lnet/minecraft/network/chat/ComponentContents;Ljava/util/List;Lnet/minecraft/network/chat/Style;)V # constructor
|
||||
public net.minecraft.commands.arguments.item.ItemParser f_120991_ # ERROR_NO_TAGS_ALLOWED
|
||||
public net.minecraft.world.level.storage.PrimaryLevelData f_78443_ # settings
|
||||
public net.minecraft.client.gui.components.AbstractWidget m_274366_(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/gui/Font;Lnet/minecraft/network/chat/Component;IIIII)V # renderScrollingString
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
modLoader="javafml"
|
||||
loaderVersion="[44,)"
|
||||
loaderVersion="[45,)"
|
||||
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.3-${version}"
|
||||
version="1.19.4-${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.3,)"
|
||||
versionRange="[1.19.4,)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "World Handler",
|
||||
"pack_format": 12
|
||||
"pack_format": 13
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user