Update to 1.17.1
This commit is contained in:
30
build.gradle
30
build.gradle
@@ -15,11 +15,12 @@ buildscript {
|
||||
apply plugin: 'net.minecraftforge.gradle'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
version = '1.16.5-2.12.6'
|
||||
version = '1.17.1-2.12.6'
|
||||
group = 'exopandora.worldhandler' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||
archivesBaseName = 'WorldHandler'
|
||||
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8.
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(16)
|
||||
println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
|
||||
|
||||
minecraft {
|
||||
// The mappings can be changed at any time, and must be in the following format.
|
||||
@@ -33,7 +34,7 @@ minecraft {
|
||||
//
|
||||
// Use non-default mappings at your own risk. they may not always work.
|
||||
// Simply re-run your setup task after changing the mappings to update your workspace.
|
||||
mappings channel: 'official', version: '1.16.5'
|
||||
mappings channel: 'official', version: '1.17.1'
|
||||
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
|
||||
|
||||
accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')
|
||||
@@ -91,11 +92,21 @@ minecraft {
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
// Put repositories for dependencies here
|
||||
// ForgeGradle automatically adds the Forge maven and Maven Central for you
|
||||
|
||||
// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
|
||||
// flatDir {
|
||||
// dir 'libs'
|
||||
// }
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
|
||||
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
|
||||
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
|
||||
minecraft 'net.minecraftforge:forge:1.16.5-36.2.1'
|
||||
minecraft 'net.minecraftforge:forge:1.17.1-37.0.8'
|
||||
|
||||
// You may put jars on which you depend on in ./libs or you may define them like so..
|
||||
// compile "some.group:artifact:version:classifier"
|
||||
@@ -116,17 +127,6 @@ dependencies {
|
||||
// http://www.gradle.org/docs/current/userguide/dependency_management.html
|
||||
}
|
||||
|
||||
eclipse {
|
||||
classpath {
|
||||
file {
|
||||
whenMerged {
|
||||
def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
|
||||
jre.accessRules.add(new AccessRule('accessible', 'jdk/nashorn/**'))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes([
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-7.2-20210702220150+0000-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
2
gradlew
vendored
2
gradlew
vendored
@@ -72,7 +72,7 @@ case "`uname`" in
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
MSYS* | MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
|
||||
@@ -11,7 +11,7 @@ public class Main
|
||||
{
|
||||
public static final String NAME = "World Handler";
|
||||
public static final String MODID = "worldhandler";
|
||||
public static final String MC_VERSION = "1.16.5";
|
||||
public static final String MC_VERSION = "1.17.1";
|
||||
public static final String MOD_VERSION = "2.12.6";
|
||||
public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui";
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ package exopandora.worldhandler;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
@@ -14,24 +13,23 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.util.AdvancementHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.event.RegisterClientReloadListenersEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.event.RegisterCommandsEvent;
|
||||
import net.minecraftforge.eventbus.api.IEventBus;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.DistExecutor.SafeRunnable;
|
||||
import net.minecraftforge.fml.ExtensionPoint;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.config.ModConfig.Type;
|
||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.fml.network.FMLNetworkConstants;
|
||||
import net.minecraftforge.fmlclient.registry.ClientRegistry;
|
||||
import net.minecraftforge.fmllegacy.network.FMLNetworkConstants;
|
||||
|
||||
@Mod(Main.MODID)
|
||||
public class WorldHandler
|
||||
@@ -51,25 +49,19 @@ public class WorldHandler
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager();
|
||||
manager.registerReloadListener(AdvancementHelper.getInstance());
|
||||
Config.setupDirectories(WorldHandler.USERCONTENT_PATH);
|
||||
modLoadingContext.registerConfig(Type.CLIENT, Config.CLIENT_SPEC, Main.MODID + "/" + Main.MODID + ".toml");
|
||||
UsercontentLoader.load(WorldHandler.USERCONTENT_PATH);
|
||||
modEventBus.register(Config.class);
|
||||
modEventBus.addListener(WorldHandler.this::clientSetup);
|
||||
modEventBus.addListener(WorldHandler.this::registerClientReloadListeners);
|
||||
modEventBus.addListener(Content::createRegistry);
|
||||
modEventBus.addListener(Category::createRegistry);
|
||||
modEventBus.addGenericListener(Content.class, Content::register);
|
||||
modEventBus.addGenericListener(Category.class, Category::register);
|
||||
}
|
||||
});
|
||||
modLoadingContext.registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (a, b) -> true));
|
||||
// ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () ->
|
||||
// {
|
||||
// GuiFactoryWorldHandler factory = new GuiFactoryWorldHandler();
|
||||
// return (minecraft, parentScreen) -> factory.createConfigGui(parentScreen);
|
||||
// });
|
||||
modLoadingContext.registerExtensionPoint(IExtensionPoint.DisplayTest.class, () -> new IExtensionPoint.DisplayTest(() -> FMLNetworkConstants.IGNORESERVERONLY, (remote, isServer) -> true));
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -88,4 +80,10 @@ public class WorldHandler
|
||||
{
|
||||
CommandHelper.registerCommands(event.getDispatcher());
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void registerClientReloadListeners(RegisterClientReloadListenersEvent event)
|
||||
{
|
||||
event.registerReloadListener(AdvancementHelper.getInstance());
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,8 @@ import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.GreedyString;
|
||||
import exopandora.worldhandler.builder.types.ItemResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -107,7 +107,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
this.set(index, resource, ArgumentType.BLOCK_RESOURCE_LOCATION);
|
||||
}
|
||||
|
||||
protected void setNode(int index, CompoundNBT nbt)
|
||||
protected void setNode(int index, CompoundTag nbt)
|
||||
{
|
||||
this.set(index, nbt, ArgumentType.NBT);
|
||||
}
|
||||
@@ -229,7 +229,7 @@ public abstract class CommandBuilder implements ICommandBuilderSyntax
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected CompoundNBT getNodeAsNBT(int index)
|
||||
protected CompoundTag getNodeAsNBT(int index)
|
||||
{
|
||||
return this.get(index, ArgumentType.NBT);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.util.NBTHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -49,9 +49,9 @@ public abstract class CommandBuilderNBT extends CommandBuilder implements IComma
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected CompoundNBT buildNBT()
|
||||
protected CompoundTag buildNBT()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
CompoundTag nbt = new CompoundTag();
|
||||
|
||||
for(IBuilderComponent component : this.TAG_TO_COMPONENT)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package exopandora.worldhandler.builder;
|
||||
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -28,7 +28,7 @@ public class CommandString
|
||||
}
|
||||
else
|
||||
{
|
||||
this.command.append(" " + TextFormatting.RED + "[error]" + TextFormatting.RESET);
|
||||
this.command.append(" " + ChatFormatting.RED + "[error]" + ChatFormatting.RESET);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package exopandora.worldhandler.builder;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ICommandBuilderNBT extends ICommandBuilder
|
||||
{
|
||||
void setNBT(CompoundNBT nbt);
|
||||
void setNBT(CompoundTag nbt);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.builder;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -10,5 +10,5 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public interface INBTWritable
|
||||
{
|
||||
@Nullable
|
||||
INBT serialize();
|
||||
Tag serialize();
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@@ -5,10 +5,10 @@ import java.util.UUID;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -17,15 +17,15 @@ public class ComponentAttributeItem extends ComponentAttribute
|
||||
{
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
ListNBT attributes = new ListNBT();
|
||||
ListTag attributes = new ListTag();
|
||||
|
||||
for(Entry<Attribute, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(entry.getValue() != 0)
|
||||
{
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
CompoundTag attribute = new CompoundTag();
|
||||
String id = entry.getKey().getRegistryName().toString();
|
||||
|
||||
attribute.putString("AttributeName", id);
|
||||
|
||||
@@ -4,10 +4,10 @@ import java.util.Map.Entry;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -16,15 +16,15 @@ public class ComponentAttributeMob extends ComponentAttribute
|
||||
{
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
ListNBT attributes = new ListNBT();
|
||||
ListTag attributes = new ListTag();
|
||||
|
||||
for(Entry<Attribute, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(entry.getValue() != 0)
|
||||
{
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
CompoundTag attribute = new CompoundTag();
|
||||
String id = entry.getKey().getRegistryName().toString();
|
||||
|
||||
attribute.putString("Name", id);
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentCustom implements IBuilderComponent
|
||||
{
|
||||
private INBT nbt;
|
||||
private Tag nbt;
|
||||
private String tag;
|
||||
|
||||
public void setNBT(INBT nbt)
|
||||
public void setNBT(Tag nbt)
|
||||
{
|
||||
this.nbt = nbt;
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class ComponentCustom implements IBuilderComponent
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
public void set(String tag, INBT nbt)
|
||||
public void set(String tag, Tag nbt)
|
||||
{
|
||||
this.setTag(tag);
|
||||
this.setNBT(nbt);
|
||||
@@ -33,7 +33,7 @@ public class ComponentCustom implements IBuilderComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
return this.nbt;
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentDisplay implements IBuilderComponent
|
||||
{
|
||||
private MutableStringTextComponent name = new MutableStringTextComponent();
|
||||
private ITextComponent[] lore = new ITextComponent[2];
|
||||
private MutableTextComponent name = new MutableTextComponent();
|
||||
private Component[] lore = new Component[2];
|
||||
|
||||
@Override
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
CompoundNBT display = new CompoundNBT();
|
||||
CompoundTag display = new CompoundTag();
|
||||
|
||||
if(this.name.getText() != null && !this.name.getText().isEmpty())
|
||||
{
|
||||
display.putString("Name", ITextComponent.Serializer.toJson(this.name));
|
||||
display.putString("Name", Component.Serializer.toJson(this.name));
|
||||
}
|
||||
|
||||
ListNBT lore = new ListNBT();
|
||||
ListTag lore = new ListTag();
|
||||
|
||||
for(int x = 0; x < this.lore.length; x++)
|
||||
{
|
||||
if(this.lore[x] != null && !this.lore[x].getString().isEmpty())
|
||||
{
|
||||
lore.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(this.lore[x])));
|
||||
lore.add(StringTag.valueOf(Component.Serializer.toJson(this.lore[x])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,42 +49,42 @@ public class ComponentDisplay implements IBuilderComponent
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setName(MutableStringTextComponent name)
|
||||
public void setName(MutableTextComponent name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public MutableStringTextComponent getName()
|
||||
public MutableTextComponent getName()
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setLore(ITextComponent[] lore)
|
||||
public void setLore(Component[] lore)
|
||||
{
|
||||
this.lore = lore;
|
||||
}
|
||||
|
||||
public ITextComponent[] getLore()
|
||||
public Component[] getLore()
|
||||
{
|
||||
return this.lore;
|
||||
}
|
||||
|
||||
public void setLore1(ITextComponent lore)
|
||||
public void setLore1(Component lore)
|
||||
{
|
||||
this.lore[0] = lore;
|
||||
}
|
||||
|
||||
public ITextComponent getLore1()
|
||||
public Component getLore1()
|
||||
{
|
||||
return this.lore[0];
|
||||
}
|
||||
|
||||
public void setLore2(ITextComponent lore)
|
||||
public void setLore2(Component lore)
|
||||
{
|
||||
this.lore[1] = lore;
|
||||
}
|
||||
|
||||
public ITextComponent getLore2()
|
||||
public Component getLore2()
|
||||
{
|
||||
return this.lore[1];
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -23,15 +23,15 @@ public class ComponentEnchantment implements IBuilderComponent
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
ListNBT enchantments = new ListNBT();
|
||||
ListTag enchantments = new ListTag();
|
||||
|
||||
for(Entry<Enchantment, Short> entry : this.enchantments.entrySet())
|
||||
{
|
||||
if(entry.getValue() > 0)
|
||||
{
|
||||
CompoundNBT enchantment = new CompoundNBT();
|
||||
CompoundTag enchantment = new CompoundTag();
|
||||
|
||||
enchantment.putString("id", ForgeRegistries.ENCHANTMENTS.getKey(entry.getKey()).toString());
|
||||
enchantment.putShort("lvl", entry.getValue());
|
||||
|
||||
@@ -8,32 +8,32 @@ import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class ComponentPotion implements IBuilderComponent
|
||||
{
|
||||
protected final Map<Effect, EffectNBT> potions = new HashMap<Effect, EffectNBT>();
|
||||
protected final Map<MobEffect, EffectNBT> potions = new HashMap<MobEffect, EffectNBT>();
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
ListNBT list = new ListNBT();
|
||||
ListTag list = new ListTag();
|
||||
|
||||
for(Entry<Effect, EffectNBT> entry : this.potions.entrySet())
|
||||
for(Entry<MobEffect, EffectNBT> entry : this.potions.entrySet())
|
||||
{
|
||||
EffectNBT effect = entry.getValue();
|
||||
|
||||
if(effect.getAmplifier() > 0)
|
||||
{
|
||||
CompoundNBT compound = effect.serialize();
|
||||
compound.putByte("Id", (byte) Effect.getId(entry.getKey()));
|
||||
CompoundTag compound = effect.serialize();
|
||||
compound.putByte("Id", (byte) MobEffect.getId(entry.getKey()));
|
||||
list.add(compound);
|
||||
}
|
||||
}
|
||||
@@ -46,72 +46,72 @@ public abstract class ComponentPotion implements IBuilderComponent
|
||||
return list;
|
||||
}
|
||||
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
public void setAmplifier(MobEffect potion, byte amplifier)
|
||||
{
|
||||
this.getMetadata(potion).setAmplifier(amplifier);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Effect potion)
|
||||
public byte getAmplifier(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmplifier();
|
||||
}
|
||||
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
public void setSeconds(MobEffect potion, int seconds)
|
||||
{
|
||||
this.getMetadata(potion).setSeconds(seconds);
|
||||
}
|
||||
|
||||
public int getSeconds(Effect potion)
|
||||
public int getSeconds(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getSeconds();
|
||||
}
|
||||
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
public void setMinutes(MobEffect potion, int minutes)
|
||||
{
|
||||
this.getMetadata(potion).setMinutes(minutes);
|
||||
}
|
||||
|
||||
public int getMinutes(Effect potion)
|
||||
public int getMinutes(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getMinutes();
|
||||
}
|
||||
|
||||
public void setHours(Effect potion, int hours)
|
||||
public void setHours(MobEffect potion, int hours)
|
||||
{
|
||||
this.getMetadata(potion).setHours(hours);
|
||||
}
|
||||
|
||||
public int getHours(Effect potion)
|
||||
public int getHours(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getHours();
|
||||
}
|
||||
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
public void setShowParticles(MobEffect potion, boolean showParticles)
|
||||
{
|
||||
this.getMetadata(potion).setShowParticles(showParticles);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Effect potion)
|
||||
public boolean getShowParticles(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getShowParticles();
|
||||
}
|
||||
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
public void setAmbient(MobEffect potion, boolean ambient)
|
||||
{
|
||||
this.getMetadata(potion).setAmbient(ambient);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Effect potion)
|
||||
public boolean getAmbient(MobEffect potion)
|
||||
{
|
||||
return this.getMetadata(potion).getAmbient();
|
||||
}
|
||||
|
||||
private EffectNBT getMetadata(Effect potion)
|
||||
private EffectNBT getMetadata(MobEffect potion)
|
||||
{
|
||||
return this.potions.get(this.validate(potion));
|
||||
}
|
||||
|
||||
private Effect validate(Effect potion)
|
||||
private MobEffect validate(MobEffect potion)
|
||||
{
|
||||
if(!this.potions.containsKey(potion))
|
||||
{
|
||||
@@ -121,12 +121,12 @@ public abstract class ComponentPotion implements IBuilderComponent
|
||||
return potion;
|
||||
}
|
||||
|
||||
public Set<Effect> getEffects()
|
||||
public Set<MobEffect> getMobEffects()
|
||||
{
|
||||
return this.potions.keySet();
|
||||
}
|
||||
|
||||
public void remove(Effect potion)
|
||||
public void remove(MobEffect potion)
|
||||
{
|
||||
this.potions.remove(potion);
|
||||
}
|
||||
|
||||
@@ -7,35 +7,35 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.WorldHandler;
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import net.minecraft.nbt.ByteArrayNBT;
|
||||
import net.minecraft.nbt.ByteNBT;
|
||||
import net.minecraft.nbt.DoubleNBT;
|
||||
import net.minecraft.nbt.FloatNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.IntArrayNBT;
|
||||
import net.minecraft.nbt.IntNBT;
|
||||
import net.minecraft.nbt.LongArrayNBT;
|
||||
import net.minecraft.nbt.LongNBT;
|
||||
import net.minecraft.nbt.ShortNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.nbt.ByteArrayTag;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.DoubleTag;
|
||||
import net.minecraft.nbt.FloatTag;
|
||||
import net.minecraft.nbt.IntArrayTag;
|
||||
import net.minecraft.nbt.IntTag;
|
||||
import net.minecraft.nbt.LongArrayTag;
|
||||
import net.minecraft.nbt.LongTag;
|
||||
import net.minecraft.nbt.ShortTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentTag<T> implements IBuilderComponent
|
||||
{
|
||||
private final Function<T, INBT> serializer;
|
||||
private final Function<T, Tag> serializer;
|
||||
private final String tag;
|
||||
private T value;
|
||||
|
||||
public ComponentTag(String tag, T value, Function<T, INBT> serializer)
|
||||
public ComponentTag(String tag, T value, Function<T, Tag> serializer)
|
||||
{
|
||||
this.tag = tag;
|
||||
this.value = value;
|
||||
this.serializer = serializer;
|
||||
}
|
||||
|
||||
public ComponentTag(String tag, Function<T, INBT> serializer)
|
||||
public ComponentTag(String tag, Function<T, Tag> serializer)
|
||||
{
|
||||
this(tag, null, serializer);
|
||||
}
|
||||
@@ -63,7 +63,7 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
public Tag serialize()
|
||||
{
|
||||
if(this.value != null)
|
||||
{
|
||||
@@ -80,9 +80,9 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
return null;
|
||||
}
|
||||
|
||||
return StringNBT.valueOf(string);
|
||||
return StringTag.valueOf(string);
|
||||
}
|
||||
else if(this.value instanceof INBT)
|
||||
else if(this.value instanceof Tag)
|
||||
{
|
||||
if(this.value instanceof Collection<?>)
|
||||
{
|
||||
@@ -94,43 +94,43 @@ public class ComponentTag<T> implements IBuilderComponent
|
||||
}
|
||||
}
|
||||
|
||||
return (INBT) this.value;
|
||||
return (Tag) this.value;
|
||||
}
|
||||
else if(this.value instanceof Integer)
|
||||
{
|
||||
return IntNBT.valueOf((Integer) this.value);
|
||||
return IntTag.valueOf((Integer) this.value);
|
||||
}
|
||||
else if(this.value instanceof Byte)
|
||||
{
|
||||
return ByteNBT.valueOf((Byte) this.value);
|
||||
return ByteTag.valueOf((Byte) this.value);
|
||||
}
|
||||
else if(this.value instanceof Float)
|
||||
{
|
||||
return FloatNBT.valueOf((Float) this.value);
|
||||
return FloatTag.valueOf((Float) this.value);
|
||||
}
|
||||
else if(this.value instanceof Double)
|
||||
{
|
||||
return DoubleNBT.valueOf((Double) this.value);
|
||||
return DoubleTag.valueOf((Double) this.value);
|
||||
}
|
||||
else if(this.value instanceof Long)
|
||||
{
|
||||
return LongNBT.valueOf((Long) this.value);
|
||||
return LongTag.valueOf((Long) this.value);
|
||||
}
|
||||
else if(this.value instanceof Short)
|
||||
{
|
||||
return ShortNBT.valueOf((Short) this.value);
|
||||
return ShortTag.valueOf((Short) this.value);
|
||||
}
|
||||
else if(this.value instanceof Byte[])
|
||||
{
|
||||
return new ByteArrayNBT((byte[]) this.value);
|
||||
return new ByteArrayTag((byte[]) this.value);
|
||||
}
|
||||
else if(this.value instanceof Integer[])
|
||||
{
|
||||
return new IntArrayNBT((int[]) this.value);
|
||||
return new IntArrayTag((int[]) this.value);
|
||||
}
|
||||
else if(this.value instanceof Long[])
|
||||
{
|
||||
return new LongArrayNBT((long[]) this.value);
|
||||
return new LongArrayTag((long[]) this.value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import exopandora.worldhandler.builder.INBTWritable;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -101,9 +101,9 @@ public class EffectNBT implements INBTWritable
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT serialize()
|
||||
public CompoundTag serialize()
|
||||
{
|
||||
CompoundNBT compound = new CompoundNBT();
|
||||
CompoundTag compound = new CompoundTag();
|
||||
int ticks = this.toTicks();
|
||||
|
||||
compound.putByte("Amplifier", (byte) (this.amplifier - 1));
|
||||
|
||||
@@ -11,22 +11,22 @@ import javax.annotation.Nullable;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import exopandora.worldhandler.util.NBTHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.ByteNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.IntNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.IntTag;
|
||||
import net.minecraft.nbt.StringTag;
|
||||
import net.minecraft.nbt.Tag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -41,12 +41,12 @@ public class EntityNBT implements IBuilderComponent
|
||||
private BlockState blockState;
|
||||
private ComponentCustom entity = new ComponentCustom();
|
||||
private ComponentAttributeMob attribute = new ComponentAttributeMob();
|
||||
private MutableStringTextComponent customName = new MutableStringTextComponent();
|
||||
private MutableTextComponent customName = new MutableTextComponent();
|
||||
private List<EntityNBT> passengers = new ArrayList<EntityNBT>();
|
||||
private ResourceLocation[] armorItems = {Items.AIR.getRegistryName(), Items.AIR.getRegistryName(), Items.AIR.getRegistryName(), Items.AIR.getRegistryName()};
|
||||
private ResourceLocation[] handItems = {Items.AIR.getRegistryName(), Items.AIR.getRegistryName()};
|
||||
private ComponentPotionMob potion = new ComponentPotionMob();
|
||||
private CompoundNBT nbt;
|
||||
private CompoundTag nbt;
|
||||
|
||||
public EntityNBT()
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class EntityNBT implements IBuilderComponent
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MutableStringTextComponent getCustomName()
|
||||
public MutableTextComponent getCustomName()
|
||||
{
|
||||
return this.customName;
|
||||
}
|
||||
@@ -270,69 +270,69 @@ public class EntityNBT implements IBuilderComponent
|
||||
this.motion[2] = z;
|
||||
}
|
||||
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
public void setAmplifier(MobEffect potion, byte amplifier)
|
||||
{
|
||||
this.potion.setAmplifier(potion, amplifier);
|
||||
}
|
||||
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
public void setSeconds(MobEffect potion, int seconds)
|
||||
{
|
||||
this.potion.setSeconds(potion, seconds);
|
||||
}
|
||||
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
public void setMinutes(MobEffect potion, int minutes)
|
||||
{
|
||||
this.potion.setMinutes(potion, minutes);
|
||||
}
|
||||
|
||||
public void setHours(Effect potion, int hours)
|
||||
public void setHours(MobEffect potion, int hours)
|
||||
{
|
||||
this.potion.setHours(potion, hours);
|
||||
}
|
||||
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
public void setShowParticles(MobEffect potion, boolean showParticles)
|
||||
{
|
||||
this.potion.setShowParticles(potion, showParticles);
|
||||
}
|
||||
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
public void setAmbient(MobEffect potion, boolean ambient)
|
||||
{
|
||||
this.potion.setAmbient(potion, ambient);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Effect potion)
|
||||
public byte getAmplifier(MobEffect potion)
|
||||
{
|
||||
return this.potion.getAmplifier(potion);
|
||||
}
|
||||
|
||||
public int getSeconds(Effect potion)
|
||||
public int getSeconds(MobEffect potion)
|
||||
{
|
||||
return this.potion.getSeconds(potion);
|
||||
}
|
||||
|
||||
public int getMinutes(Effect potion)
|
||||
public int getMinutes(MobEffect potion)
|
||||
{
|
||||
return this.potion.getMinutes(potion);
|
||||
}
|
||||
|
||||
public int getHours(Effect potion)
|
||||
public int getHours(MobEffect potion)
|
||||
{
|
||||
return this.potion.getHours(potion);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Effect potion)
|
||||
public boolean getShowParticles(MobEffect potion)
|
||||
{
|
||||
return this.potion.getShowParticles(potion);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Effect potion)
|
||||
public boolean getAmbient(MobEffect potion)
|
||||
{
|
||||
return this.potion.getAmbient(potion);
|
||||
}
|
||||
|
||||
public Set<Effect> getEffects()
|
||||
public Set<MobEffect> getEffects()
|
||||
{
|
||||
return this.potion.getEffects();
|
||||
return this.potion.getMobEffects();
|
||||
}
|
||||
|
||||
public void setBlockState(BlockState blockState)
|
||||
@@ -355,7 +355,7 @@ public class EntityNBT implements IBuilderComponent
|
||||
return this.time;
|
||||
}
|
||||
|
||||
public void setCustomComponent(String tag, INBT nbt)
|
||||
public void setCustomComponent(String tag, Tag nbt)
|
||||
{
|
||||
this.entity.set(tag, nbt);
|
||||
}
|
||||
@@ -385,12 +385,12 @@ public class EntityNBT implements IBuilderComponent
|
||||
return this.command;
|
||||
}
|
||||
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
public CompoundNBT getNBT()
|
||||
public CompoundTag getNBT()
|
||||
{
|
||||
return this.nbt;
|
||||
}
|
||||
@@ -399,7 +399,7 @@ public class EntityNBT implements IBuilderComponent
|
||||
{
|
||||
try
|
||||
{
|
||||
this.nbt = JsonToNBT.parseTag("{" + nbt + "}");
|
||||
this.nbt = TagParser.parseTag("{" + nbt + "}");
|
||||
}
|
||||
catch(CommandSyntaxException e)
|
||||
{
|
||||
@@ -408,23 +408,23 @@ public class EntityNBT implements IBuilderComponent
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundNBT serialize()
|
||||
public CompoundTag serialize()
|
||||
{
|
||||
CompoundNBT nbt = new CompoundNBT();
|
||||
CompoundTag nbt = new CompoundTag();
|
||||
|
||||
if(this.time != null)
|
||||
{
|
||||
NBTHelper.append(nbt, "Time", IntNBT.valueOf(this.time));
|
||||
NBTHelper.append(nbt, "Time", IntTag.valueOf(this.time));
|
||||
}
|
||||
|
||||
if(this.command != null)
|
||||
{
|
||||
NBTHelper.append(nbt, "Command", StringNBT.valueOf(this.command));
|
||||
NBTHelper.append(nbt, "Command", StringTag.valueOf(this.command));
|
||||
}
|
||||
|
||||
if(this.isBaby)
|
||||
{
|
||||
NBTHelper.append(nbt, "IsBaby", ByteNBT.valueOf(true));
|
||||
NBTHelper.append(nbt, "IsBaby", ByteTag.valueOf(true));
|
||||
}
|
||||
|
||||
NBTHelper.append(nbt, "id", NBTHelper.serialize(this.id));
|
||||
|
||||
@@ -6,7 +6,7 @@ import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilderNBT;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@ import javax.annotation.Nonnull;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.Coordinate.EnumType;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import exopandora.worldhandler.builder.types.Coordinate.EnumType;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@ import java.util.Set;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentAttributeItem;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentDisplay;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentEnchantment;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -68,32 +68,32 @@ public class BuilderCustomItem extends BuilderGive
|
||||
return this.attribute.getAttributes();
|
||||
}
|
||||
|
||||
public void setName(MutableStringTextComponent name)
|
||||
public void setName(MutableTextComponent name)
|
||||
{
|
||||
this.display.setName(name);
|
||||
}
|
||||
|
||||
public MutableStringTextComponent getName()
|
||||
public MutableTextComponent getName()
|
||||
{
|
||||
return this.display.getName();
|
||||
}
|
||||
|
||||
public void setLore1(ITextComponent lore)
|
||||
public void setLore1(Component lore)
|
||||
{
|
||||
this.display.setLore1(lore);
|
||||
}
|
||||
|
||||
public ITextComponent getLore1()
|
||||
public Component getLore1()
|
||||
{
|
||||
return this.display.getLore1();
|
||||
}
|
||||
|
||||
public void setLore2(ITextComponent lore)
|
||||
public void setLore2(Component lore)
|
||||
{
|
||||
this.display.setLore2(lore);
|
||||
}
|
||||
|
||||
public ITextComponent getLore2()
|
||||
public Component getLore2()
|
||||
{
|
||||
return this.display.getLore2();
|
||||
}
|
||||
|
||||
@@ -8,9 +8,9 @@ import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
super(2);
|
||||
}
|
||||
|
||||
public BuilderData(EnumMode mode, ResourceLocation entity, CompoundNBT nbt)
|
||||
public BuilderData(EnumMode mode, ResourceLocation entity, CompoundTag nbt)
|
||||
{
|
||||
this();
|
||||
this.setMode(mode);
|
||||
@@ -32,7 +32,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
this.setNBT(nbt);
|
||||
}
|
||||
|
||||
public BuilderData(EnumMode mode, BlockPos pos, CompoundNBT nbt)
|
||||
public BuilderData(EnumMode mode, BlockPos pos, CompoundTag nbt)
|
||||
{
|
||||
this();
|
||||
this.setMode(mode);
|
||||
@@ -130,7 +130,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
if(this.getMode() == null || !this.getMode().equals(EnumMode.MERGE))
|
||||
{
|
||||
@@ -156,7 +156,7 @@ public class BuilderData extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CompoundNBT getNBT()
|
||||
public CompoundTag getNBT()
|
||||
{
|
||||
if(this.getMode() != null && this.getMode().equals(EnumMode.MERGE))
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ import javax.annotation.Nonnull;
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ import javax.annotation.Nullable;
|
||||
import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -10,22 +10,22 @@ import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilderNBT;
|
||||
import exopandora.worldhandler.builder.component.impl.EntityNBT;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.entity.merchant.villager.VillagerProfession;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.ByteNBT;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.IntNBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.nbt.ByteTag;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.IntTag;
|
||||
import net.minecraft.nbt.ListTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.entity.npc.VillagerProfession;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -87,7 +87,7 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MutableStringTextComponent getCustomName()
|
||||
public MutableTextComponent getCustomName()
|
||||
{
|
||||
return this.nbt.getCustomName();
|
||||
}
|
||||
@@ -228,67 +228,67 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
this.nbt.setMotionZ(z);
|
||||
}
|
||||
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
public void setAmplifier(MobEffect potion, byte amplifier)
|
||||
{
|
||||
this.nbt.setAmplifier(potion, amplifier);
|
||||
}
|
||||
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
public void setSeconds(MobEffect potion, int seconds)
|
||||
{
|
||||
this.nbt.setSeconds(potion, seconds);
|
||||
}
|
||||
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
public void setMinutes(MobEffect potion, int minutes)
|
||||
{
|
||||
this.nbt.setMinutes(potion, minutes);
|
||||
}
|
||||
|
||||
public void setHours(Effect potion, int hours)
|
||||
public void setHours(MobEffect potion, int hours)
|
||||
{
|
||||
this.nbt.setHours(potion, hours);
|
||||
}
|
||||
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
public void setShowParticles(MobEffect potion, boolean showParticles)
|
||||
{
|
||||
this.nbt.setShowParticles(potion, showParticles);
|
||||
}
|
||||
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
public void setAmbient(MobEffect potion, boolean ambient)
|
||||
{
|
||||
this.nbt.setAmbient(potion, ambient);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Effect potion)
|
||||
public byte getAmplifier(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getAmplifier(potion);
|
||||
}
|
||||
|
||||
public int getSeconds(Effect potion)
|
||||
public int getSeconds(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getSeconds(potion);
|
||||
}
|
||||
|
||||
public int getMinutes(Effect potion)
|
||||
public int getMinutes(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getMinutes(potion);
|
||||
}
|
||||
|
||||
public int getHours(Effect potion)
|
||||
public int getHours(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getHours(potion);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Effect potion)
|
||||
public boolean getShowParticles(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getShowParticles(potion);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Effect potion)
|
||||
public boolean getAmbient(MobEffect potion)
|
||||
{
|
||||
return this.nbt.getAmbient(potion);
|
||||
}
|
||||
|
||||
public Set<Effect> getEffects()
|
||||
public Set<MobEffect> getMobEffects()
|
||||
{
|
||||
return this.nbt.getEffects();
|
||||
}
|
||||
@@ -328,18 +328,18 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
this.nbt.setNBT(nbt);
|
||||
}
|
||||
|
||||
public void setEntityNBT(CompoundNBT nbt)
|
||||
public void setEntityNBT(CompoundTag nbt)
|
||||
{
|
||||
this.nbt.setNBT(nbt);
|
||||
}
|
||||
|
||||
public CompoundNBT getEntityNBT()
|
||||
public CompoundTag getEntityNBT()
|
||||
{
|
||||
return this.nbt.getNBT();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CompoundNBT buildNBT()
|
||||
protected CompoundTag buildNBT()
|
||||
{
|
||||
return this.nbt.serialize();
|
||||
}
|
||||
@@ -352,7 +352,7 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
{
|
||||
if(entity.equals(EntityType.CAT.getRegistryName()))
|
||||
{
|
||||
this.nbt.setCustomComponent("CatType", IntNBT.valueOf(new Random().nextInt(11)));
|
||||
this.nbt.setCustomComponent("CatType", IntTag.valueOf(new Random().nextInt(11)));
|
||||
}
|
||||
else if(entity.equals(EntityType.VILLAGER.getRegistryName()))
|
||||
{
|
||||
@@ -360,7 +360,7 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
{
|
||||
if(StringUtils.equalsIgnoreCase(name, profession.toString()))
|
||||
{
|
||||
CompoundNBT villagerData = new CompoundNBT();
|
||||
CompoundTag villagerData = new CompoundTag();
|
||||
villagerData.putString("profession", profession.getRegistryName().toString());
|
||||
|
||||
this.nbt.setCustomComponent("VillagerData", villagerData);
|
||||
@@ -372,14 +372,14 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
{
|
||||
if(StringUtils.containsIgnoreCase(name, "Baby"))
|
||||
{
|
||||
this.nbt.setCustomComponent("IsBaby", ByteNBT.valueOf((byte) 1));
|
||||
this.nbt.setCustomComponent("IsBaby", ByteTag.valueOf((byte) 1));
|
||||
}
|
||||
}
|
||||
else if(entity.equals(EntityType.CHICKEN.getRegistryName()))
|
||||
{
|
||||
if(StringUtils.containsIgnoreCase(name, "Jockey") && !this.nbt.hasPassengers())
|
||||
{
|
||||
ListNBT list = new ListNBT();
|
||||
ListTag list = new ListTag();
|
||||
EntityNBT zombie = new EntityNBT(EntityType.ZOMBIE.getRegistryName());
|
||||
|
||||
zombie.setIsBaby(true);
|
||||
@@ -391,7 +391,7 @@ public abstract class BuilderEntity extends CommandBuilderNBT
|
||||
{
|
||||
if(StringUtils.containsIgnoreCase(name, "Jockey") && !this.nbt.hasPassengers())
|
||||
{
|
||||
ListNBT list = new ListNBT();
|
||||
ListTag list = new ListTag();
|
||||
EntityNBT skeleton = new EntityNBT(EntityType.SKELETON.getRegistryName());
|
||||
|
||||
skeleton.setHandItem(0, Items.BOW);
|
||||
|
||||
@@ -3,12 +3,12 @@ package exopandora.worldhandler.builder.impl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.BlockResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -4,11 +4,11 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandBuilderNBT;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.ItemResourceLocation;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -69,14 +69,14 @@ public class BuilderGive extends CommandBuilderNBT
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
this.itemResourceLocation.setNBT(nbt);
|
||||
this.setNode(1, this.itemResourceLocation);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public CompoundNBT getNBT()
|
||||
public CompoundTag getNBT()
|
||||
{
|
||||
ItemResourceLocation item = this.getItem();
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.state.properties.BlockStateProperties;
|
||||
import net.minecraft.state.properties.NoteBlockInstrument;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
|
||||
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.component.impl.EffectNBT;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -33,7 +33,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
{
|
||||
this.setMode(mode);
|
||||
this.setPlayer(player);
|
||||
this.setEffect(effect);
|
||||
this.setMobEffect(effect);
|
||||
this.setDuration(duration);
|
||||
this.setAmplifier(amplifier);
|
||||
this.setHideParticles(hideParticles);
|
||||
@@ -58,18 +58,18 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
return this.getNodeAsString(1);
|
||||
}
|
||||
|
||||
public void setEffect(Effect effect)
|
||||
public void setMobEffect(MobEffect effect)
|
||||
{
|
||||
this.setEffect(effect.getRegistryName());
|
||||
this.setMobEffect(effect.getRegistryName());
|
||||
}
|
||||
|
||||
public void setEffect(ResourceLocation effect)
|
||||
public void setMobEffect(ResourceLocation effect)
|
||||
{
|
||||
this.setNode(2, effect);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Effect getEffectAsPotion()
|
||||
public MobEffect getMobEffectAsPotion()
|
||||
{
|
||||
ResourceLocation location = this.getNodeAsResourceLocation(2);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public ResourceLocation getEffect()
|
||||
public ResourceLocation getMobEffect()
|
||||
{
|
||||
return this.getNodeAsResourceLocation(2);
|
||||
}
|
||||
@@ -152,12 +152,12 @@ public class BuilderPotionEffect extends CommandBuilder
|
||||
|
||||
public BuilderGeneric buildGive()
|
||||
{
|
||||
return new BuilderGeneric(this.getCommandName(), EnumMode.GIVE.toString(), this.getPlayer(), this.getEffect().toString(), String.valueOf(this.getDuration()), String.valueOf(this.getAmplifier()), String.valueOf(this.getHideParticles()));
|
||||
return new BuilderGeneric(this.getCommandName(), EnumMode.GIVE.toString(), this.getPlayer(), this.getMobEffect().toString(), String.valueOf(this.getDuration()), String.valueOf(this.getAmplifier()), String.valueOf(this.getHideParticles()));
|
||||
}
|
||||
|
||||
public BuilderGeneric buildRemove()
|
||||
{
|
||||
return new BuilderGeneric(this.getCommandName(), EnumMode.CLEAR.toString(), this.getPlayer(), this.getEffect().toString());
|
||||
return new BuilderGeneric(this.getCommandName(), EnumMode.CLEAR.toString(), this.getPlayer(), this.getMobEffect().toString());
|
||||
}
|
||||
|
||||
public BuilderGeneric buildClear()
|
||||
|
||||
@@ -3,9 +3,9 @@ package exopandora.worldhandler.builder.impl;
|
||||
import java.util.Set;
|
||||
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentPotionItem;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -25,69 +25,69 @@ public class BuilderPotionItem extends BuilderGive
|
||||
this.potion = this.registerNBTComponent(potion);
|
||||
}
|
||||
|
||||
public void setAmplifier(Effect potion, byte amplifier)
|
||||
public void setAmplifier(MobEffect potion, byte amplifier)
|
||||
{
|
||||
this.potion.setAmplifier(potion, amplifier);
|
||||
}
|
||||
|
||||
public void setSeconds(Effect potion, int seconds)
|
||||
public void setSeconds(MobEffect potion, int seconds)
|
||||
{
|
||||
this.potion.setSeconds(potion, seconds);
|
||||
}
|
||||
|
||||
public void setMinutes(Effect potion, int minutes)
|
||||
public void setMinutes(MobEffect potion, int minutes)
|
||||
{
|
||||
this.potion.setMinutes(potion, minutes);
|
||||
}
|
||||
|
||||
public void setHours(Effect potion, int hours)
|
||||
public void setHours(MobEffect potion, int hours)
|
||||
{
|
||||
this.potion.setHours(potion, hours);
|
||||
}
|
||||
|
||||
public void setShowParticles(Effect potion, boolean showParticles)
|
||||
public void setShowParticles(MobEffect potion, boolean showParticles)
|
||||
{
|
||||
this.potion.setShowParticles(potion, showParticles);
|
||||
}
|
||||
|
||||
public void setAmbient(Effect potion, boolean ambient)
|
||||
public void setAmbient(MobEffect potion, boolean ambient)
|
||||
{
|
||||
this.potion.setAmbient(potion, ambient);
|
||||
}
|
||||
|
||||
public byte getAmplifier(Effect potion)
|
||||
public byte getAmplifier(MobEffect potion)
|
||||
{
|
||||
return this.potion.getAmplifier(potion);
|
||||
}
|
||||
|
||||
public int getSeconds(Effect potion)
|
||||
public int getSeconds(MobEffect potion)
|
||||
{
|
||||
return this.potion.getSeconds(potion);
|
||||
}
|
||||
|
||||
public int getMinutes(Effect potion)
|
||||
public int getMinutes(MobEffect potion)
|
||||
{
|
||||
return this.potion.getMinutes(potion);
|
||||
}
|
||||
|
||||
public int getHours(Effect potion)
|
||||
public int getHours(MobEffect potion)
|
||||
{
|
||||
return this.potion.getHours(potion);
|
||||
}
|
||||
|
||||
public boolean getShowParticles(Effect potion)
|
||||
public boolean getShowParticles(MobEffect potion)
|
||||
{
|
||||
return this.potion.getShowParticles(potion);
|
||||
}
|
||||
|
||||
public boolean getAmbient(Effect potion)
|
||||
public boolean getAmbient(MobEffect potion)
|
||||
{
|
||||
return this.potion.getAmbient(potion);
|
||||
}
|
||||
|
||||
public Set<Effect> getEffects()
|
||||
public Set<MobEffect> getMobEffects()
|
||||
{
|
||||
return this.potion.getEffects();
|
||||
return this.potion.getMobEffects();
|
||||
}
|
||||
|
||||
public BuilderPotionItem build(Item item)
|
||||
|
||||
@@ -6,8 +6,8 @@ import exopandora.worldhandler.builder.CommandBuilder;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class BuilderRecipe extends CommandBuilder
|
||||
return this.getNodeAsString(1);
|
||||
}
|
||||
|
||||
public void setRecipe(IRecipe<?> recipe)
|
||||
public void setRecipe(Recipe<?> recipe)
|
||||
{
|
||||
this.setRecipe(recipe.getId());
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.RegExUtils;
|
||||
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
|
||||
@@ -4,10 +4,10 @@ import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.BlockResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -56,7 +56,7 @@ public class BuilderSetBlock extends BuilderBlockPos
|
||||
this.setNode(4, mode.toString());
|
||||
}
|
||||
|
||||
public void setBlockNBT(CompoundNBT nbt)
|
||||
public void setBlockNBT(CompoundTag nbt)
|
||||
{
|
||||
this.blockResourceLocation.setNBT(nbt);
|
||||
this.setBlock(this.blockResourceLocation);
|
||||
@@ -68,7 +68,7 @@ public class BuilderSetBlock extends BuilderBlockPos
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package exopandora.worldhandler.builder.impl;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentTag;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import exopandora.worldhandler.util.SignText;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -38,7 +38,7 @@ public class BuilderSignEditor extends BuilderData
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public MutableStringTextComponent getColoredString(int line)
|
||||
public MutableTextComponent getColoredString(int line)
|
||||
{
|
||||
if(this.checkBounds(line))
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@ import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.types.ArgumentType;
|
||||
import exopandora.worldhandler.builder.types.Coordinate.EnumType;
|
||||
import exopandora.worldhandler.builder.types.CoordinateDouble;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -60,7 +60,7 @@ public class BuilderSummon extends BuilderEntity
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
this.setNode(4, nbt);
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import exopandora.worldhandler.builder.types.CoordinateInt;
|
||||
import exopandora.worldhandler.builder.types.GreedyString;
|
||||
import exopandora.worldhandler.builder.types.ItemResourceLocation;
|
||||
import exopandora.worldhandler.builder.types.TargetSelector;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -76,7 +76,7 @@ public class BuilderUsercontent extends CommandBuilder
|
||||
this.setNode(index, type.<Long>parseOfDefault(object, ((Double) argument.getDefault()).longValue()));
|
||||
break;
|
||||
case NBT:
|
||||
this.setNode(index, type.<CompoundNBT>parseOfDefault(object, type.parse((String) argument.getDefault())));
|
||||
this.setNode(index, type.<CompoundTag>parseOfDefault(object, type.parse((String) argument.getDefault())));
|
||||
break;
|
||||
case RESOURCE_LOCATION:
|
||||
this.setNode(index, type.<ResourceLocation>parseOfDefault(object, type.parse((String) argument.getDefault())));
|
||||
|
||||
@@ -6,9 +6,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -66,13 +66,13 @@ public enum ArgumentType
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static CompoundNBT parseCompoundNBT(String value)
|
||||
public static CompoundTag parseCompoundNBT(String value)
|
||||
{
|
||||
if(value != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonToNBT.parseTag(value);
|
||||
return TagParser.parseTag(value);
|
||||
}
|
||||
catch(CommandSyntaxException e)
|
||||
{
|
||||
|
||||
@@ -5,11 +5,11 @@ import javax.annotation.Nullable;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.command.arguments.BlockStateParser;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.Property;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -29,7 +29,7 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
this(resource, null, null);
|
||||
}
|
||||
|
||||
public BlockResourceLocation(ResourceLocation resource, BlockState state, CompoundNBT nbt)
|
||||
public BlockResourceLocation(ResourceLocation resource, BlockState state, CompoundTag nbt)
|
||||
{
|
||||
super(resource, nbt);
|
||||
this.state = this.findState(state, resource);
|
||||
|
||||
@@ -4,9 +4,9 @@ import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.JsonToNBT;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.TagParser;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public class ItemResourceLocation
|
||||
{
|
||||
protected ResourceLocation resource;
|
||||
protected CompoundNBT nbt;
|
||||
protected CompoundTag nbt;
|
||||
|
||||
public ItemResourceLocation()
|
||||
{
|
||||
@@ -26,7 +26,7 @@ public class ItemResourceLocation
|
||||
this(resource, null);
|
||||
}
|
||||
|
||||
public ItemResourceLocation(ResourceLocation resource, CompoundNBT nbt)
|
||||
public ItemResourceLocation(ResourceLocation resource, CompoundTag nbt)
|
||||
{
|
||||
this.resource = resource;
|
||||
this.nbt = nbt;
|
||||
@@ -42,12 +42,12 @@ public class ItemResourceLocation
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
public CompoundNBT getNBT()
|
||||
public CompoundTag getNBT()
|
||||
{
|
||||
return this.nbt;
|
||||
}
|
||||
|
||||
public void setNBT(CompoundNBT nbt)
|
||||
public void setNBT(CompoundTag nbt)
|
||||
{
|
||||
this.nbt = nbt;
|
||||
}
|
||||
@@ -57,13 +57,13 @@ public class ItemResourceLocation
|
||||
{
|
||||
int start = input.indexOf("{");
|
||||
ResourceLocation resource = new ResourceLocation(input.substring(0, start));
|
||||
CompoundNBT nbt = null;
|
||||
CompoundTag nbt = null;
|
||||
|
||||
if(start > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
nbt = JsonToNBT.parseTag(input.substring(start, input.lastIndexOf("}") + 1));
|
||||
nbt = TagParser.parseTag(input.substring(start, input.lastIndexOf("}") + 1));
|
||||
}
|
||||
catch(CommandSyntaxException e)
|
||||
{
|
||||
|
||||
@@ -18,14 +18,14 @@ import exopandora.worldhandler.builder.types.BlockResourceLocation;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.EnumHelper;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.command.arguments.BlockPredicateArgument;
|
||||
import net.minecraft.command.arguments.BlockStateArgument;
|
||||
import net.minecraft.command.arguments.BlockStateInput;
|
||||
import net.minecraft.command.arguments.BlockStateParser;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraft.commands.arguments.blocks.BlockInput;
|
||||
import net.minecraft.commands.arguments.blocks.BlockPredicateArgument;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateArgument;
|
||||
import net.minecraft.commands.arguments.blocks.BlockStateParser;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.DistExecutor.SafeRunnable;
|
||||
@@ -33,7 +33,7 @@ import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
public class CommandWH
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSource> dispatcher)
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("wh")
|
||||
.then(Commands.literal("pos1")
|
||||
@@ -61,7 +61,7 @@ public class CommandWH
|
||||
.executes(context -> clone(context.getSource(), "replace")))));
|
||||
}
|
||||
|
||||
private static int pos1(CommandSource source) throws CommandSyntaxException
|
||||
private static int pos1(CommandSourceStack source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -80,7 +80,7 @@ public class CommandWH
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int pos2(CommandSource source) throws CommandSyntaxException
|
||||
private static int pos2(CommandSourceStack source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -99,7 +99,7 @@ public class CommandWH
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int fill(CommandSource source, BlockStateInput block)
|
||||
private static int fill(CommandSourceStack source, BlockInput block)
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -117,7 +117,7 @@ public class CommandWH
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int replace(CommandSource source, BlockStateInput block, BlockStateInput replace)
|
||||
private static int replace(CommandSourceStack source, BlockInput block, BlockInput replace)
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -139,7 +139,7 @@ public class CommandWH
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int clone(CommandSource source, String mask, String filter)
|
||||
private static int clone(CommandSourceStack source, String mask, String filter)
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -160,7 +160,7 @@ public class CommandWH
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int clone(CommandSource source, String mask)
|
||||
private static int clone(CommandSourceStack source, String mask)
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -200,7 +200,7 @@ public class CommandWH
|
||||
return "#" + blockstateparser.getTag();
|
||||
}
|
||||
|
||||
public static String getBlockPredicate(CommandContext<CommandSource> context, String name) throws CommandSyntaxException
|
||||
public static String getBlockPredicate(CommandContext<CommandSourceStack> context, String name) throws CommandSyntaxException
|
||||
{
|
||||
return context.getArgument(name, String.class);
|
||||
}
|
||||
|
||||
@@ -9,8 +9,8 @@ import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.command.Commands;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.fml.DistExecutor;
|
||||
import net.minecraftforge.fml.DistExecutor.SafeRunnable;
|
||||
@@ -19,7 +19,7 @@ import net.minecraftforge.fml.VersionChecker;
|
||||
|
||||
public class CommandWorldHandler
|
||||
{
|
||||
public static void register(CommandDispatcher<CommandSource> dispatcher)
|
||||
public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
|
||||
{
|
||||
dispatcher.register(Commands.literal("worldhandler")
|
||||
.then(Commands.literal("help")
|
||||
@@ -30,7 +30,7 @@ public class CommandWorldHandler
|
||||
.executes(context -> version(context.getSource()))));
|
||||
}
|
||||
|
||||
private static int help(CommandSource source) throws CommandSyntaxException
|
||||
private static int help(CommandSourceStack source) throws CommandSyntaxException
|
||||
{
|
||||
CommandHelper.sendFeedback(source, "/worldhandler help");
|
||||
CommandHelper.sendFeedback(source, "/worldhandler display");
|
||||
@@ -38,7 +38,7 @@ public class CommandWorldHandler
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int display(CommandSource source) throws CommandSyntaxException
|
||||
private static int display(CommandSourceStack source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> new SafeRunnable()
|
||||
{
|
||||
@@ -54,10 +54,10 @@ public class CommandWorldHandler
|
||||
return 1;
|
||||
}
|
||||
|
||||
private static int version(CommandSource source) throws CommandSyntaxException
|
||||
private static int version(CommandSourceStack source) throws CommandSyntaxException
|
||||
{
|
||||
CommandHelper.sendFeedback(source, "Installed: " + Main.MC_VERSION + "-" + Main.MOD_VERSION);
|
||||
ComparableVersion target = VersionChecker.getResult(ModList.get().getModContainerById(Main.MODID).get().getModInfo()).target;
|
||||
ComparableVersion target = VersionChecker.getResult(ModList.get().getModContainerById(Main.MODID).get().getModInfo()).target();
|
||||
CommandHelper.sendFeedback(source, "Latest: " + Main.MC_VERSION + "-" + (target != null ? target : Main.MOD_VERSION));
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.config.ModConfig.Reloading;
|
||||
import net.minecraftforge.fml.config.ModConfig.Type;
|
||||
import net.minecraftforge.fml.event.config.ModConfigEvent.Reloading;
|
||||
|
||||
public class Config
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.event;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
import com.mojang.brigadier.ParseResults;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
@@ -11,12 +11,12 @@ import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.LevelRenderer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource.BufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
@@ -31,7 +31,7 @@ public class ClientEventHandler
|
||||
{
|
||||
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().level != null && Minecraft.getInstance().getEntityRenderDispatcher().camera != null)
|
||||
{
|
||||
Vector3d projected = Minecraft.getInstance().getEntityRenderDispatcher().camera.getPosition();
|
||||
Vec3 projected = Minecraft.getInstance().getEntityRenderDispatcher().camera.getPosition();
|
||||
|
||||
double minX = Math.min(BlockHelper.getPos1().getX(), BlockHelper.getPos2().getX());
|
||||
double minY = Math.min(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY());
|
||||
@@ -41,18 +41,18 @@ public class ClientEventHandler
|
||||
double maxY = Math.max(BlockHelper.getPos1().getY(), BlockHelper.getPos2().getY()) + 1;
|
||||
double maxZ = Math.max(BlockHelper.getPos1().getZ(), BlockHelper.getPos2().getZ()) + 1;
|
||||
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
AABB aabb = new AABB(minX, minY, minZ, maxX, maxY, maxZ);
|
||||
|
||||
if(aabb.getCenter().distanceTo(projected) < 96)
|
||||
{
|
||||
MatrixStack matrix = event.getMatrixStack();
|
||||
PoseStack matrix = event.getMatrixStack();
|
||||
matrix.pushPose();
|
||||
matrix.translate(-projected.x(), -projected.y(), -projected.z());
|
||||
|
||||
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
IVertexBuilder builder = buffer.getBuffer(RenderType.lines());
|
||||
BufferSource buffer = Minecraft.getInstance().renderBuffers().bufferSource();
|
||||
VertexConsumer builder = buffer.getBuffer(RenderType.lines());
|
||||
|
||||
WorldRenderer.renderLineBox(matrix, builder, minX, minY, minZ, maxX, maxY, maxZ, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F);
|
||||
LevelRenderer.renderLineBox(matrix, builder, minX, minY, minZ, maxX, maxY, maxZ, 0.9F, 0.9F, 0.9F, 1.0F, 0.5F, 0.5F, 0.5F);
|
||||
|
||||
buffer.endBatch(RenderType.lines());
|
||||
buffer.endBatch();
|
||||
@@ -90,13 +90,13 @@ public class ClientEventHandler
|
||||
{
|
||||
if(!Minecraft.getInstance().hasSingleplayerServer() && Minecraft.getInstance().player != null)
|
||||
{
|
||||
CommandDispatcher<CommandSource> dispatcher = new CommandDispatcher<CommandSource>();
|
||||
CommandDispatcher<CommandSourceStack> dispatcher = new CommandDispatcher<CommandSourceStack>();
|
||||
CommandHelper.registerCommands(dispatcher);
|
||||
|
||||
StringReader command = new StringReader(event.getMessage());
|
||||
command.skip();
|
||||
|
||||
ParseResults<CommandSource> result = dispatcher.parse(command, Minecraft.getInstance().player.createCommandSourceStack());
|
||||
ParseResults<CommandSourceStack> result = dispatcher.parse(command, Minecraft.getInstance().player.createCommandSourceStack());
|
||||
|
||||
if(result.getContext().getCommand() != null)
|
||||
{
|
||||
|
||||
@@ -6,20 +6,20 @@ import org.lwjgl.glfw.GLFW;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import net.minecraft.client.KeyMapping;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.InputEvent.KeyInputEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||
import net.minecraftforge.fmlclient.registry.ClientRegistry;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class KeyHandler
|
||||
{
|
||||
public static final KeyBinding KEY_WORLD_HANDLER = new KeyBinding("key.worldhandler", GLFW.GLFW_KEY_V, "key.categories.worldhandler");
|
||||
public static final KeyBinding KEY_WORLD_HANDLER_POS1 = new KeyBinding("key.worldhandler.pos1", GLFW.GLFW_KEY_O, "key.categories.worldhandler");
|
||||
public static final KeyBinding KEY_WORLD_HANDLER_POS2 = new KeyBinding("key.worldhandler.pos2", GLFW.GLFW_KEY_P, "key.categories.worldhandler");
|
||||
public static final KeyMapping KEY_WORLD_HANDLER = new KeyMapping("key.worldhandler", GLFW.GLFW_KEY_V, "key.categories.worldhandler");
|
||||
public static final KeyMapping KEY_WORLD_HANDLER_POS1 = new KeyMapping("key.worldhandler.pos1", GLFW.GLFW_KEY_O, "key.categories.worldhandler");
|
||||
public static final KeyMapping KEY_WORLD_HANDLER_POS2 = new KeyMapping("key.worldhandler.pos2", GLFW.GLFW_KEY_P, "key.categories.worldhandler");
|
||||
|
||||
@SubscribeEvent
|
||||
public static void keyInputEvent(KeyInputEvent event)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui;
|
||||
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -12,7 +12,7 @@ public class DummyScreen extends Screen
|
||||
|
||||
public DummyScreen(Runnable runnable)
|
||||
{
|
||||
super(StringTextComponent.EMPTY);
|
||||
super(TextComponent.EMPTY);
|
||||
this.runnable = runnable;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.category;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import exopandora.worldhandler.usercontent.UsercontentConfig;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.usercontent.model.JsonTab;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.event.RegistryEvent.NewRegistry;
|
||||
|
||||
@@ -5,10 +5,13 @@ import java.util.List;
|
||||
|
||||
import exopandora.worldhandler.gui.menu.IMenu;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
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.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -16,9 +19,9 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public abstract class Container extends Screen implements IContainer
|
||||
{
|
||||
protected final List<IMenu> menus = new ArrayList<IMenu>();
|
||||
protected final List<Widget> widgetButtons = new ArrayList<Widget>();
|
||||
protected final List<AbstractWidget> widgetButtons = new ArrayList<AbstractWidget>();
|
||||
|
||||
protected Container(ITextComponent title)
|
||||
protected Container(Component title)
|
||||
{
|
||||
super(title);
|
||||
}
|
||||
@@ -30,12 +33,12 @@ public abstract class Container extends Screen implements IContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Widget> T add(T button)
|
||||
public <T extends GuiEventListener & Widget & NarratableEntry> T add(T button)
|
||||
{
|
||||
return super.addButton(button);
|
||||
return super.addRenderableWidget(button);
|
||||
}
|
||||
|
||||
public <T extends TextFieldWidget> T add(T textfield)
|
||||
public <T extends EditBox> T add(T textfield)
|
||||
{
|
||||
return super.addWidget(textfield);
|
||||
}
|
||||
@@ -48,7 +51,7 @@ public abstract class Container extends Screen implements IContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget addWidget(Widget button)
|
||||
public AbstractWidget addWidget(AbstractWidget button)
|
||||
{
|
||||
this.widgetButtons.add(button);
|
||||
return button;
|
||||
|
||||
@@ -2,18 +2,21 @@ package exopandora.worldhandler.gui.container;
|
||||
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraft.client.gui.narration.NarratableEntry;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface IContainer
|
||||
{
|
||||
<T extends Widget> T add(T button);
|
||||
<T extends GuiEventListener & Widget & NarratableEntry> T add(T button);
|
||||
|
||||
void initButtons();
|
||||
Menu add(Menu menu);
|
||||
Widget addWidget(Widget button);
|
||||
AbstractWidget addWidget(AbstractWidget button);
|
||||
|
||||
String getPlayer();
|
||||
void setPlayer(String text);
|
||||
|
||||
@@ -3,8 +3,8 @@ package exopandora.worldhandler.gui.container.impl;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
@@ -24,10 +24,11 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.Widget;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -60,8 +61,7 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
this.widgetButtons.clear();
|
||||
this.menus.clear();
|
||||
this.buttons.clear();
|
||||
this.children.clear();
|
||||
this.clearWidgets();
|
||||
|
||||
final int x = this.getContentX();
|
||||
final int y = this.getContentY();
|
||||
@@ -91,10 +91,9 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
ActionHelper.tryRun(() ->
|
||||
{
|
||||
this.buttons.clear();
|
||||
this.children.clear();
|
||||
this.clearWidgets();
|
||||
this.content.initButtons(this, this.getContentX(), this.getContentY());
|
||||
this.widgetButtons.forEach(this::add);
|
||||
this.widgetButtons.forEach(w -> this.addRenderableWidget(w));
|
||||
|
||||
int x = this.getContentX();
|
||||
int y = this.getContentY();
|
||||
@@ -149,7 +148,7 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void render(PoseStack stack, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
ActionHelper.tryRun(() ->
|
||||
{
|
||||
@@ -159,19 +158,19 @@ public class GuiWorldHandler extends Container
|
||||
if(Config.getSkin().drawBackground())
|
||||
{
|
||||
this.setBlitOffset(-1);
|
||||
super.renderBackground(matrix);
|
||||
super.renderBackground(stack);
|
||||
}
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
RenderUtils.colorDefaultBackground();
|
||||
|
||||
this.bindBackground();
|
||||
this.blit(matrix, backgroundX, backgroundY, 0, 0, this.getBackgroundWidth(), this.getBackgroundHeight());
|
||||
this.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;
|
||||
final int versionHeight = this.height - 10;
|
||||
this.font.draw(matrix, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000);
|
||||
this.font.draw(stack, label, versionWidth, versionHeight, Config.getSkin().getLabelColor() + 0x33000000);
|
||||
|
||||
int x = this.getContentX();
|
||||
int y = this.getContentY();
|
||||
@@ -180,52 +179,52 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
if(widget.isEnabled() && EnumLayer.BACKGROUND == widget.getLayer())
|
||||
{
|
||||
widget.drawScreen(matrix, this, x, y, mouseX, mouseY, partialTicks);
|
||||
widget.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
final int maxWidth = this.getBackgroundWidth() - 18 - this.font.width(this.getPlayer()) - (Config.getSettings().watch() ? 9 : 0);
|
||||
this.font.draw(matrix, TextUtils.stripText(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
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.buttons.size(); i++)
|
||||
for(int i = 0; i < this.renderables.size(); i++)
|
||||
{
|
||||
this.buttons.get(i).render(matrix, mouseX, mouseY, partialTicks);
|
||||
this.renderables.get(i).render(stack, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
this.content.drawScreen(matrix, this, x, y, mouseX, mouseY, partialTicks);
|
||||
this.content.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
||||
|
||||
for(IMenu menu : this.menus)
|
||||
{
|
||||
menu.draw(matrix, mouseX, mouseY, partialTicks);
|
||||
menu.draw(stack, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
for(IContainerWidget widget : WIDGETS)
|
||||
{
|
||||
if(widget.isEnabled() && EnumLayer.FOREGROUND == widget.getLayer())
|
||||
{
|
||||
widget.drawScreen(matrix, this, x, y, mouseX, mouseY, partialTicks);
|
||||
widget.drawScreen(stack, this, x, y, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
if(Config.getSettings().tooltips())
|
||||
{
|
||||
for(Widget button : this.buttons)
|
||||
for(Widget button : this.renderables)
|
||||
{
|
||||
if(button instanceof GuiButtonTooltip)
|
||||
{
|
||||
((GuiButtonTooltip) button).renderTooltip(this, matrix, mouseX, mouseY);
|
||||
((GuiButtonTooltip) button).renderTooltip(this, stack, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mouseX >= versionWidth && mouseY >= versionHeight)
|
||||
{
|
||||
matrix.pushPose();
|
||||
matrix.translate(versionWidth - 12, versionHeight + 12, 0);
|
||||
stack.pushPose();
|
||||
stack.translate(versionWidth - 12, versionHeight + 12, 0);
|
||||
|
||||
this.renderTooltip(matrix, new StringTextComponent(label), 0, 0);
|
||||
this.renderTooltip(stack, new TextComponent(label), 0, 0);
|
||||
|
||||
matrix.popPose();
|
||||
stack.popPose();
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
@@ -327,9 +326,9 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
boolean focused = this.getFocused() != null;
|
||||
|
||||
if(focused && this.getFocused() instanceof Widget)
|
||||
if(focused && this.getFocused() instanceof AbstractWidget)
|
||||
{
|
||||
focused = ((Widget) this.getFocused()).isFocused();
|
||||
focused = ((AbstractWidget) this.getFocused()).isFocused();
|
||||
}
|
||||
|
||||
if(!focused && KeyHandler.KEY_WORLD_HANDLER.matches(keyCode, scanCode) && KeyHandler.KEY_WORLD_HANDLER.getKeyModifier().isActive(null))
|
||||
@@ -492,6 +491,6 @@ public class GuiWorldHandler extends Container
|
||||
@Override
|
||||
public void bindBackground()
|
||||
{
|
||||
Minecraft.getInstance().getTextureManager().bind(ResourceHelper.backgroundTexture());
|
||||
RenderSystem.setShaderTexture(0, ResourceHelper.backgroundTexture());
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ import exopandora.worldhandler.gui.content.impl.ContentWorldInfo;
|
||||
import exopandora.worldhandler.usercontent.UsercontentConfig;
|
||||
import exopandora.worldhandler.usercontent.UsercontentLoader;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.event.RegistryEvent.NewRegistry;
|
||||
|
||||
@@ -4,7 +4,7 @@ import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentButcherPresets;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentChild;
|
||||
import exopandora.worldhandler.gui.content.impl.ContentContinue;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import javax.annotation.Nullable;
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.widget.IWidget;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -15,8 +15,8 @@ public interface IContent extends IWidget
|
||||
{
|
||||
Category getCategory();
|
||||
|
||||
IFormattableTextComponent getTitle();
|
||||
IFormattableTextComponent getTabTitle();
|
||||
MutableComponent getTitle();
|
||||
MutableComponent getTabTitle();
|
||||
|
||||
Content getActiveContent();
|
||||
|
||||
|
||||
@@ -23,13 +23,13 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.AdvancementHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ContentAdvancements extends Content
|
||||
@@ -53,15 +53,15 @@ public class ContentAdvancements extends Content
|
||||
MenuPageList<Advancement> list = new MenuPageList<Advancement>(x, y, advancements, 114, 20, 3, container, new ILogicPageList<Advancement>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Advancement item)
|
||||
public MutableComponent translate(Advancement item)
|
||||
{
|
||||
return (IFormattableTextComponent) item.getDisplay().getTitle();
|
||||
return (MutableComponent) item.getDisplay().getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Advancement item)
|
||||
public MutableComponent toTooltip(Advancement item)
|
||||
{
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
return new TextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +72,7 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Advancement item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Advancement item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -90,21 +90,21 @@ public class ContentAdvancements extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonList<EnumMode>(x + 118, y, this.modes, 114, 20, container, new ILogicMapped<EnumMode>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(EnumMode item)
|
||||
public MutableComponent translate(EnumMode item)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.advancements." + item.toString());
|
||||
return new TranslatableComponent("gui.worldhandler.advancements." + item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(EnumMode item)
|
||||
public MutableComponent toTooltip(EnumMode item)
|
||||
{
|
||||
return new StringTextComponent(item.toString());
|
||||
return new TextComponent(item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,15 +120,15 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.grant"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.advancements.grant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement.build(EnumActionType.GRANT));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.revoke"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.advancements.revoke"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderAdvancement.build(EnumActionType.REVOKE));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.actions.reset").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderAdvancement.build(EnumActionType.REVOKE, EnumMode.EVERYTHING)));
|
||||
}));
|
||||
@@ -141,15 +141,15 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.advancements");
|
||||
return new TranslatableComponent("gui.worldhandler.title.player.advancements");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.advancements");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.player.advancements");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderButcher;
|
||||
@@ -20,13 +20,13 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -47,7 +47,7 @@ public class ContentButcher extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.radiusField = new GuiTextFieldTooltip(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.radius"));
|
||||
this.radiusField = new GuiTextFieldTooltip(x + 58, y, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.radius"));
|
||||
this.radiusField.setFilter(string ->
|
||||
{
|
||||
if(string == null)
|
||||
@@ -92,24 +92,24 @@ public class ContentButcher extends Content
|
||||
{
|
||||
GuiButtonBase slaughter;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(this.radiusField);
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.configure"), () ->
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslatableComponent("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, new TranslationTextComponent("gui.worldhandler.butcher.slaughter"), () ->
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.slaughter"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), Config.getButcher().getEntities().stream().map(ForgeRegistries.ENTITIES::getValue).filter(Predicates.notNull()).collect(Collectors.toList()), Integer.parseInt(this.radius));
|
||||
}));
|
||||
slaughter.active = enabled && !Config.getButcher().getEntities().isEmpty();
|
||||
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets"), () ->
|
||||
container.add(slaughter = new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.presets"), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.BUTCHER_PRESETS.withBuilder(this.builderButcher).withRadius(Integer.parseInt(this.radius)));
|
||||
}));
|
||||
@@ -118,16 +118,16 @@ public class ContentButcher extends Content
|
||||
|
||||
public static void slaughter(String username, Collection<EntityType<?>> entities, int radius)
|
||||
{
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
World world = Minecraft.getInstance().level;
|
||||
Player player = Minecraft.getInstance().player;
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
if(player != null && world != null)
|
||||
if(player != null && level != null)
|
||||
{
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(player.blockPosition()).inflate(radius);
|
||||
AABB aabb = new AABB(player.blockPosition()).inflate(radius);
|
||||
|
||||
for(EntityType<?> entity : entities)
|
||||
{
|
||||
List<? extends Entity> targets = world.getEntities(entity, aabb, Predicates.alwaysTrue());
|
||||
List<? extends Entity> targets = level.getEntities(entity, aabb, Predicates.alwaysTrue());
|
||||
targets.removeIf(target -> player.equals(target));
|
||||
|
||||
if(!targets.isEmpty())
|
||||
@@ -145,9 +145,9 @@ public class ContentButcher extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack stack, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.radiusField.renderButton(stack, mouseX, mouseY, partialTicks);
|
||||
this.radiusField.renderButton(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -157,15 +157,15 @@ public class ContentButcher extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.entities.butcher");
|
||||
return new TranslatableComponent("gui.worldhandler.title.entities.butcher");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.entities.butcher");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.entities.butcher");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,9 +6,9 @@ import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.entity.EntityClassification;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.MobCategory;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -40,27 +40,27 @@ public class ContentButcherPresets extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslationTextComponent("gui.worldhandler.butcher.presets.passive_mobs"), () ->
|
||||
container.add(new GuiButtonBase(x + 58, y, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.presets.passive_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> !EntityClassification.MONSTER.equals(entity.getCategory()) && !EntityClassification.MISC.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.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, new TranslationTextComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
|
||||
container.add(new GuiButtonBase(x + 58, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.presets.hostile_mobs"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MONSTER.equals(entity.getCategory())).collect(Collectors.toList()), this.radius);
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.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, new TranslationTextComponent("gui.worldhandler.butcher.presets.players"), () ->
|
||||
container.add(new GuiButtonBase(x + 58, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.presets.players"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.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, new TranslationTextComponent("gui.worldhandler.butcher.presets.entities"), () ->
|
||||
container.add(new GuiButtonBase(x + 58, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.butcher.presets.entities"), () ->
|
||||
{
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> EntityClassification.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
ContentButcher.slaughter(container.getPlayer(), ForgeRegistries.ENTITIES.getValues().stream().filter(entity -> MobCategory.MISC.equals(entity.getCategory()) && !EntityType.PLAYER.equals(entity)).collect(Collectors.toList()), this.radius);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -11,11 +11,11 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -33,15 +33,15 @@ public class ContentButcherSettings extends ContentChild
|
||||
MenuPageList<EntityType<?>> entities = new MenuPageList<EntityType<?>>(x, y, list, 114, 20, 3, container, new ILogicPageList<EntityType<?>>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(EntityType<?> item)
|
||||
public MutableComponent translate(EntityType<?> item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(EntityType<?> item)
|
||||
public MutableComponent toTooltip(EntityType<?> item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -52,7 +52,7 @@ public class ContentButcherSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, EntityType<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, EntityType<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -73,15 +73,15 @@ public class ContentButcherSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().addEntity(this.entity);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().removeEntity(this.entity);
|
||||
container.initButtons();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.realmsclient.RealmsMainScreen;
|
||||
|
||||
import exopandora.worldhandler.gui.DummyScreen;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
@@ -8,20 +10,20 @@ import exopandora.worldhandler.util.IConnection;
|
||||
import exopandora.worldhandler.util.IConnection.DedicatedConnection;
|
||||
import exopandora.worldhandler.util.IConnection.IntegratedConnection;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.ConnectingScreen;
|
||||
import net.minecraft.client.gui.screen.DirtMessageScreen;
|
||||
import net.minecraft.client.gui.screen.MainMenuScreen;
|
||||
import net.minecraft.client.gui.screen.MultiplayerScreen;
|
||||
import net.minecraft.client.gui.screen.MultiplayerWarningScreen;
|
||||
import net.minecraft.client.gui.screen.WorldSelectionScreen;
|
||||
import net.minecraft.client.gui.screens.ConnectScreen;
|
||||
import net.minecraft.client.gui.screens.GenericDirtMessageScreen;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import net.minecraft.client.gui.screens.multiplayer.JoinMultiplayerScreen;
|
||||
import net.minecraft.client.gui.screens.multiplayer.SafetyScreen;
|
||||
import net.minecraft.client.gui.screens.worldselection.SelectWorldScreen;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.realms.RealmsBridgeScreen;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.registry.DynamicRegistries;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.gen.settings.DimensionGeneratorSettings;
|
||||
import net.minecraft.client.multiplayer.resolver.ServerAddress;
|
||||
import net.minecraft.client.server.IntegratedServer;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.level.LevelSettings;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -31,27 +33,27 @@ public class ContentChangeWorld extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, new TranslatableComponent("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
{
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
Minecraft.getInstance().setScreen(new WorldSelectionScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
|
||||
Minecraft.getInstance().setScreen(new SelectWorldScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, new TranslatableComponent("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
{
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
DummyScreen dummy = new DummyScreen(() -> ContentChangeWorld.reconnect(connection));
|
||||
|
||||
if(Minecraft.getInstance().options.skipMultiplayerWarning)
|
||||
{
|
||||
Minecraft.getInstance().setScreen(new MultiplayerScreen(dummy));
|
||||
Minecraft.getInstance().setScreen(new JoinMultiplayerScreen(dummy));
|
||||
}
|
||||
else
|
||||
{
|
||||
Minecraft.getInstance().setScreen(new MultiplayerWarningScreen(dummy));
|
||||
Minecraft.getInstance().setScreen(new SafetyScreen(dummy));
|
||||
}
|
||||
}));
|
||||
}
|
||||
@@ -66,13 +68,13 @@ public class ContentChangeWorld extends ContentChild
|
||||
{
|
||||
IntegratedServer integrated = Minecraft.getInstance().getSingleplayerServer();
|
||||
String folder = integrated.storageSource.getLevelId();
|
||||
DimensionGeneratorSettings dimensionGeneratorSettings = integrated.getWorldData().worldGenSettings();
|
||||
WorldSettings worldSettings = integrated.getWorldData().getLevelSettings();
|
||||
WorldGenSettings worldGenSettings = integrated.getWorldData().worldGenSettings();
|
||||
LevelSettings levelSettings = integrated.getWorldData().getLevelSettings();
|
||||
|
||||
Minecraft.getInstance().level.disconnect();
|
||||
Minecraft.getInstance().clearLevel(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
|
||||
Minecraft.getInstance().clearLevel(new GenericDirtMessageScreen(new TranslatableComponent("menu.savingLevel")));
|
||||
|
||||
return new IntegratedConnection(folder, worldSettings, dimensionGeneratorSettings);
|
||||
return new IntegratedConnection(folder, levelSettings, worldGenSettings);
|
||||
}
|
||||
|
||||
if(Minecraft.getInstance().level != null)
|
||||
@@ -93,26 +95,25 @@ public class ContentChangeWorld extends ContentChild
|
||||
{
|
||||
if(connection == null)
|
||||
{
|
||||
RealmsBridgeScreen realmsbridge = new RealmsBridgeScreen();
|
||||
realmsbridge.switchToRealms(new MainMenuScreen());
|
||||
Minecraft.getInstance().setScreen(new RealmsMainScreen(new TitleScreen()));
|
||||
}
|
||||
else if(connection instanceof IntegratedConnection)
|
||||
{
|
||||
IntegratedConnection integrated = (IntegratedConnection) connection;
|
||||
Minecraft.getInstance().createLevel(integrated.getFolder(), integrated.getWorldSettings(), DynamicRegistries.builtin(), integrated.getDimensionGeneratorSettings());
|
||||
Minecraft.getInstance().createLevel(integrated.getFolder(), integrated.getWorldSettings(), RegistryAccess.builtin(), integrated.getWorldGenSettings());
|
||||
Minecraft.getInstance().mouseHandler.grabMouse();
|
||||
}
|
||||
else if(connection instanceof DedicatedConnection)
|
||||
{
|
||||
DedicatedConnection dedicated = (DedicatedConnection) connection;
|
||||
Minecraft.getInstance().setScreen(new ConnectingScreen(new MainMenuScreen(), Minecraft.getInstance(), dedicated.getData()));
|
||||
Minecraft.getInstance().mouseHandler.grabMouse();
|
||||
ServerData data = dedicated.getData();
|
||||
ConnectScreen.startConnecting(new TitleScreen(), Minecraft.getInstance(), ServerAddress.parseString(data.ip), data);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.change_world");
|
||||
return new TranslatableComponent("gui.worldhandler.title.change_world");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -30,7 +30,7 @@ public abstract class ContentChild extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
if(this.parent != null)
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public abstract class ContentChild extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
if(this.parent != null)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.function.Consumer;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.EntityNBT;
|
||||
@@ -28,14 +28,14 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -44,8 +44,8 @@ public class ContentCommandStack extends ContentChild
|
||||
{
|
||||
private static final int HEAD_LENGTH = 1;
|
||||
private static final int TAIL_LENGTH = 2;
|
||||
private static final StringTextComponent PLUS = new StringTextComponent("+");
|
||||
private static final StringTextComponent MINUS = new StringTextComponent("-");
|
||||
private static final TextComponent PLUS = new TextComponent("+");
|
||||
private static final TextComponent MINUS = new TextComponent("-");
|
||||
|
||||
private final List<GuiTextFieldTooltip> textfields = new ArrayList<GuiTextFieldTooltip>();
|
||||
private int scroll;
|
||||
@@ -72,7 +72,7 @@ public class ContentCommandStack extends ContentChild
|
||||
|
||||
EntityNBT blockRemover = new EntityNBT(EntityType.COMMAND_BLOCK_MINECART.getRegistryName());
|
||||
BuilderSetBlock builder = new BuilderSetBlock(new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(-2, EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), Blocks.REPEATING_COMMAND_BLOCK.getRegistryName(), EnumMode.DESTROY);
|
||||
CompoundNBT commandBlock = new CompoundNBT();
|
||||
CompoundTag commandBlock = new CompoundTag();
|
||||
commandBlock.putByte("auto", (byte) 1);
|
||||
commandBlock.putString("Command", new BuilderFill(new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new CoordinateInt(2, EnumType.GLOBAL), new CoordinateInt(EnumType.GLOBAL), new BlockResourceLocation(Blocks.AIR.getRegistryName())).toActualCommand());
|
||||
builder.setBlockNBT(commandBlock);
|
||||
@@ -99,7 +99,7 @@ public class ContentCommandStack extends ContentChild
|
||||
{
|
||||
int command = index + this.scroll;
|
||||
|
||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, new TranslationTextComponent("gui.worldhandler.command_stack.command_n", command + 1));
|
||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, new TranslatableComponent("gui.worldhandler.command_stack.command_n", command + 1));
|
||||
textfield.setFilter(Predicates.notNull());
|
||||
textfield.setValue(command < this.getCommandCount() ? this.getCommand(command) : null);
|
||||
textfield.setResponder(text ->
|
||||
@@ -117,8 +117,8 @@ public class ContentCommandStack extends ContentChild
|
||||
GuiButtonBase buttonScrollUp;
|
||||
GuiButtonBase buttonScrollDown;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
this.iterate(index ->
|
||||
{
|
||||
@@ -126,17 +126,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, new TranslationTextComponent("gui.worldhandler.actions.move_up"), () ->
|
||||
container.add(buttonUp = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 - 1, 20, 10, EnumIcon.ARROW_UP, new TranslatableComponent("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, new TranslationTextComponent("gui.worldhandler.actions.move_down"), () ->
|
||||
container.add(buttonDown = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 + 11, 20, 10, EnumIcon.ARROW_DOWN, new TranslatableComponent("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, new TranslationTextComponent("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
container.add(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, MINUS, new TranslatableComponent("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll;
|
||||
this.removeCommand(pos);
|
||||
@@ -148,7 +148,7 @@ public class ContentCommandStack extends ContentChild
|
||||
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, PLUS, new TranslationTextComponent("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, PLUS, new TranslatableComponent("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll + 1;
|
||||
this.addCommand(pos);
|
||||
@@ -167,16 +167,16 @@ public class ContentCommandStack extends ContentChild
|
||||
buttonDown.active = index + this.scroll + 1 < this.getCommandCount();
|
||||
});
|
||||
|
||||
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard(this.builderCommandStack.toActualCommand());
|
||||
}));
|
||||
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, new TranslationTextComponent("gui.worldhandler.actions.move_up"), () ->
|
||||
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, new TranslatableComponent("gui.worldhandler.actions.move_up"), () ->
|
||||
{
|
||||
this.scrollUp();
|
||||
container.init();
|
||||
}));
|
||||
container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, new TranslationTextComponent("gui.worldhandler.actions.move_down"), () ->
|
||||
container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, new TranslatableComponent("gui.worldhandler.actions.move_down"), () ->
|
||||
{
|
||||
this.scrollDown();
|
||||
container.init();
|
||||
@@ -197,7 +197,7 @@ public class ContentCommandStack extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.iterate(index ->
|
||||
{
|
||||
@@ -284,8 +284,8 @@ public class ContentCommandStack extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.command_stack");
|
||||
return new TranslatableComponent("gui.worldhandler.title.command_stack");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonItem;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ContentContainers extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 232, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 232, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getName(), () ->
|
||||
{
|
||||
@@ -108,15 +108,15 @@ public class ContentContainers extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.containers");
|
||||
return new TranslatableComponent("gui.worldhandler.title.containers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.containers");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.containers");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.ICommandBuilderSyntax;
|
||||
@@ -9,8 +9,8 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -61,20 +61,20 @@ public class ContentContinue extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslatableComponent("gui.worldhandler.generic.yes").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builder, this.special);
|
||||
ActionHelper.open(this.getParentContent());
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslatableComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
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,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentAttribute;
|
||||
@@ -27,11 +27,11 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -83,7 +83,7 @@ public class ContentCustomItem extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.itemField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.item_id"));
|
||||
this.itemField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.start.item_id"));
|
||||
this.itemField.setFilter(Predicates.<String>notNull());
|
||||
this.itemField.setValue(this.item);
|
||||
this.itemField.setResponder(text ->
|
||||
@@ -93,21 +93,21 @@ public class ContentCustomItem extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_1"));
|
||||
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.start.lore_1"));
|
||||
this.itemLore1Field.setFilter(Predicates.<String>notNull());
|
||||
this.itemLore1Field.setText(this.builderCutomItem.getLore1());
|
||||
this.itemLore1Field.setResponder(text ->
|
||||
{
|
||||
this.builderCutomItem.setLore1(new StringTextComponent(text));
|
||||
this.builderCutomItem.setLore1(new TextComponent(text));
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_2"));
|
||||
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.start.lore_2"));
|
||||
this.itemLore2Field.setFilter(Predicates.<String>notNull());
|
||||
this.itemLore2Field.setText(this.builderCutomItem.getLore2());
|
||||
this.itemLore2Field.setResponder(text ->
|
||||
{
|
||||
this.builderCutomItem.setLore2(new StringTextComponent(text));
|
||||
this.builderCutomItem.setLore2(new TextComponent(text));
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
@@ -123,15 +123,15 @@ public class ContentCustomItem extends Content
|
||||
MenuPageList<Enchantment> enchantments = new MenuPageList<Enchantment>(x + 118, y, new ArrayList<Enchantment>(ForgeRegistries.ENCHANTMENTS.getValues()), 114, 20, 3, container, new ILogicPageList<Enchantment>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Enchantment item)
|
||||
public MutableComponent translate(Enchantment item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Enchantment item)
|
||||
public MutableComponent toTooltip(Enchantment item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -141,7 +141,7 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiSlider(x, y, width, height, 0, Config.getSliders().getMaxItemEnchantment(), 0, container, new LogicSliderSimple(item.getRegistryName().toString(), text, value ->
|
||||
{
|
||||
@@ -168,15 +168,15 @@ public class ContentCustomItem extends Content
|
||||
MenuPageList<Attribute> attributes = new MenuPageList<Attribute>(x + 118, y, ComponentAttribute.ATTRIBUTES, 114, 20, 3, container, new ILogicPageList<Attribute>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Attribute item)
|
||||
public MutableComponent translate(Attribute item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Attribute item)
|
||||
public MutableComponent toTooltip(Attribute item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,7 +186,7 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Attribute item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Attribute item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiSlider(x, y, width, height, -Config.getSliders().getMaxItemAttributes(), Config.getSliders().getMaxItemEnchantment(), 0, container, new LogicSliderAttribute(item, text, value ->
|
||||
{
|
||||
@@ -221,20 +221,20 @@ public class ContentCustomItem extends Content
|
||||
GuiButtonBase button5;
|
||||
GuiButtonBase button6;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
{
|
||||
this.page = Page.ENCHANT;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
{
|
||||
this.page = Page.ATTRIBUTES;
|
||||
container.init();
|
||||
@@ -278,11 +278,11 @@ public class ContentCustomItem extends Content
|
||||
|
||||
if(!this.builderCutomItem.needsCommandBlock() && !this.builderCutomItem.getName().isSpecial())
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.custom_item"), () -> this.send(container.getPlayer())));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.items.custom_item.custom_item"), () -> this.send(container.getPlayer())));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () -> this.send(container.getPlayer())));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.actions.place_command_block"), () -> this.send(container.getPlayer())));
|
||||
}
|
||||
|
||||
button4.active = ResourceHelper.isRegistered(ResourceHelper.stringToResourceLocation(this.item), ForgeRegistries.ITEMS);
|
||||
@@ -305,7 +305,7 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
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)
|
||||
{
|
||||
@@ -322,15 +322,15 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.custom_item");
|
||||
return new TranslatableComponent("gui.worldhandler.title.items.custom_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.custom_item");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.items.custom_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Arrays;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.brigadier.StringReader;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -26,9 +26,9 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -129,7 +129,7 @@ public class ContentEditBlocks extends Content
|
||||
BlockHelper.setPos2(BlockHelper.setZ(BlockHelper.getPos2(), this.parseCoordinate(text)));
|
||||
});
|
||||
|
||||
this.block1Field = new GuiTextFieldTooltip(x + 118, y, 114, 20, Page.FILL.equals(this.page) ? new TranslationTextComponent("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : new TranslationTextComponent("gui.worldhandler.edit_blocks.replace.block_id_replace"));
|
||||
this.block1Field = new GuiTextFieldTooltip(x + 118, y, 114, 20, Page.FILL.equals(this.page) ? new TranslatableComponent("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : new TranslatableComponent("gui.worldhandler.edit_blocks.replace.block_id_replace"));
|
||||
this.block1Field.setFilter(Predicates.notNull());
|
||||
this.block1Field.setValue(this.block1);
|
||||
this.block1Field.setResponder(text ->
|
||||
@@ -139,7 +139,7 @@ public class ContentEditBlocks extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
||||
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
||||
this.block2Field.setFilter(Predicates.notNull());
|
||||
this.block2Field.setValue(this.block2);
|
||||
this.block2Field.setResponder(text ->
|
||||
@@ -149,7 +149,7 @@ public class ContentEditBlocks extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone.filter"));
|
||||
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.clone.filter"));
|
||||
this.filterField.setFilter(Predicates.notNull());
|
||||
this.filterField.setValue(this.filter);
|
||||
this.filterField.setResponder(text ->
|
||||
@@ -168,25 +168,25 @@ public class ContentEditBlocks extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
{
|
||||
this.page = Page.COORDINATES;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
this.page = Page.FILL;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
this.page = Page.REPLACE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
this.page = Page.CLONE;
|
||||
container.init();
|
||||
@@ -226,7 +226,7 @@ public class ContentEditBlocks extends Content
|
||||
xOffset2 = 0;
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderFill.build());
|
||||
}));
|
||||
@@ -244,7 +244,7 @@ public class ContentEditBlocks extends Content
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(this.block2Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderFill.buildReplace());
|
||||
}));
|
||||
@@ -268,22 +268,22 @@ public class ContentEditBlocks extends Content
|
||||
else
|
||||
{
|
||||
this.builderClone.setFilter(null);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, StringTextComponent.EMPTY, null));
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, TextComponent.EMPTY, null));
|
||||
button1.active = false;
|
||||
}
|
||||
|
||||
container.add(new GuiButtonList<EnumMask>(x + 118, y, Arrays.asList(EnumMask.values()), 114, 20, container, new ILogicMapped<EnumMask>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(EnumMask item)
|
||||
public MutableComponent translate(EnumMask item)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.edit_blocks.clone.mode." + item.toString());
|
||||
return new TranslatableComponent("gui.worldhandler.edit_blocks.clone.mode." + item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(EnumMask item)
|
||||
public MutableComponent toTooltip(EnumMask item)
|
||||
{
|
||||
return new StringTextComponent(item.toString());
|
||||
return new TextComponent(item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -300,7 +300,7 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderClone);
|
||||
}));
|
||||
@@ -318,12 +318,12 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
{
|
||||
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
container.add(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, new TranslatableComponent("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
{
|
||||
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
|
||||
container.init();
|
||||
@@ -362,7 +362,7 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.COORDINATES.equals(this.page))
|
||||
{
|
||||
@@ -419,15 +419,15 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.edit_blocks");
|
||||
return new TranslatableComponent("gui.worldhandler.title.blocks.edit_blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.edit_blocks");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.blocks.edit_blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,10 +18,10 @@ import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -43,15 +43,15 @@ public class ContentEnchantment extends Content
|
||||
MenuPageList<Enchantment> enchantments = new MenuPageList<Enchantment>(x, y, new ArrayList<Enchantment>(ForgeRegistries.ENCHANTMENTS.getValues()), 114, 20, 3, container, new ILogicPageList<Enchantment>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Enchantment item)
|
||||
public MutableComponent translate(Enchantment item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Enchantment item)
|
||||
public MutableComponent toTooltip(Enchantment item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +63,7 @@ public class ContentEnchantment extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -81,15 +81,15 @@ public class ContentEnchantment extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 1, ForgeRegistries.ENCHANTMENTS.getValue(this.builderEnchantment.getEnchantment()).getMaxLevel(), 1, container, new LogicSliderSimple("enchantment", new TranslationTextComponent("gui.worldhandler.items.enchantment.level"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 1, ForgeRegistries.ENCHANTMENTS.getValue(this.builderEnchantment.getEnchantment()).getMaxLevel(), 1, container, new LogicSliderSimple("enchantment", new TranslatableComponent("gui.worldhandler.items.enchantment.level"), value ->
|
||||
{
|
||||
this.builderEnchantment.setLevel(value.intValue());
|
||||
})));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderEnchantment);
|
||||
}));
|
||||
@@ -102,15 +102,15 @@ public class ContentEnchantment extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.enchantment");
|
||||
return new TranslatableComponent("gui.worldhandler.title.items.enchantment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.enchantment");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.items.enchantment");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,8 +14,8 @@ import exopandora.worldhandler.gui.widget.button.GuiSlider;
|
||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -45,24 +45,24 @@ public class ContentExperience extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("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", new TranslationTextComponent("gui.worldhandler.title.player.experience"), value ->
|
||||
container.add(new GuiSlider(x + 116 / 2, y, 114, 20, 0, Config.getSliders().getMaxExperience(), 0, container, new LogicSliderSimple("experience", new TranslatableComponent("gui.worldhandler.title.player.experience"), value ->
|
||||
{
|
||||
this.builderExperience.setLevel(value);
|
||||
})));
|
||||
|
||||
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.buildAdd());
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.buildRemove());
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () ->
|
||||
container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.actions.reset"), new TranslatableComponent("gui.worldhandler.actions.set_to_0"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderExperience.buildReset());
|
||||
container.init();
|
||||
@@ -90,15 +90,15 @@ public class ContentExperience extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.experience");
|
||||
return new TranslatableComponent("gui.worldhandler.title.player.experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.experience");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.player.experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
|
||||
@@ -24,14 +24,11 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.GameRules.IRuleEntryVisitor;
|
||||
import net.minecraft.world.GameRules.RuleKey;
|
||||
import net.minecraft.world.GameRules.RuleType;
|
||||
import net.minecraft.world.GameRules.RuleValue;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.GameRules.GameRuleTypeVisitor;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -54,7 +51,7 @@ public class ContentGamerules extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField.setFilter(Predicates.notNull());
|
||||
this.valueField.setValue(this.value);
|
||||
this.valueField.moveCursorToEnd();
|
||||
@@ -66,10 +63,10 @@ public class ContentGamerules extends Content
|
||||
|
||||
Map<String, ArgumentType<?>> map = new HashMap<String, ArgumentType<?>>();
|
||||
|
||||
GameRules.visitGameRuleTypes(new IRuleEntryVisitor()
|
||||
GameRules.visitGameRuleTypes(new GameRuleTypeVisitor()
|
||||
{
|
||||
@Override
|
||||
public <T extends RuleValue<T>> void visit(RuleKey<T> rule, RuleType<T> type)
|
||||
public <T extends GameRules.Value<T>> void visit(GameRules.Key<T> rule, GameRules.Type<T> type)
|
||||
{
|
||||
map.put(rule.getId(), type.createArgument(null).getType());
|
||||
}
|
||||
@@ -78,15 +75,15 @@ public class ContentGamerules extends Content
|
||||
MenuPageList<String> rules = new MenuPageList<String>(x, y, new ArrayList<String>(map.keySet()), 114, 20, 3, container, new ILogicPageList<String>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(String item)
|
||||
public MutableComponent translate(String item)
|
||||
{
|
||||
return new TranslationTextComponent("gamerule." + item);
|
||||
return new TranslatableComponent("gamerule." + item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(String item)
|
||||
public MutableComponent toTooltip(String item)
|
||||
{
|
||||
return new StringTextComponent(item);
|
||||
return new TextComponent(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -108,7 +105,7 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, String item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, String item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -126,16 +123,16 @@ public class ContentGamerules extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.booleanValue)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule.build(String.valueOf(true)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule.build(String.valueOf(false)));
|
||||
}));
|
||||
@@ -143,7 +140,7 @@ public class ContentGamerules extends Content
|
||||
else
|
||||
{
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderGamerule);
|
||||
}));
|
||||
@@ -160,7 +157,7 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!this.booleanValue)
|
||||
{
|
||||
@@ -175,15 +172,15 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.world.gamerules");
|
||||
return new TranslatableComponent("gui.worldhandler.title.world.gamerules");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.world.gamerules");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.world.gamerules");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,11 +12,11 @@ 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.screen.OptionsScreen;
|
||||
import net.minecraft.client.gui.screen.PackScreen;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.client.gui.screens.OptionsScreen;
|
||||
import net.minecraft.client.gui.screens.packs.PackSelectionScreen;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -26,46 +26,46 @@ 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, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
container.add(new GuiButtonIcon(x + 26, y, 22, 20, EnumIcon.TIME_NOON, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y, 22, 20, EnumIcon.TIME_SUNSET, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y, 23, 20, EnumIcon.TIME_MIDNIGHT, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y, 24, 20, EnumIcon.DIFFICULTY_PEACEFUL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.settings"), () -> ActionHelper.open(Contents.SETTINGS)));
|
||||
container.add(new GuiButtonIcon(x, y, 22, 20, EnumIcon.TIME_DAWN, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
container.add(new GuiButtonIcon(x + 26, y, 22, 20, EnumIcon.TIME_NOON, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y, 22, 20, EnumIcon.TIME_SUNSET, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y, 23, 20, EnumIcon.TIME_MIDNIGHT, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y, 24, 20, EnumIcon.DIFFICULTY_PEACEFUL, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.settings"), () -> ActionHelper.open(Contents.SETTINGS)));
|
||||
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.potions"), () -> ActionHelper.open(Contents.POTIONS)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.command_stack"), () -> ActionHelper.open(Contents.COMMAND_STACK)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.potions"), () -> ActionHelper.open(Contents.POTIONS)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.command_stack"), () -> ActionHelper.open(Contents.COMMAND_STACK)));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.items"), () -> ActionHelper.open(Contents.CUSTOM_ITEM)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, new TranslationTextComponent("gui.worldhandler.blocks"), () -> ActionHelper.open(Contents.EDIT_BLOCKS)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.entities"), () -> ActionHelper.open(Contents.SUMMON)));
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, new TranslatableComponent("gui.worldhandler.items"), () -> ActionHelper.open(Contents.CUSTOM_ITEM)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, new TranslatableComponent("gui.worldhandler.blocks"), () -> ActionHelper.open(Contents.EDIT_BLOCKS)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, new TranslatableComponent("gui.worldhandler.entities"), () -> ActionHelper.open(Contents.SUMMON)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.world"), () -> ActionHelper.open(Contents.WORLD_INFO)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, new TranslationTextComponent("gui.worldhandler.player"), () -> ActionHelper.open(Contents.PLAYER)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.scoreboard"), () -> ActionHelper.open(Contents.SCOREBOARD_OBJECTIVES)));
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, new TranslatableComponent("gui.worldhandler.world"), () -> ActionHelper.open(Contents.WORLD_INFO)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, new TranslatableComponent("gui.worldhandler.player"), () -> ActionHelper.open(Contents.PLAYER)));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, new TranslatableComponent("gui.worldhandler.scoreboard"), () -> ActionHelper.open(Contents.SCOREBOARD_OBJECTIVES)));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, new TranslationTextComponent("gui.worldhandler.resourcepack"), () ->
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslatableComponent("gui.worldhandler.change_world"), () -> ActionHelper.open(Contents.CHANGE_WORLD)));
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, new TranslatableComponent("gui.worldhandler.resourcepack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().options.save();
|
||||
Minecraft.getInstance().setScreen(new PackScreen(container, Minecraft.getInstance().getResourcePackRepository(), resourcePackList ->
|
||||
Minecraft.getInstance().setScreen(new PackSelectionScreen(container, Minecraft.getInstance().getResourcePackRepository(), resourcePackList ->
|
||||
{
|
||||
OptionsScreen optionsScreen = new OptionsScreen(container, Minecraft.getInstance().options);
|
||||
optionsScreen.init(Minecraft.getInstance(), 0, 0);
|
||||
optionsScreen.updatePackList(resourcePackList);
|
||||
}, Minecraft.getInstance().getResourcePackDirectory(), new TranslationTextComponent("resourcePack.title")));
|
||||
}, Minecraft.getInstance().getResourcePackDirectory(), new TranslatableComponent("resourcePack.title")));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,15 +75,15 @@ public class ContentMain extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new StringTextComponent(Main.NAME);
|
||||
return new TextComponent(Main.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new StringTextComponent(Main.NAME);
|
||||
return new TextComponent(Main.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderGeneric;
|
||||
@@ -22,11 +22,11 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -83,7 +83,7 @@ public class ContentMultiplayer extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.username"));
|
||||
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.username"));
|
||||
this.playerField.setFilter(Predicates.notNull());
|
||||
this.playerField.setFocus(false);
|
||||
this.playerField.setValue(this.builderKick.getPlayer());
|
||||
@@ -94,7 +94,7 @@ public class ContentMultiplayer extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||
this.reasonField.setFilter(Predicates.notNull());
|
||||
this.reasonField.setFocus(false);
|
||||
this.reasonField.setValue(this.builderKick.getReason());
|
||||
@@ -116,29 +116,29 @@ public class ContentMultiplayer extends Content
|
||||
GuiButtonBase button6;
|
||||
GuiButtonBase button7;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new StringTextComponent(I18n.get("gui.worldhandler.multiplayer.kick") + " / " + I18n.get("gui.worldhandler.multiplayer.ban")), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TextComponent(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, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
{
|
||||
this.page = Page.PARDON;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
{
|
||||
this.page = Page.PERMISSIONS;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
{
|
||||
this.page = Page.RUNTIME;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
container.add(button5 = new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
{
|
||||
this.page = Page.WHITELIST;
|
||||
container.init();
|
||||
@@ -148,11 +148,11 @@ public class ContentMultiplayer extends Content
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(this.reasonField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick"), new StringTextComponent(this.builderKick.toActualCommand()), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.kick"), new TextComponent(this.builderKick.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderKick);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.ban"), new StringTextComponent(this.builderBan.toActualCommand()), () ->
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.ban"), new TextComponent(this.builderBan.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderBan);
|
||||
}));
|
||||
@@ -168,7 +168,7 @@ 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, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), new StringTextComponent(this.builderPardon.toActualCommand()), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.pardon"), new TextComponent(this.builderPardon.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPardon);
|
||||
}));
|
||||
@@ -183,11 +183,11 @@ 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, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.give"), new StringTextComponent(this.builderOp.toActualCommand()), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.permissions.give"), new TextComponent(this.builderOp.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderOp);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.take"), new StringTextComponent(this.builderDeop.toActualCommand()), () ->
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.permissions.take"), new TextComponent(this.builderDeop.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderDeop);
|
||||
}));
|
||||
@@ -202,19 +202,19 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
else if(Page.RUNTIME.equals(this.page))
|
||||
{
|
||||
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.save_world"), new StringTextComponent(this.builderSaveAll.toActualCommand()), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.runtime.save_world"), new TextComponent(this.builderSaveAll.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSaveAll);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.on")), new StringTextComponent(this.builderSaveOn.toActualCommand()), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslatableComponent("gui.worldhandler.generic.on")), new TextComponent(this.builderSaveOn.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSaveOn);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).withStyle(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslatableComponent("gui.worldhandler.generic.off")).withStyle(ChatFormatting.RED), new TextComponent(this.builderSaveOff.toActualCommand()), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSaveOff));
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.stop_server").withStyle(TextFormatting.RED), new StringTextComponent(this.builderStop.toActualCommand()), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.runtime.stop_server").withStyle(ChatFormatting.RED), new TextComponent(this.builderStop.toActualCommand()), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderStop));
|
||||
}));
|
||||
@@ -224,25 +224,25 @@ 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, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.ADD));
|
||||
}));
|
||||
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.REMOVE));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.on")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslatableComponent("gui.worldhandler.generic.on")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.ON));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.off")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslatableComponent("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.OFF));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, new TranslatableComponent("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderWhitelist.build(EnumMode.RELOAD));
|
||||
}));
|
||||
@@ -272,7 +272,7 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
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))
|
||||
{
|
||||
@@ -310,15 +310,15 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.multiplayer");
|
||||
return new TranslatableComponent("gui.worldhandler.title.multiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.multiplayer");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.multiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -18,20 +19,19 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonPiano.Type;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.block.NoteBlock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.state.properties.NoteBlockInstrument;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.NoteBlock;
|
||||
import net.minecraft.world.level.block.state.properties.NoteBlockInstrument;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -59,117 +59,117 @@ public class ContentNoteEditor extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
BlockPos pos = this.builderNoteEditor.getBlockPos();
|
||||
SoundEvent sound = this.getSoundEvent(pos.below());
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(1));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(3));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(5));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(6));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(8));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(10));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(11));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(13));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(15));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(17));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(18));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(20));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(22));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(23));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, new StringTextComponent("F#"), sound, 0.5F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, new TextComponent("F#"), sound, 0.5F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(0));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, new StringTextComponent("G#"), sound, 0.56F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, new TextComponent("G#"), sound, 0.56F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(2));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, new StringTextComponent("A#"), sound, 0.63F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, new TextComponent("A#"), sound, 0.63F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(4));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, new StringTextComponent("C#"), sound, 0.75F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, new TextComponent("C#"), sound, 0.75F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(7));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, new StringTextComponent("D#"), sound, 0.85F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, new TextComponent("D#"), sound, 0.85F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(9));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, new StringTextComponent("F#"), sound, 1.0F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, new TextComponent("F#"), sound, 1.0F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(12));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, new StringTextComponent("G#"), sound, 1.1F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, new TextComponent("G#"), sound, 1.1F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(14));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, new StringTextComponent("A#"), sound, 1.25F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, new TextComponent("A#"), sound, 1.25F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(16));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, new StringTextComponent("C#"), sound, 1.5F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, new TextComponent("C#"), sound, 1.5F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(19));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, new StringTextComponent("D#"), sound, 1.7F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, new TextComponent("D#"), sound, 1.7F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(21));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, new StringTextComponent("F#"), sound, 2.0F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, new TextComponent("F#"), sound, 2.0F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderNoteEditor.build(24));
|
||||
}));
|
||||
@@ -177,12 +177,12 @@ public class ContentNoteEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getInstance().getTextureManager().bind(NOTE);
|
||||
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);
|
||||
@@ -197,26 +197,29 @@ public class ContentNoteEditor extends Content
|
||||
{
|
||||
float scale = 4;
|
||||
|
||||
matrix.pushPose();
|
||||
matrix.translate(container.width / 2 - 8 * scale, container.height / 2 - 15 - 8 * scale, 0);
|
||||
matrix.scale(scale, scale, scale);
|
||||
|
||||
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Blocks.NOTE_BLOCK), 0, 0);
|
||||
matrix.popPose();
|
||||
PoseStack posestack = RenderSystem.getModelViewStack();
|
||||
posestack.pushPose();
|
||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
posestack.scale(scale, scale, scale);
|
||||
|
||||
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().font;
|
||||
fontRenderer.draw(matrix, text, x + 116 - fontRenderer.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(new ItemStack(Items.NOTE_BLOCK), 0, 0);
|
||||
|
||||
posestack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
TranslatableComponent text = new TranslatableComponent("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||
Font font = Minecraft.getInstance().font;
|
||||
font.draw(matrix, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
}
|
||||
}
|
||||
|
||||
private SoundEvent getSoundEvent(BlockPos blockPos)
|
||||
{
|
||||
World world = Minecraft.getInstance().level;
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
if(world != null)
|
||||
if(level != null)
|
||||
{
|
||||
return NoteBlockInstrument.byState(world.getBlockState(blockPos)).getSoundEvent();
|
||||
return NoteBlockInstrument.byState(level.getBlockState(blockPos)).getSoundEvent();
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -229,15 +232,15 @@ public class ContentNoteEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.note_block_editor");
|
||||
return new TranslatableComponent("gui.worldhandler.title.blocks.note_block_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.note_block_editor");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.blocks.note_block_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderGeneric;
|
||||
@@ -16,16 +16,15 @@ import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -81,25 +80,25 @@ public class ContentPlayer extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.start"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.score"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.score"), () ->
|
||||
{
|
||||
this.page = Page.SCORE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.position"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.position"), () ->
|
||||
{
|
||||
this.page = Page.POSITION;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
{
|
||||
this.page = Page.MISC;
|
||||
container.init();
|
||||
@@ -117,9 +116,9 @@ public class ContentPlayer extends Content
|
||||
{
|
||||
button3.active = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
{
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
@@ -132,19 +131,19 @@ public class ContentPlayer extends Content
|
||||
{
|
||||
button4.active = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSpawnpoint));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderSetworldspawn));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.kill").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.miscellaneous.kill").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderKill));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").withStyle(TextFormatting.RED), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").withStyle(ChatFormatting.RED), () ->
|
||||
{
|
||||
ActionHelper.open(Contents.CONTINUE.withBuilder(this.builderClear));
|
||||
}));
|
||||
@@ -154,7 +153,7 @@ public class ContentPlayer extends Content
|
||||
@Override
|
||||
public void tick(Container container)
|
||||
{
|
||||
PlayerEntity player = Minecraft.getInstance().player;
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
||||
if(player != null)
|
||||
{
|
||||
@@ -170,7 +169,7 @@ public class ContentPlayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page) && Minecraft.getInstance().player != null)
|
||||
{
|
||||
@@ -178,10 +177,10 @@ public class ContentPlayer extends Content
|
||||
int yPos = y + 82;
|
||||
int playerNameWidth = Minecraft.getInstance().font.width(Minecraft.getInstance().player.getName()) / 2;
|
||||
|
||||
AbstractGui.fill(matrix, container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
||||
GuiComponent.fill(matrix, container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
||||
Minecraft.getInstance().font.draw(matrix, Minecraft.getInstance().player.getName(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
||||
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
InventoryScreen.renderEntityInInventory(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
@@ -213,15 +212,15 @@ public class ContentPlayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.player");
|
||||
return new TranslatableComponent("gui.worldhandler.title.player.player");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.player");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.player.player");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,11 +18,11 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -49,7 +49,7 @@ public class ContentPotions extends ContentChild
|
||||
this.builderPotion.setAmplifier((byte) Config.getSliders().getMaxPotionAmplifier());
|
||||
}
|
||||
|
||||
for(Effect potion : this.builderPotionItem.getEffects())
|
||||
for(MobEffect potion : this.builderPotionItem.getMobEffects())
|
||||
{
|
||||
byte amplifier = this.builderPotionItem.getAmplifier(potion);
|
||||
|
||||
@@ -63,29 +63,29 @@ public class ContentPotions extends ContentChild
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
MenuPageList<Effect> potions = new MenuPageList<Effect>(x, y, new ArrayList<Effect>(ForgeRegistries.POTIONS.getValues()), 114, 20, 3, container, new ILogicPageList<Effect>()
|
||||
MenuPageList<MobEffect> potions = new MenuPageList<MobEffect>(x, y, new ArrayList<MobEffect>(ForgeRegistries.POTIONS.getValues()), 114, 20, 3, container, new ILogicPageList<MobEffect>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Effect item)
|
||||
public MutableComponent translate(MobEffect item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Effect item)
|
||||
public MutableComponent toTooltip(MobEffect item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(Effect item)
|
||||
public void onClick(MobEffect item)
|
||||
{
|
||||
ContentPotions.this.builderPotion.setEffect(item);
|
||||
ContentPotions.this.builderPotion.setMobEffect(item);
|
||||
container.initButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Effect item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, MobEffect item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -109,21 +109,21 @@ public class ContentPotions extends ContentChild
|
||||
GuiButtonBase button4;
|
||||
GuiButtonBase button5;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.potionPage == 0)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.give"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 12, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.give"), () ->
|
||||
{
|
||||
this.next(container);
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.buildRemove());
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.buildClear());
|
||||
container.init();
|
||||
@@ -131,20 +131,20 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
else if(this.potionPage == 1)
|
||||
{
|
||||
Effect potion = this.builderPotion.getEffectAsPotion();
|
||||
MobEffect potion = this.builderPotion.getMobEffectAsPotion();
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.ambient", this.builderPotionItem.getAmbient(potion) ? new TranslationTextComponent("gui.worldhandler.generic.on") : new TranslationTextComponent("gui.worldhandler.generic.off")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.ambient", this.builderPotionItem.getAmbient(potion) ? new TranslatableComponent("gui.worldhandler.generic.on") : new TranslatableComponent("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
this.builderPotionItem.setAmbient(potion, !this.builderPotionItem.getAmbient(potion));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.particles", this.builderPotion.getHideParticles() ? new TranslationTextComponent("gui.worldhandler.generic.off") : new TranslationTextComponent("gui.worldhandler.generic.on")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.particles", this.builderPotion.getHideParticles() ? new TranslatableComponent("gui.worldhandler.generic.off") : new TranslatableComponent("gui.worldhandler.generic.on")), () ->
|
||||
{
|
||||
this.builderPotion.setHideParticles(!this.builderPotion.getHideParticles());
|
||||
this.builderPotionItem.setShowParticles(potion, !this.builderPotionItem.getShowParticles(potion));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslationTextComponent("gui.worldhandler.potions.effect.amplifier"), value ->
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslatableComponent("gui.worldhandler.potions.effect.amplifier"), value ->
|
||||
{
|
||||
this.builderPotion.setAmplifier(value.byteValue());
|
||||
this.builderPotionItem.setAmplifier(potion, value.byteValue());
|
||||
@@ -152,19 +152,19 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
else if(this.potionPage == 2)
|
||||
{
|
||||
Effect potion = this.builderPotion.getEffectAsPotion();
|
||||
MobEffect potion = this.builderPotion.getMobEffectAsPotion();
|
||||
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + potion.getRegistryName(), new TranslationTextComponent("gui.worldhandler.potion.time.seconds"), value ->
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + potion.getRegistryName(), new TranslatableComponent("gui.worldhandler.potion.time.seconds"), value ->
|
||||
{
|
||||
this.builderPotion.setSeconds(value.intValue());
|
||||
this.builderPotionItem.setSeconds(potion, value.intValue());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + potion.getRegistryName(), new TranslationTextComponent("gui.worldhandler.potion.time.minutes"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, 59, 0, container, new LogicSliderSimple("m" + potion.getRegistryName(), new TranslatableComponent("gui.worldhandler.potion.time.minutes"), value ->
|
||||
{
|
||||
this.builderPotion.setMinutes(value.intValue());
|
||||
this.builderPotionItem.setMinutes(potion, value.intValue());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + potion.getRegistryName(), new TranslationTextComponent("gui.worldhandler.potion.time.hours"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 48, 114, 20, 0, 99, 0, container, new LogicSliderSimple("h" + potion.getRegistryName(), new TranslatableComponent("gui.worldhandler.potion.time.hours"), value ->
|
||||
{
|
||||
this.builderPotion.setHours(value.intValue());
|
||||
this.builderPotionItem.setHours(potion, value.intValue());
|
||||
@@ -172,31 +172,31 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
else if(this.potionPage == 3)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotion.buildGive());
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.tipped_arrow"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, new TranslatableComponent("gui.worldhandler.potions.effect.tipped_arrow"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.build(Items.TIPPED_ARROW));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.bottle"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, new TranslatableComponent("gui.worldhandler.potions.effect.bottle"), new TranslatableComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.build(Items.POTION));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.splash"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, new TranslatableComponent("gui.worldhandler.potions.effect.splash"), new TranslatableComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.build(Items.SPLASH_POTION));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.lingering"), new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, new TranslatableComponent("gui.worldhandler.potions.effect.lingering"), new TranslatableComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPotionItem.build(Items.LINGERING_POTION));
|
||||
this.potionPage = 0;
|
||||
@@ -235,9 +235,9 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.potions");
|
||||
return new TranslatableComponent("gui.worldhandler.title.potions");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,11 +19,11 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -41,39 +41,39 @@ public class ContentRecipes extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
List<IRecipe<?>> recipes = Minecraft.getInstance().player.getRecipeBook().getCollections().stream()
|
||||
List<Recipe<?>> recipes = Minecraft.getInstance().player.getRecipeBook().getCollections().stream()
|
||||
.flatMap(recipe -> recipe.getRecipes().stream())
|
||||
.filter(recipe -> !recipe.isSpecial())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
MenuPageList<IRecipe<?>> list = new MenuPageList<IRecipe<?>>(x, y, recipes, 114, 20, 3, container, new ILogicPageList<IRecipe<?>>()
|
||||
MenuPageList<Recipe<?>> list = new MenuPageList<Recipe<?>>(x, y, recipes, 114, 20, 3, container, new ILogicPageList<Recipe<?>>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(IRecipe<?> item)
|
||||
public MutableComponent translate(Recipe<?> item)
|
||||
{
|
||||
if(!item.getResultItem().equals(ItemStack.EMPTY))
|
||||
{
|
||||
return (IFormattableTextComponent) item.getResultItem().getHoverName();
|
||||
return (MutableComponent) item.getResultItem().getHoverName();
|
||||
}
|
||||
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
return new TextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(IRecipe<?> item)
|
||||
public MutableComponent toTooltip(Recipe<?> item)
|
||||
{
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
return new TextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(IRecipe<?> item)
|
||||
public void onClick(Recipe<?> item)
|
||||
{
|
||||
ContentRecipes.this.builderRecipe.setRecipe(item);
|
||||
container.initButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, IRecipe<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Recipe<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -91,15 +91,15 @@ public class ContentRecipes extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.give"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.recipes.give"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe.build(EnumMode.GIVE));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.take"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.recipes.take"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderRecipe.build(EnumMode.TAKE));
|
||||
container.initButtons();
|
||||
@@ -113,15 +113,15 @@ public class ContentRecipes extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.recipes");
|
||||
return new TranslatableComponent("gui.worldhandler.title.items.recipes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.recipes");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.items.recipes");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,8 +4,8 @@ import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.util.ScoreboardHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -15,17 +15,17 @@ public abstract class ContentScoreboard extends Content
|
||||
protected static final ScoreboardHelper HELPER = new ScoreboardHelper();
|
||||
private static String objective;
|
||||
|
||||
protected static boolean isObjectiveValid()
|
||||
protected boolean isObjectiveValid()
|
||||
{
|
||||
return ContentScoreboard.objective != null && ContentScoreboard.objective.length() > 0;
|
||||
}
|
||||
|
||||
protected static void setObjective(String objective)
|
||||
protected void setObjective(String objective)
|
||||
{
|
||||
ContentScoreboard.objective = objective;
|
||||
}
|
||||
|
||||
protected static String getObjective()
|
||||
protected String getObjective()
|
||||
{
|
||||
return ContentScoreboard.objective;
|
||||
}
|
||||
@@ -37,8 +37,8 @@ public abstract class ContentScoreboard extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.scoreboard");
|
||||
return new TranslatableComponent("gui.worldhandler.title.scoreboard");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderScoreboardObjectives;
|
||||
@@ -21,14 +21,14 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RegistryHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.stats.StatType;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -51,13 +51,13 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField.setFilter(Predicates.notNull());
|
||||
this.objectField.setValue(ContentScoreboard.getObjective());
|
||||
this.objectField.setValue(this.getObjective());
|
||||
this.objectField.setResponder(text ->
|
||||
{
|
||||
ContentScoreboard.setObjective(text);
|
||||
this.builderObjectives.setObjective(ContentScoreboard.getObjective());
|
||||
this.setObjective(text);
|
||||
this.builderObjectives.setObjective(this.getObjective());
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
MenuButtonList objectives = new MenuButtonList(x + 118, y + 24, HELPER.getObjectives(), 2, new ILogicButtonList()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
public MutableComponent translate(String key, int depth)
|
||||
{
|
||||
ResourceLocation resource = this.makeResourceLocation(key);
|
||||
|
||||
@@ -78,25 +78,25 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
{
|
||||
if(type.equals(Stats.CUSTOM))
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.custom");
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.objectives.stat.custom");
|
||||
}
|
||||
else if(type.equals(Stats.ENTITY_KILLED))
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.killed");
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.objectives.stat.killed");
|
||||
}
|
||||
else if(type.equals(Stats.ENTITY_KILLED_BY))
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.killed_by");
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.objectives.stat.killed_by");
|
||||
}
|
||||
|
||||
return new TranslationTextComponent(type.getTranslationKey());
|
||||
return new TranslatableComponent(type.getTranslationKey());
|
||||
}
|
||||
|
||||
String translation = RegistryHelper.translate(resource);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
return new TranslationTextComponent(translation);
|
||||
return new TranslatableComponent(translation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,15 +104,15 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
|
||||
if(!translation.equals(I18n.get(translation)))
|
||||
{
|
||||
return new TranslationTextComponent(translation);
|
||||
return new TranslatableComponent(translation);
|
||||
}
|
||||
|
||||
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getName).anyMatch(Predicates.equalTo(key)))
|
||||
if(Arrays.stream(ChatFormatting.values()).map(ChatFormatting::getName).anyMatch(Predicates.equalTo(key)))
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.objectives.stat." + key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,18 +174,18 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
MenuButtonList slots = new MenuButtonList(x + 118, y + 24 - this.page.getShift(), HELPER.getSlots(), 2, new ILogicButtonList()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
public MutableComponent translate(String key, int depth)
|
||||
{
|
||||
if(depth == 0)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.slot." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.slot." + key);
|
||||
}
|
||||
else if(depth == 1)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return new StringTextComponent(key);
|
||||
return new TextComponent(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,25 +213,25 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
{
|
||||
this.page = Page.CREATE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
{
|
||||
this.page = Page.DISPLAY;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
{
|
||||
this.page = Page.UNDISPLAY;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
{
|
||||
this.page = Page.REMOVE;
|
||||
container.init();
|
||||
@@ -254,15 +254,15 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
if(!Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
container.add(this.objectField);
|
||||
this.builderObjectives.setObjective(ContentScoreboard.getObjective());
|
||||
this.builderObjectives.setObjective(this.getObjective());
|
||||
}
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderObjectives);
|
||||
container.init();
|
||||
}));
|
||||
button1.active = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid();
|
||||
button1.active = Page.UNDISPLAY.equals(this.page) || this.isObjectiveValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -275,7 +275,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
@@ -284,9 +284,9 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.objectives");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.scoreboard.objectives");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderMultiCommand;
|
||||
@@ -20,8 +20,8 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -79,18 +79,18 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField.setFilter(Predicates.notNull());
|
||||
this.objectField.setValue(ContentScoreboard.getObjective());
|
||||
this.objectField.setValue(this.getObjective());
|
||||
this.objectField.setResponder(text ->
|
||||
{
|
||||
ContentScoreboard.setObjective(text);
|
||||
this.builderPlayers.setObjective(ContentScoreboard.getObjective());
|
||||
this.builderTrigger.setObjective(ContentScoreboard.getObjective());
|
||||
this.setObjective(text);
|
||||
this.builderPlayers.setObjective(this.getObjective());
|
||||
this.builderTrigger.setObjective(this.getObjective());
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.tag"));
|
||||
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.players.tag"));
|
||||
this.tagField.setFilter(string -> string != null && !string.contains(" "));
|
||||
this.tagField.setValue(this.tag);
|
||||
this.tagField.setResponder(text ->
|
||||
@@ -108,20 +108,20 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
GuiButtonBase button2;
|
||||
GuiButtonBase button3;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y + 12, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
{
|
||||
this.page = Page.ADD_SET_REMOVE;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
{
|
||||
this.page = Page.TAG;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
{
|
||||
this.page = Page.ENABLE;
|
||||
container.init();
|
||||
@@ -131,26 +131,26 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
button2.active = !Page.TAG.equals(this.page);
|
||||
button3.active = !Page.ENABLE.equals(this.page);
|
||||
|
||||
boolean enabled = ContentScoreboard.isObjectiveValid();
|
||||
boolean enabled = this.isObjectiveValid();
|
||||
this.builderPlayers.setMode(this.page.getMode());
|
||||
|
||||
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", new TranslationTextComponent("gui.worldhandler.scoreboard.players.points"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxPlayerPoints(), 0, container, new LogicSliderSimple("points", new TranslatableComponent("gui.worldhandler.scoreboard.players.points"), value ->
|
||||
{
|
||||
this.builderPlayers.setPoints(value);
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslatableComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.buildPoints(EnumMode.ADD));
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslatableComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.buildPoints(EnumMode.REMOVE));
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset"), new TranslationTextComponent("gui.worldhandler.actions.set_to_0"), () ->
|
||||
container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.actions.reset"), new TranslatableComponent("gui.worldhandler.actions.set_to_0"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.buildPoints(EnumMode.SET, 0));
|
||||
container.init();
|
||||
@@ -164,12 +164,12 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
else if(Page.TAG.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTag.build(BuilderTag.EnumMode.ADD));
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTag.build(BuilderTag.EnumMode.REMOVE));
|
||||
container.init();
|
||||
@@ -182,21 +182,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", new TranslationTextComponent("gui.worldhandler.generic.value"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxTriggerValue(), 0, container, new LogicSliderSimple("enable", new TranslatableComponent("gui.worldhandler.generic.value"), value ->
|
||||
{
|
||||
this.builderTrigger.setValue(value.intValue());
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslatableComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.build(BuilderTrigger.EnumMode.ADD));
|
||||
container.init();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslatableComponent("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTrigger.build(BuilderTrigger.EnumMode.SET));
|
||||
container.init();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderPlayers.buildEnable());
|
||||
container.init();
|
||||
@@ -214,8 +214,8 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
else
|
||||
{
|
||||
container.add(this.objectField);
|
||||
this.builderPlayers.setObjective(ContentScoreboard.getObjective());
|
||||
this.builderTrigger.setObjective(ContentScoreboard.getObjective());
|
||||
this.builderPlayers.setObjective(this.getObjective());
|
||||
this.builderTrigger.setObjective(this.getObjective());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
else
|
||||
{
|
||||
boolean enabled = ContentScoreboard.isObjectiveValid();
|
||||
boolean enabled = this.isObjectiveValid();
|
||||
|
||||
if(Page.ADD_SET_REMOVE.equals(this.page))
|
||||
{
|
||||
@@ -248,7 +248,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.TAG.equals(this.page))
|
||||
{
|
||||
@@ -261,9 +261,9 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.players");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.scoreboard.players");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderTeams;
|
||||
@@ -18,11 +18,11 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.teamField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.team"));
|
||||
this.teamField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.team"));
|
||||
this.teamField.setFilter(Predicates.notNull());
|
||||
this.teamField.setValue(this.team);
|
||||
this.teamField.setResponder(text ->
|
||||
@@ -60,23 +60,23 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
MenuButtonList options = new MenuButtonList(x + 118, y + 24, HELPER.getOptions(), 2, new ILogicButtonList()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
public MutableComponent translate(String key, int depth)
|
||||
{
|
||||
if(depth == 0)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.team.options." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.team.options." + key);
|
||||
}
|
||||
else if(depth == 1)
|
||||
{
|
||||
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getName).anyMatch(Predicates.equalTo(key)))
|
||||
if(Arrays.stream(ChatFormatting.values()).map(ChatFormatting::getName).anyMatch(Predicates.equalTo(key)))
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.team.suboption." + key);
|
||||
return new TranslatableComponent("gui.worldhandler.scoreboard.team.suboption." + key);
|
||||
}
|
||||
|
||||
return new StringTextComponent(key);
|
||||
return new TextComponent(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -117,25 +117,25 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
{
|
||||
this.page = Page.ADD;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new StringTextComponent(I18n.get("gui.worldhandler.scoreboard.team.join") + " / " + I18n.get("gui.worldhandler.scoreboard.team.leave")), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TextComponent(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, new StringTextComponent(I18n.get("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.get("gui.worldhandler.scoreboard.team.empty")), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TextComponent(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, new TranslationTextComponent("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
{
|
||||
this.page = Page.OPTION;
|
||||
container.init();
|
||||
@@ -158,12 +158,12 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
{
|
||||
this.builderTeams.setPlayer(container.getPlayer());
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.build(EnumMode.JOIN));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.build(EnumMode.LEAVE));
|
||||
container.initButtons();
|
||||
@@ -173,12 +173,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, new TranslationTextComponent("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.build(EnumMode.REMOVE));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams.build(EnumMode.EMPTY));
|
||||
container.initButtons();
|
||||
@@ -190,7 +190,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, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslatableComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderTeams);
|
||||
container.initButtons();
|
||||
@@ -208,15 +208,15 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
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 IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.teams");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.scoreboard.teams");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
@@ -18,8 +18,8 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonTooltip;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -55,13 +55,13 @@ public class ContentSettings extends ContentChild
|
||||
MenuPageList<Setting<?>> settings = new MenuPageList<Setting<?>>(x, y, SETTINGS, 114, 20, 3, container, new ILogicPageList<Setting<?>>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Setting<?> item)
|
||||
public MutableComponent translate(Setting<?> item)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.config.settings." + item.getKey());
|
||||
return new TranslatableComponent("gui.worldhandler.config.settings." + item.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Setting<?> item)
|
||||
public MutableComponent toTooltip(Setting<?> item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Setting<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Setting<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public class ContentSettings extends ContentChild
|
||||
|
||||
container.add(settings);
|
||||
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField.setFilter(string ->
|
||||
{
|
||||
if(string == null)
|
||||
@@ -118,19 +118,19 @@ public class ContentSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("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, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
setting.set(true);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
setting.set(false);
|
||||
container.init();
|
||||
@@ -147,7 +147,7 @@ public class ContentSettings extends ContentChild
|
||||
this.valueField.setValue(String.valueOf(setting.get()));
|
||||
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
String text = this.valueField.getValue();
|
||||
|
||||
@@ -175,7 +175,7 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.setting instanceof IntegerSetting)
|
||||
{
|
||||
@@ -184,9 +184,9 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.settings");
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.settings");
|
||||
}
|
||||
|
||||
public abstract static class Setting<T>
|
||||
|
||||
@@ -2,7 +2,8 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderSignEditor;
|
||||
@@ -20,14 +21,13 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.BlockHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import net.minecraft.block.AbstractSignBlock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.SignBlock;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class ContentSignEditor extends Content
|
||||
@Override
|
||||
public void init(Container container)
|
||||
{
|
||||
this.isActive = BlockHelper.getFocusedBlock() instanceof AbstractSignBlock;
|
||||
this.isActive = BlockHelper.getFocusedBlock() instanceof SignBlock;
|
||||
this.builderSignEditor.setPosition(BlockHelper.getFocusedBlockPos());
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ContentSignEditor extends Content
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.commmand"));
|
||||
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.commmand"));
|
||||
this.commandField.setFilter(Predicates.notNull());
|
||||
this.commandField.setValue(this.builderSignEditor.getCommand(this.selectedLine));
|
||||
this.commandField.moveCursorToEnd();
|
||||
@@ -104,27 +104,27 @@ public class ContentSignEditor extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
{
|
||||
this.selectedLine = 0;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
{
|
||||
this.selectedLine = 1;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
{
|
||||
this.selectedLine = 2;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
{
|
||||
this.selectedLine = 3;
|
||||
container.init();
|
||||
@@ -132,13 +132,13 @@ public class ContentSignEditor extends Content
|
||||
|
||||
if(this.editColor)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.done"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.generic.done"), () -> this.toggleEditColor(container)));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslatableComponent("gui.worldhandler.actions.place_command_block"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(container.getPlayer(), this.builderSignEditor, this.builderSignEditor.isSpecial());
|
||||
}));
|
||||
@@ -167,7 +167,7 @@ public class ContentSignEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
@@ -180,16 +180,19 @@ public class ContentSignEditor extends Content
|
||||
{
|
||||
float scale = 4;
|
||||
|
||||
matrix.pushPose();
|
||||
matrix.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
matrix.scale(scale, scale, scale);
|
||||
PoseStack posestack = RenderSystem.getModelViewStack();
|
||||
posestack.pushPose();
|
||||
posestack.translate(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
posestack.scale(scale, scale, scale);
|
||||
|
||||
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
matrix.popPose();
|
||||
Minecraft.getInstance().getItemRenderer().renderGuiItem(new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
|
||||
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().font;
|
||||
fontRenderer.draw(matrix, text, x + 116 - fontRenderer.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
posestack.popPose();
|
||||
RenderSystem.applyModelViewMatrix();
|
||||
|
||||
TranslatableComponent text = new TranslatableComponent("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getTranslatedKeyMessage());
|
||||
Font font = Minecraft.getInstance().font;
|
||||
font.draw(matrix, text, x + 116 - font.width(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,15 +203,15 @@ public class ContentSignEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.sign_editor");
|
||||
return new TranslatableComponent("gui.worldhandler.title.blocks.sign_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.sign_editor");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.blocks.sign_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,7 +6,8 @@ import java.util.stream.Collectors;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentAttribute;
|
||||
@@ -32,26 +33,27 @@ import exopandora.worldhandler.gui.widget.button.LogicSliderSimple;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraft.potion.Effects;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.effect.MobEffect;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.world.item.Items;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ContentSummon extends Content
|
||||
{
|
||||
private static final ResourceLocation BEACON_LOCATION = new ResourceLocation("textures/gui/container/beacon.png");
|
||||
|
||||
private GuiTextFieldTooltip mobField;
|
||||
private GuiTextFieldTooltip nbtField;
|
||||
|
||||
@@ -136,7 +138,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
}
|
||||
|
||||
for(Effect potion : this.builderSummon.getEffects())
|
||||
for(MobEffect potion : this.builderSummon.getMobEffects())
|
||||
{
|
||||
byte amplifier = this.builderSummon.getAmplifier(potion);
|
||||
|
||||
@@ -157,7 +159,7 @@ public class ContentSummon extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.mobField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.mob_id"));
|
||||
this.mobField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslatableComponent("gui.worldhandler.entities.summon.start.mob_id"));
|
||||
this.mobField.setFilter(Predicates.notNull());
|
||||
this.mobField.setValue(this.mob);
|
||||
this.mobField.setResponder(text ->
|
||||
@@ -167,7 +169,7 @@ public class ContentSummon extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.nbtField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.custom_nbt"));
|
||||
this.nbtField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.entities.summon.start.custom_nbt"));
|
||||
this.nbtField.setFilter(Predicates.notNull());
|
||||
this.nbtField.setValue(this.nbt);
|
||||
this.nbtField.setResponder(text ->
|
||||
@@ -207,15 +209,15 @@ public class ContentSummon extends Content
|
||||
MenuPageList<Attribute> attributes = new MenuPageList<Attribute>(x + 118, y, ComponentAttribute.ATTRIBUTES, 114, 20, 3, container, new ILogicPageList<Attribute>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Attribute item)
|
||||
public MutableComponent translate(Attribute item)
|
||||
{
|
||||
return new TranslationTextComponent(item.getDescriptionId());
|
||||
return new TranslatableComponent(item.getDescriptionId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Attribute item)
|
||||
public MutableComponent toTooltip(Attribute item)
|
||||
{
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
return new TextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -225,7 +227,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Attribute item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, Attribute item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiSlider(x, y, width, height, -Config.getSliders().getMaxSummonAttributes(), Config.getSliders().getMaxSummonAttributes(), 0, container, new LogicSliderAttribute(item, text, value ->
|
||||
{
|
||||
@@ -314,9 +316,9 @@ public class ContentSummon extends Content
|
||||
|
||||
for(ResourceLocation location : this.sortedPotions())
|
||||
{
|
||||
Effect potion = ForgeRegistries.POTIONS.getValue(location);
|
||||
MobEffect potion = ForgeRegistries.POTIONS.getValue(location);
|
||||
|
||||
if(!potion.equals(Effects.HARM) && !potion.equals(Effects.HEAL))
|
||||
if(!potion.equals(MobEffects.HARM) && !potion.equals(MobEffects.HEAL))
|
||||
{
|
||||
if(this.potionPage == 0)
|
||||
{
|
||||
@@ -330,15 +332,15 @@ public class ContentSummon extends Content
|
||||
|
||||
if(count == this.potionPage)
|
||||
{
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslationTextComponent(potion.getDescriptionId()), value ->
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslatableComponent(potion.getDescriptionId()), value ->
|
||||
{
|
||||
this.builderSummon.setAmplifier(potion, value.byteValue());
|
||||
})));
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + potion.getRegistryName(), new TranslationTextComponent("gui.worldhandler.potion.time.minutes"), value ->
|
||||
container.add(new GuiSlider(x + 118, y + 24, 114, 20, 0, Config.getSliders().getMaxSummonPotionMinutes(), 0, container, new LogicSliderSimple("duration" + potion.getRegistryName(), new TranslatableComponent("gui.worldhandler.potion.time.minutes"), value ->
|
||||
{
|
||||
this.builderSummon.setMinutes(potion, value);
|
||||
})));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.particles", this.builderSummon.getShowParticles(potion) ? new TranslationTextComponent("gui.worldhandler.generic.on") : new TranslationTextComponent("gui.worldhandler.generic.off")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslatableComponent("gui.worldhandler.potions.effect.particles", this.builderSummon.getShowParticles(potion) ? new TranslatableComponent("gui.worldhandler.generic.on") : new TranslatableComponent("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
this.builderSummon.setShowParticles(potion, !this.builderSummon.getShowParticles(potion));
|
||||
container.init();
|
||||
@@ -417,7 +419,7 @@ public class ContentSummon extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
@@ -433,8 +435,8 @@ public class ContentSummon extends Content
|
||||
}
|
||||
else if(Page.EQUIPMENT.equals(this.page))
|
||||
{
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getInstance().getTextureManager().bind(new ResourceLocation("textures/gui/container/beacon.png"));
|
||||
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++)
|
||||
@@ -481,15 +483,15 @@ public class ContentSummon extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.entities.summon");
|
||||
return new TranslatableComponent("gui.worldhandler.title.entities.summon");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.entities.summon");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.entities.summon");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
@@ -25,25 +25,25 @@ import exopandora.worldhandler.usercontent.UsercontentConfig;
|
||||
import exopandora.worldhandler.usercontent.VisibleActiveObject;
|
||||
import exopandora.worldhandler.usercontent.VisibleObject;
|
||||
import exopandora.worldhandler.usercontent.factory.ActionHandlerFactory;
|
||||
import exopandora.worldhandler.usercontent.factory.WidgetFactory;
|
||||
import exopandora.worldhandler.usercontent.factory.MenuFactory;
|
||||
import exopandora.worldhandler.usercontent.model.JsonWidget;
|
||||
import exopandora.worldhandler.usercontent.factory.WidgetFactory;
|
||||
import exopandora.worldhandler.usercontent.model.AbstractJsonWidget;
|
||||
import exopandora.worldhandler.usercontent.model.JsonCommand;
|
||||
import exopandora.worldhandler.usercontent.model.JsonLabel;
|
||||
import exopandora.worldhandler.usercontent.model.JsonMenu;
|
||||
import exopandora.worldhandler.usercontent.model.JsonModel;
|
||||
import exopandora.worldhandler.usercontent.model.JsonLabel;
|
||||
import exopandora.worldhandler.usercontent.model.JsonUsercontent;
|
||||
import exopandora.worldhandler.usercontent.model.AbstractJsonWidget;
|
||||
import exopandora.worldhandler.usercontent.model.JsonWidget;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.client.gui.components.AbstractWidget;
|
||||
import net.minecraft.client.gui.components.EditBox;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -54,8 +54,8 @@ public class ContentUsercontent extends Content
|
||||
private final JsonUsercontent content;
|
||||
private final ScriptEngineAdapter engineAdapter;
|
||||
private final List<VisibleObject<BuilderUsercontent>> builders;
|
||||
private final Map<String, VisibleActiveObject<TextFieldWidget>> textfields = new HashMap<String, VisibleActiveObject<TextFieldWidget>>();
|
||||
private final List<VisibleActiveObject<Widget>> buttons = new ArrayList<VisibleActiveObject<Widget>>();
|
||||
private final Map<String, VisibleActiveObject<EditBox>> textfields = new HashMap<String, VisibleActiveObject<EditBox>>();
|
||||
private final List<VisibleActiveObject<AbstractWidget>> buttons = new ArrayList<VisibleActiveObject<AbstractWidget>>();
|
||||
private final UsercontentAPI api;
|
||||
private final WidgetFactory buttonFactory;
|
||||
private final MenuFactory menuFactory;
|
||||
@@ -93,16 +93,16 @@ public class ContentUsercontent extends Content
|
||||
|
||||
for(JsonWidget json : this.getWidgets(this.content.getGui().getWidgets(), AbstractJsonWidget.Type.BUTTON))
|
||||
{
|
||||
Widget widget = this.buttonFactory.createWidget(json, this, container, x, y);
|
||||
AbstractWidget widget = this.buttonFactory.createWidget(json, this, container, x, y);
|
||||
|
||||
if(JsonWidget.Type.TEXTFIELD.equals(json.getType()))
|
||||
{
|
||||
VisibleActiveObject<TextFieldWidget> visObj = new VisibleActiveObject<TextFieldWidget>(json, (TextFieldWidget) widget);
|
||||
VisibleActiveObject<EditBox> visObj = new VisibleActiveObject<EditBox>(json, (EditBox) widget);
|
||||
this.textfields.put(json.getAttributes().getId(), visObj);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buttons.add(new VisibleActiveObject<Widget>(json, widget));
|
||||
this.buttons.add(new VisibleActiveObject<AbstractWidget>(json, widget));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class ContentUsercontent extends Content
|
||||
@Override
|
||||
public void tick(Container container)
|
||||
{
|
||||
for(VisibleObject<TextFieldWidget> textfield : this.textfields.values())
|
||||
for(VisibleObject<EditBox> textfield : this.textfields.values())
|
||||
{
|
||||
if(textfield.isVisible(this.engineAdapter))
|
||||
{
|
||||
@@ -137,9 +137,9 @@ public class ContentUsercontent extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
for(VisibleObject<TextFieldWidget> textfield : this.textfields.values())
|
||||
for(VisibleObject<EditBox> textfield : this.textfields.values())
|
||||
{
|
||||
if(textfield.getObject().visible)
|
||||
{
|
||||
@@ -166,13 +166,13 @@ public class ContentUsercontent extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return TextUtils.formatNonnull(this.content.getGui().getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return TextUtils.formatNonnull(this.content.getGui().getTab().getTitle());
|
||||
}
|
||||
@@ -256,13 +256,13 @@ public class ContentUsercontent extends Content
|
||||
|
||||
private void printError(String type, int index, Throwable e)
|
||||
{
|
||||
ITextComponent message = new StringTextComponent(TextFormatting.RED + "<" + Main.NAME + ":" + this.id + ":" + type + ":" + index + "> " + e.getMessage());
|
||||
Component message = new TextComponent(ChatFormatting.RED + "<" + Main.NAME + ":" + this.id + ":" + type + ":" + index + "> " + e.getMessage());
|
||||
Minecraft.getInstance().gui.handleChat(ChatType.CHAT, message, Util.NIL_UUID);
|
||||
}
|
||||
|
||||
private void updateTextfields()
|
||||
{
|
||||
for(VisibleActiveObject<TextFieldWidget> visObj : this.textfields.values())
|
||||
for(VisibleActiveObject<EditBox> visObj : this.textfields.values())
|
||||
{
|
||||
visObj.getObject().setEditable(visObj.isEnabled(this.engineAdapter));
|
||||
visObj.getObject().setVisible(visObj.isVisible(this.engineAdapter));
|
||||
@@ -271,7 +271,7 @@ public class ContentUsercontent extends Content
|
||||
|
||||
private void updateButtons()
|
||||
{
|
||||
for(VisibleActiveObject<Widget> visObj : this.buttons)
|
||||
for(VisibleActiveObject<AbstractWidget> visObj : this.buttons)
|
||||
{
|
||||
visObj.getObject().active = visObj.isEnabled(this.engineAdapter);
|
||||
visObj.getObject().visible = visObj.isVisible(this.engineAdapter);
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
@@ -14,11 +14,11 @@ import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraft.client.server.IntegratedServer;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -40,17 +40,17 @@ public class ContentWorldInfo extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
World world = ContentWorldInfo.getSidedWorld();
|
||||
Level level = ContentWorldInfo.getSidedWorld();
|
||||
IntegratedServer server = Minecraft.getInstance().getSingleplayerServer();
|
||||
|
||||
this.posXField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
||||
this.posXField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(world, object -> object.getLevelData().getXSpawn()));
|
||||
this.posXField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(level, object -> object.getLevelData().getXSpawn()));
|
||||
|
||||
this.posYField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
||||
this.posYField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(world, object -> object.getLevelData().getYSpawn()));
|
||||
this.posYField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(level, object -> object.getLevelData().getYSpawn()));
|
||||
|
||||
this.posZField = new GuiTextFieldTooltip(x + 118, y + 60, 114, 20);
|
||||
this.posZField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(world, object -> object.getLevelData().getZSpawn()));
|
||||
this.posZField.setValue(I18n.get("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(level, object -> object.getLevelData().getZSpawn()));
|
||||
|
||||
this.worldField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
||||
this.worldField.setValue(I18n.get("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.getWorldData().getLevelName()));
|
||||
@@ -74,20 +74,20 @@ public class ContentWorldInfo extends Content
|
||||
GuiButtonBase world;
|
||||
GuiButtonBase stats;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslatableComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(start = new GuiButtonBase(x, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.start"), () ->
|
||||
container.add(start = new GuiButtonBase(x, y + 12, 114, 20, new TranslatableComponent("gui.worldhandler.world_info.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
}));
|
||||
container.add(world = new GuiButtonBase(x, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.world"), () ->
|
||||
container.add(world = new GuiButtonBase(x, y + 36, 114, 20, new TranslatableComponent("gui.worldhandler.world_info.world"), () ->
|
||||
{
|
||||
this.page = Page.WORLD;
|
||||
container.init();
|
||||
}));
|
||||
container.add(stats = new GuiButtonBase(x, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.statistics"), () ->
|
||||
container.add(stats = new GuiButtonBase(x, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.world_info.statistics"), () ->
|
||||
{
|
||||
this.page = Page.STATS;
|
||||
container.init();
|
||||
@@ -103,7 +103,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, new TranslationTextComponent("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
container.add(seed = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslatableComponent("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardHandler.setClipboard(String.valueOf(server.overworld().getSeed()));
|
||||
}));
|
||||
@@ -125,7 +125,7 @@ public class ContentWorldInfo extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
@@ -147,21 +147,21 @@ public class ContentWorldInfo extends Content
|
||||
|
||||
private void updateCurrentTime()
|
||||
{
|
||||
World world = Minecraft.getInstance().level;
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
if(world != null)
|
||||
if(level != null)
|
||||
{
|
||||
this.currentTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.world_time") + ": " + TextUtils.formatWorldTime(world.getLevelData().getDayTime()));
|
||||
this.currentTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.world_time") + ": " + TextUtils.formatWorldTime(level.getLevelData().getDayTime()));
|
||||
}
|
||||
}
|
||||
|
||||
private void updateTotalTime()
|
||||
{
|
||||
World world = Minecraft.getInstance().level;
|
||||
Level level = Minecraft.getInstance().level;
|
||||
|
||||
if(world != null)
|
||||
if(level != null)
|
||||
{
|
||||
this.totalTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.played") + ": " + TextUtils.formatTotalTime(world.getLevelData().getGameTime()));
|
||||
this.totalTimeField.setValue(I18n.get("gui.worldhandler.world_info.statistics.played") + ": " + TextUtils.formatTotalTime(level.getLevelData().getGameTime()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,7 +175,7 @@ public class ContentWorldInfo extends Content
|
||||
return I18n.get("gui.worldhandler.world_info.n_a");
|
||||
}
|
||||
|
||||
private static World getSidedWorld()
|
||||
private static Level getSidedWorld()
|
||||
{
|
||||
if(Minecraft.getInstance().isLocalServer())
|
||||
{
|
||||
@@ -192,15 +192,15 @@ public class ContentWorldInfo extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTitle()
|
||||
public MutableComponent getTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.title.world.world");
|
||||
return new TranslatableComponent("gui.worldhandler.title.world.world");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
public MutableComponent getTabTitle()
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.world.world");
|
||||
return new TranslatableComponent("gui.worldhandler.tab.world.world");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package exopandora.worldhandler.gui.menu;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -12,5 +12,5 @@ public interface IMenu
|
||||
void initGui(Container container);
|
||||
void initButtons(Container container);
|
||||
void tick();
|
||||
void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks);
|
||||
void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks);
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
import java.util.List;
|
||||
|
||||
import exopandora.worldhandler.util.ILogic;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ILogicButtonList extends ILogic
|
||||
{
|
||||
IFormattableTextComponent translate(String key, int depth);
|
||||
MutableComponent translate(String key, int depth);
|
||||
|
||||
default String buildTranslationKey(List<String> keys, int depth)
|
||||
{
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
package exopandora.worldhandler.gui.menu.impl;
|
||||
|
||||
import exopandora.worldhandler.util.ILogic;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ILogicMapped<T> extends ILogic
|
||||
{
|
||||
IFormattableTextComponent translate(T item);
|
||||
IFormattableTextComponent toTooltip(T item);
|
||||
MutableComponent translate(T item);
|
||||
MutableComponent toTooltip(T item);
|
||||
|
||||
default IFormattableTextComponent formatTooltip(T item, int index, int max)
|
||||
default MutableComponent formatTooltip(T item, int index, int max)
|
||||
{
|
||||
IFormattableTextComponent tooltip = this.toTooltip(item);
|
||||
MutableComponent tooltip = this.toTooltip(item);
|
||||
|
||||
if(tooltip != null)
|
||||
{
|
||||
return tooltip.append(String.format(" (%d/%d)", index, max));
|
||||
}
|
||||
|
||||
return (IFormattableTextComponent) StringTextComponent.EMPTY;
|
||||
return (MutableComponent) TextComponent.EMPTY;
|
||||
}
|
||||
|
||||
void onClick(T item);
|
||||
|
||||
@@ -2,14 +2,14 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ILogicPageList<T> extends ILogicMapped<T>
|
||||
{
|
||||
GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, T item, ActionHandler actionHandler);
|
||||
GuiButtonBase onRegister(int x, int y, int width, int height, MutableComponent text, T item, ActionHandler actionHandler);
|
||||
|
||||
default boolean doDisable()
|
||||
{
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.util.function.BiFunction;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
@@ -15,8 +15,8 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList.Persistence;
|
||||
import exopandora.worldhandler.util.Node;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -56,19 +56,19 @@ public class MenuButtonList extends Menu
|
||||
container.add(new GuiButtonList<Node>(this.x, this.y, this.items, 114, 20, container, new ILogicMapped<Node>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(Node item)
|
||||
public MutableComponent translate(Node item)
|
||||
{
|
||||
return MenuButtonList.this.logic.translate(MenuButtonList.this.buildKey(container, MenuButtonList.this.logic::buildTranslationKey), MenuButtonList.this.getDepth());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(Node item)
|
||||
public MutableComponent toTooltip(Node item)
|
||||
{
|
||||
return new StringTextComponent(item.getKey());
|
||||
return new TextComponent(item.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent formatTooltip(Node item, int index, int max)
|
||||
public MutableComponent formatTooltip(Node item, int index, int max)
|
||||
{
|
||||
return ILogicMapped.super.formatTooltip(item, index, max);
|
||||
}
|
||||
@@ -99,7 +99,7 @@ public class MenuButtonList extends Menu
|
||||
{
|
||||
for(int x = this.getDepth() + 1; x < this.maxDepth; x++)
|
||||
{
|
||||
GuiButtonBase button = new GuiButtonBase(this.x, this.y + 24 * x, 114, 20, StringTextComponent.EMPTY, null);
|
||||
GuiButtonBase button = new GuiButtonBase(this.x, this.y + 24 * x, 114, 20, TextComponent.EMPTY, null);
|
||||
button.active = false;
|
||||
container.add(button);
|
||||
}
|
||||
@@ -113,7 +113,7 @@ public class MenuButtonList extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,59 +3,59 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonList;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import exopandora.worldhandler.util.MutableTextComponent;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.Style;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class MenuColorField extends Menu
|
||||
{
|
||||
private static final List<TextFormatting> COLORS = new ArrayList<TextFormatting>();
|
||||
private static final List<ChatFormatting> COLORS = new ArrayList<ChatFormatting>();
|
||||
|
||||
static
|
||||
{
|
||||
COLORS.add(TextFormatting.RESET);
|
||||
COLORS.add(TextFormatting.YELLOW);
|
||||
COLORS.add(TextFormatting.GOLD);
|
||||
COLORS.add(TextFormatting.DARK_RED);
|
||||
COLORS.add(TextFormatting.RED);
|
||||
COLORS.add(TextFormatting.LIGHT_PURPLE);
|
||||
COLORS.add(TextFormatting.DARK_PURPLE);
|
||||
COLORS.add(TextFormatting.BLUE);
|
||||
COLORS.add(TextFormatting.DARK_BLUE);
|
||||
COLORS.add(TextFormatting.DARK_AQUA);
|
||||
COLORS.add(TextFormatting.AQUA);
|
||||
COLORS.add(TextFormatting.GREEN);
|
||||
COLORS.add(TextFormatting.DARK_GREEN);
|
||||
COLORS.add(TextFormatting.BLACK);
|
||||
COLORS.add(TextFormatting.DARK_GRAY);
|
||||
COLORS.add(TextFormatting.GRAY);
|
||||
COLORS.add(TextFormatting.WHITE);
|
||||
COLORS.add(ChatFormatting.RESET);
|
||||
COLORS.add(ChatFormatting.YELLOW);
|
||||
COLORS.add(ChatFormatting.GOLD);
|
||||
COLORS.add(ChatFormatting.DARK_RED);
|
||||
COLORS.add(ChatFormatting.RED);
|
||||
COLORS.add(ChatFormatting.LIGHT_PURPLE);
|
||||
COLORS.add(ChatFormatting.DARK_PURPLE);
|
||||
COLORS.add(ChatFormatting.BLUE);
|
||||
COLORS.add(ChatFormatting.DARK_BLUE);
|
||||
COLORS.add(ChatFormatting.DARK_AQUA);
|
||||
COLORS.add(ChatFormatting.AQUA);
|
||||
COLORS.add(ChatFormatting.GREEN);
|
||||
COLORS.add(ChatFormatting.DARK_GREEN);
|
||||
COLORS.add(ChatFormatting.BLACK);
|
||||
COLORS.add(ChatFormatting.DARK_GRAY);
|
||||
COLORS.add(ChatFormatting.GRAY);
|
||||
COLORS.add(ChatFormatting.WHITE);
|
||||
}
|
||||
|
||||
private GuiTextFieldTooltip textField;
|
||||
private final MutableStringTextComponent string;
|
||||
private final MutableTextComponent string;
|
||||
private final ILogicColorMenu logic;
|
||||
private final String translationKey;
|
||||
|
||||
public MenuColorField(int x, int y, String translationKey, MutableStringTextComponent string)
|
||||
public MenuColorField(int x, int y, String translationKey, MutableTextComponent string)
|
||||
{
|
||||
this(x, y, translationKey, string, new ILogicColorMenu(){});
|
||||
}
|
||||
|
||||
public MenuColorField(int x, int y, String translationKey, MutableStringTextComponent string, ILogicColorMenu logic)
|
||||
public MenuColorField(int x, int y, String translationKey, MutableTextComponent string, ILogicColorMenu logic)
|
||||
{
|
||||
super(x, y);
|
||||
this.translationKey = translationKey;
|
||||
@@ -66,7 +66,7 @@ public class MenuColorField extends Menu
|
||||
@Override
|
||||
public void initGui(Container container)
|
||||
{
|
||||
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, new TranslationTextComponent(this.translationKey));
|
||||
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, new TranslatableComponent(this.translationKey));
|
||||
this.textField.setFilter(this.logic::validate);
|
||||
this.textField.setFormatter(this.string::formatter);
|
||||
this.textField.setValue(this.string.getContents());
|
||||
@@ -86,28 +86,28 @@ public class MenuColorField extends Menu
|
||||
|
||||
if(this.logic.doDrawButtons())
|
||||
{
|
||||
container.add(new GuiButtonList<TextFormatting>(this.x + 118, this.y + 24, COLORS, 114, 20, container, new ILogicMapped<TextFormatting>()
|
||||
container.add(new GuiButtonList<ChatFormatting>(this.x + 118, this.y + 24, COLORS, 114, 20, container, new ILogicMapped<ChatFormatting>()
|
||||
{
|
||||
@Override
|
||||
public IFormattableTextComponent translate(TextFormatting item)
|
||||
public MutableComponent translate(ChatFormatting item)
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.color").withStyle(item).append(": ").append(new TranslationTextComponent("gui.worldhandler.color." + item.getName()));
|
||||
return new TranslatableComponent("gui.worldhandler.color").withStyle(item).append(": ").append(new TranslatableComponent("gui.worldhandler.color." + item.getName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent toTooltip(TextFormatting item)
|
||||
public MutableComponent toTooltip(ChatFormatting item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IFormattableTextComponent formatTooltip(TextFormatting item, int index, int max)
|
||||
public MutableComponent formatTooltip(ChatFormatting item, int index, int max)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(TextFormatting item)
|
||||
public void onClick(ChatFormatting item)
|
||||
{
|
||||
MenuColorField.this.string.withStyle(item);
|
||||
}
|
||||
@@ -119,27 +119,27 @@ public class MenuColorField extends Menu
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, new StringTextComponent("I").setStyle(Style.EMPTY.withItalic(this.string.getStyle().isItalic())), () ->
|
||||
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, new TextComponent("I").setStyle(Style.EMPTY.withItalic(this.string.getStyle().isItalic())), () ->
|
||||
{
|
||||
this.string.setStyle(this.string.getStyle().withItalic(!this.string.getStyle().isItalic()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, new StringTextComponent("B").setStyle(Style.EMPTY.withBold(this.string.getStyle().isBold())), () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, new TextComponent("B").setStyle(Style.EMPTY.withBold(this.string.getStyle().isBold())), () ->
|
||||
{
|
||||
this.string.setStyle(this.string.getStyle().withBold(!this.string.getStyle().isBold()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, new StringTextComponent("U").setStyle(Style.EMPTY.setUnderlined(this.string.getStyle().isUnderlined())), () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, new TextComponent("U").setStyle(Style.EMPTY.setUnderlined(this.string.getStyle().isUnderlined())), () ->
|
||||
{
|
||||
this.string.setStyle(this.string.getStyle().setUnderlined(!this.string.getStyle().isUnderlined()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, new StringTextComponent("S").setStyle(Style.EMPTY.setStrikethrough(this.string.getStyle().isStrikethrough())), () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, new TextComponent("S").setStyle(Style.EMPTY.setStrikethrough(this.string.getStyle().isStrikethrough())), () ->
|
||||
{
|
||||
this.string.setStyle(this.string.getStyle().setStrikethrough(!this.string.getStyle().isStrikethrough()));
|
||||
container.init();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, new StringTextComponent("O").setStyle(Style.EMPTY.setObfuscated(this.string.getStyle().isObfuscated())), () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, new TextComponent("O").setStyle(Style.EMPTY.setObfuscated(this.string.getStyle().isObfuscated())), () ->
|
||||
{
|
||||
this.string.setStyle(this.string.getStyle().setObfuscated(!this.string.getStyle().isObfuscated()));
|
||||
container.init();
|
||||
@@ -157,7 +157,7 @@ public class MenuColorField extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.logic.doDrawTextField())
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
@@ -11,9 +11,9 @@ import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.network.chat.TextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -78,7 +78,7 @@ public class MenuPageList<T> extends Menu
|
||||
if(index < this.items.size())
|
||||
{
|
||||
T item = this.items.get(index);
|
||||
IFormattableTextComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().font);
|
||||
MutableComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().font);
|
||||
button = this.logic.onRegister(this.x, this.y + (this.height + 4) * x, this.width, this.height, text, item, () ->
|
||||
{
|
||||
this.persistence.setSelectedIndex(index);
|
||||
@@ -92,7 +92,7 @@ public class MenuPageList<T> extends Menu
|
||||
}
|
||||
else
|
||||
{
|
||||
button = new GuiButtonBase(this.x, this.y + (this.height + 4) * x, this.width, this.height, StringTextComponent.EMPTY, null);
|
||||
button = new GuiButtonBase(this.x, this.y + (this.height + 4) * x, this.width, this.height, TextComponent.EMPTY, null);
|
||||
button.active = false;
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class MenuPageList<T> extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(PoseStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
Minecraft.getInstance().font.draw(matrix, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package exopandora.worldhandler.gui.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import net.minecraft.client.gui.IGuiEventListener;
|
||||
import net.minecraft.client.gui.components.events.GuiEventListener;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface IWidget extends IGuiEventListener
|
||||
public interface IWidget extends GuiEventListener
|
||||
{
|
||||
default void init(Container container)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ public interface IWidget extends IGuiEventListener
|
||||
|
||||
}
|
||||
|
||||
default void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
default void drawScreen(PoseStack stack, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.widget;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.BuilderWorldHandler;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
@@ -42,7 +42,7 @@ public class WidgetCommandSyntax implements IContainerWidget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.syntaxField != null)
|
||||
{
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
package exopandora.worldhandler.gui.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiTextFieldTooltip;
|
||||
import net.minecraft.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.resources.language.I18n;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -36,7 +36,7 @@ public class WidgetNameField implements IContainerWidget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
String username = container.getPlayer().isEmpty() && !this.nameField.isFocused() ? I18n.get("gui.worldhandler.generic.edit_username") : container.getPlayer();
|
||||
|
||||
@@ -81,7 +81,7 @@ public class WidgetNameField implements IContainerWidget
|
||||
|
||||
private void updateNameField(Container container)
|
||||
{
|
||||
final FontRenderer font = Minecraft.getInstance().font;
|
||||
final Font font = Minecraft.getInstance().font;
|
||||
|
||||
int x = container.getBackgroundX() + container.getBackgroundWidth() - this.watchOffset() - 7;
|
||||
int y = container.getBackgroundY() + 6;
|
||||
|
||||
@@ -8,8 +8,8 @@ import exopandora.worldhandler.gui.widget.button.EnumIcon;
|
||||
import exopandora.worldhandler.gui.widget.button.GuiButtonIcon;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.TranslatableComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -46,70 +46,70 @@ public class WidgetShortcuts implements IContainerWidget
|
||||
{
|
||||
TIME_DAWN(EnumIcon.TIME_DAWN, ActionHelper::timeDawn, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn()));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn()));
|
||||
}),
|
||||
TIME_NOON(EnumIcon.TIME_NOON, ActionHelper::timeNoon, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon()));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon()));
|
||||
}),
|
||||
TIME_SUNSET(EnumIcon.TIME_SUNSET, ActionHelper::timeSunset, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset()));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset()));
|
||||
}),
|
||||
TIME_MIDNIGHT(EnumIcon.TIME_MIDNIGHT, ActionHelper::timeMidnight, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight()));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight()));
|
||||
}),
|
||||
WEATHER_SUN(EnumIcon.WEATHER_SUN, ActionHelper::weatherClear, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.clear"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.clear"));
|
||||
}),
|
||||
WEATHER_RAIN(EnumIcon.WEATHER_RAIN, ActionHelper::weatherRain, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy"));
|
||||
}),
|
||||
WEATHER_STORM(EnumIcon.WEATHER_STORM, ActionHelper::weatherThunder, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder"));
|
||||
}),
|
||||
DIFFICULTY_PEACEFUL(EnumIcon.DIFFICULTY_PEACEFUL, ActionHelper::difficultyPeaceful, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful"));
|
||||
}),
|
||||
DIFFICULTY_EASY(EnumIcon.DIFFICULTY_EASY, ActionHelper::difficultyEasy, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy"));
|
||||
}),
|
||||
DIFFICULTY_NORMAL(EnumIcon.DIFFICULTY_NORMAL, ActionHelper::difficultyNormal, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal"));
|
||||
}),
|
||||
DIFFICULTY_HARD(EnumIcon.DIFFICULTY_HARD, ActionHelper::difficultyHard, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard"));
|
||||
}),
|
||||
GAMEMODE_SURVIVAL(EnumIcon.GAMEMODE_SURVIVAL, ActionHelper::gamemodeSurvival, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival"));
|
||||
}),
|
||||
GAMEMODE_CREATIVE(EnumIcon.GAMEMODE_CREATIVE, ActionHelper::gamemodeCreative, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative"));
|
||||
}),
|
||||
GAMEMODE_ADVENTURE(EnumIcon.GAMEMODE_ADVENTURE, ActionHelper::gamemodeAdventure, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure"));
|
||||
}),
|
||||
GAMEMODE_SPECTATOR(EnumIcon.GAMEMODE_SPECTATOR, ActionHelper::gamemodeSpectator, () ->
|
||||
{
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator"));
|
||||
return new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslatableComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator"));
|
||||
});
|
||||
|
||||
private final EnumIcon icon;
|
||||
private final Supplier<ITextComponent> text;
|
||||
private final Supplier<Component> text;
|
||||
private final ActionHandler actionHandler;
|
||||
|
||||
private EnumShortcuts(EnumIcon icon, ActionHandler actionHandler, Supplier<ITextComponent> text)
|
||||
private EnumShortcuts(EnumIcon icon, ActionHandler actionHandler, Supplier<Component> text)
|
||||
{
|
||||
this.icon = icon;
|
||||
this.text = text;
|
||||
@@ -121,7 +121,7 @@ public class WidgetShortcuts implements IContainerWidget
|
||||
return this.icon;
|
||||
}
|
||||
|
||||
public Supplier<ITextComponent> getTextSupplier()
|
||||
public Supplier<Component> getTextSupplier()
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package exopandora.worldhandler.gui.widget;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
@@ -11,11 +11,11 @@ import exopandora.worldhandler.gui.widget.button.GuiButtonTab;
|
||||
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.AbstractGui;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.client.gui.GuiComponent;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(PoseStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
Content content = container.getContent();
|
||||
Category category = content.getCategory();
|
||||
@@ -69,7 +69,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
int offset = WidgetTabRenderer.offset(container, index, size);
|
||||
|
||||
Content tab = category.getContent(index);
|
||||
ITextComponent title = TextUtils.stripText(tab.getTabTitle().withStyle(TextFormatting.UNDERLINE), width, Minecraft.getInstance().font);
|
||||
Component title = TextUtils.stripText(tab.getTabTitle().withStyle(ChatFormatting.UNDERLINE), width, Minecraft.getInstance().font);
|
||||
|
||||
if(content.getActiveContent().equals(tab))
|
||||
{
|
||||
@@ -85,7 +85,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
RenderUtils.colorDefaultBackground();
|
||||
}
|
||||
|
||||
private void drawActiveTab(MatrixStack matrix, Container container, int index, int size, int x, int y, int width, int height, ITextComponent title)
|
||||
private void drawActiveTab(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height, Component title)
|
||||
{
|
||||
RenderUtils.colorDefaultBackground();
|
||||
this.drawTabBackground(matrix, container, x, y, width, height);
|
||||
@@ -127,7 +127,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
this.drawTabTitle(matrix, container, title, x + width / 2, y + 9, 0xFFFFFF);
|
||||
}
|
||||
|
||||
private void drawInactiveTab(MatrixStack matrix, Container container, int index, int size, int x, int y, int width, int height, ITextComponent title)
|
||||
private void drawInactiveTab(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height, Component title)
|
||||
{
|
||||
RenderUtils.colorDarkBackground();
|
||||
this.drawTabBackground(matrix, container, x, y, width, 20);
|
||||
@@ -142,7 +142,7 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
this.drawTabTitle(matrix, container, title, x + width / 2, y + 7, 0xE0E0E0);
|
||||
}
|
||||
|
||||
private void drawTabBackgroundMerge(MatrixStack matrix, Container container, int index, int size, int x, int y, int width, int height)
|
||||
private void drawTabBackgroundMerge(PoseStack matrix, Container container, int index, int size, int x, int y, int width, int height)
|
||||
{
|
||||
if(index == 0)
|
||||
{
|
||||
@@ -155,13 +155,13 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
}
|
||||
}
|
||||
|
||||
private void drawTabBackground(MatrixStack matrix, Container container, int x, int y, int width, int height)
|
||||
private void drawTabBackground(PoseStack matrix, Container container, int x, int y, int width, int height)
|
||||
{
|
||||
container.bindBackground();
|
||||
container.setBlitOffset(-1);
|
||||
|
||||
int left = MathHelper.ceil(width / 2D);
|
||||
int right = MathHelper.floor(width / 2D);
|
||||
int left = Mth.ceil(width / 2D);
|
||||
int right = Mth.floor(width / 2D);
|
||||
|
||||
RenderSystem.enableBlend();
|
||||
|
||||
@@ -171,10 +171,10 @@ public class WidgetTabRenderer implements IContainerWidget
|
||||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
private void drawTabTitle(MatrixStack matrix, AbstractGui gui, ITextComponent title, int x, int y, int color)
|
||||
private void drawTabTitle(PoseStack matrix, GuiComponent gui, Component title, int x, int y, int color)
|
||||
{
|
||||
gui.setBlitOffset(0);
|
||||
AbstractGui.drawCenteredString(matrix, Minecraft.getInstance().font, title, x, y, color);
|
||||
GuiComponent.drawCenteredString(matrix, Minecraft.getInstance().font, title, x, y, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user