Update to 1.16.1
This commit is contained in:
@@ -12,8 +12,8 @@ public class Main
|
||||
{
|
||||
public static final String NAME = "World Handler";
|
||||
public static final String MODID = "worldhandler";
|
||||
public static final String MC_VERSION = "1.15.2";
|
||||
public static final String MOD_VERSION = "2.9.1";
|
||||
public static final String MC_VERSION = "1.16.1";
|
||||
public static final String MOD_VERSION = "2.10";
|
||||
public static final String URL = "https://minecraft.curseforge.com/projects/world-handler-command-gui";
|
||||
|
||||
public static void main(String[] args)
|
||||
|
||||
@@ -35,11 +35,12 @@ public class WorldHandler
|
||||
public static final Logger LOGGER = LogManager.getLogger();
|
||||
public static final Path USERCONTENT_PATH = FMLPaths.CONFIGDIR.get().resolve(Main.MODID).resolve("usercontent");
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public WorldHandler()
|
||||
{
|
||||
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus();
|
||||
modEventBus.addListener(this::clientSetup);
|
||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarting);
|
||||
modEventBus.addListener(this::serverStarting);
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
SimpleReloadableResourceManager manager = (SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager();
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class ComponentAttribute implements IBuilderComponent
|
||||
{
|
||||
protected Map<EnumAttributes, Double> attributes = new HashMap<EnumAttributes, Double>();
|
||||
protected Function<EnumAttributes, Boolean> applyable;
|
||||
{
|
||||
public static final List<Attribute> ATTRIBUTES = ForgeRegistries.ATTRIBUTES.getValues().stream().filter(attribute -> !attribute.func_233754_c_().equals(I18n.format(attribute.func_233754_c_()))).collect(Collectors.toList());
|
||||
|
||||
public ComponentAttribute(Function<EnumAttributes, Boolean> applyable)
|
||||
{
|
||||
this.applyable = applyable;
|
||||
}
|
||||
protected Map<Attribute, Double> attributes = new HashMap<Attribute, Double>();
|
||||
|
||||
public void set(EnumAttributes attribute, double ammount)
|
||||
public void set(Attribute attribute, double ammount)
|
||||
{
|
||||
this.attributes.put(attribute, ammount);
|
||||
}
|
||||
|
||||
public double getAmmount(EnumAttributes attribute)
|
||||
public double getAmmount(Attribute attribute)
|
||||
{
|
||||
if(this.attributes.containsKey(attribute))
|
||||
{
|
||||
@@ -36,12 +35,12 @@ public abstract class ComponentAttribute implements IBuilderComponent
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void remove(EnumAttributes attribute)
|
||||
public void remove(Attribute attribute)
|
||||
{
|
||||
this.attributes.remove(attribute);
|
||||
}
|
||||
|
||||
public Set<EnumAttributes> getAttributes()
|
||||
public Set<Attribute> getAttributes()
|
||||
{
|
||||
return this.attributes.keySet();
|
||||
}
|
||||
|
||||
@@ -2,13 +2,12 @@ package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.UUID;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -16,29 +15,23 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentAttributeItem extends ComponentAttribute
|
||||
{
|
||||
public ComponentAttributeItem(Function<EnumAttributes, Boolean> applyable)
|
||||
{
|
||||
super(applyable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
{
|
||||
ListNBT attributes = new ListNBT();
|
||||
|
||||
for(Entry<EnumAttributes, Double> entry : this.attributes.entrySet())
|
||||
for(Entry<Attribute, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(this.applyable.apply(entry.getKey()) && entry.getValue() != 0)
|
||||
if(entry.getValue() != 0)
|
||||
{
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
String id = entry.getKey().getRegistryName().toString();
|
||||
|
||||
attribute.putString("AttributeName", entry.getKey().getAttribute());
|
||||
attribute.putString("Name", entry.getKey().getAttribute());
|
||||
attribute.putDouble("Amount", entry.getKey().calculate(entry.getValue()));
|
||||
attribute.putInt("Operation", entry.getKey().getOperation().ordinal());
|
||||
attribute.putLong("UUIDLeast", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getLeastSignificantBits());
|
||||
attribute.putLong("UUIDMost", UUID.nameUUIDFromBytes(entry.getKey().getAttribute().getBytes()).getMostSignificantBits());
|
||||
attribute.putString("AttributeName", id);
|
||||
attribute.putDouble("Amount", entry.getValue() / 100);
|
||||
attribute.putInt("Operation", 1); // 0 = additive, 1 = percentage
|
||||
attribute.putUniqueId("UUID", UUID.nameUUIDFromBytes(id.getBytes()));
|
||||
|
||||
attributes.add(attribute);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package exopandora.worldhandler.builder.component.impl;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.ListNBT;
|
||||
@@ -15,25 +14,21 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ComponentAttributeMob extends ComponentAttribute
|
||||
{
|
||||
public ComponentAttributeMob(Function<EnumAttributes, Boolean> applyable)
|
||||
{
|
||||
super(applyable);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public INBT serialize()
|
||||
{
|
||||
ListNBT attributes = new ListNBT();
|
||||
|
||||
for(Entry<EnumAttributes, Double> entry : this.attributes.entrySet())
|
||||
for(Entry<Attribute, Double> entry : this.attributes.entrySet())
|
||||
{
|
||||
if(this.applyable.apply(entry.getKey()) && entry.getValue() != 0)
|
||||
if(entry.getValue() != 0)
|
||||
{
|
||||
CompoundNBT attribute = new CompoundNBT();
|
||||
String id = entry.getKey().getRegistryName().toString();
|
||||
|
||||
attribute.putString("Name", entry.getKey().getAttribute());
|
||||
attribute.putDouble("Base", entry.getKey().calculate(entry.getValue()));
|
||||
attribute.putString("Name", id);
|
||||
attribute.putDouble("Base", entry.getValue() / 100);
|
||||
|
||||
attributes.add(attribute);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public class ComponentDisplay implements IBuilderComponent
|
||||
{
|
||||
private MutableStringTextComponent name = new MutableStringTextComponent();
|
||||
private String[] lore = new String[2];
|
||||
private ITextComponent[] lore = new ITextComponent[2];
|
||||
|
||||
@Override
|
||||
public INBT serialize()
|
||||
@@ -30,9 +30,9 @@ public class ComponentDisplay implements IBuilderComponent
|
||||
|
||||
for(int x = 0; x < this.lore.length; x++)
|
||||
{
|
||||
if(this.lore[x] != null && !this.lore[x].isEmpty())
|
||||
if(this.lore[x] != null && !this.lore[x].getString().isEmpty())
|
||||
{
|
||||
lore.add(StringNBT.valueOf(this.lore[x]));
|
||||
lore.add(StringNBT.valueOf(ITextComponent.Serializer.toJson(this.lore[x])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,32 +59,32 @@ public class ComponentDisplay implements IBuilderComponent
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setLore(String[] lore)
|
||||
public void setLore(ITextComponent[] lore)
|
||||
{
|
||||
this.lore = lore;
|
||||
}
|
||||
|
||||
public String[] getLore()
|
||||
public ITextComponent[] getLore()
|
||||
{
|
||||
return this.lore;
|
||||
}
|
||||
|
||||
public void setLore1(String lore)
|
||||
public void setLore1(ITextComponent lore)
|
||||
{
|
||||
this.lore[0] = lore;
|
||||
}
|
||||
|
||||
public String getLore1()
|
||||
public ITextComponent getLore1()
|
||||
{
|
||||
return this.lore[0];
|
||||
}
|
||||
|
||||
public void setLore2(String lore)
|
||||
public void setLore2(ITextComponent lore)
|
||||
{
|
||||
this.lore[1] = lore;
|
||||
}
|
||||
|
||||
public String getLore2()
|
||||
public ITextComponent getLore2()
|
||||
{
|
||||
return this.lore[1];
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
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;
|
||||
@@ -37,11 +37,11 @@ public class EntityNBT implements IBuilderComponent
|
||||
private boolean isBaby;
|
||||
private BlockState blockState;
|
||||
private ComponentCustom entity = new ComponentCustom();
|
||||
private ComponentAttributeMob attribute = new ComponentAttributeMob(attribute -> attribute.getApplyable().equals(Applyable.BOTH) || attribute.getApplyable().equals(Applyable.MOB));
|
||||
private ComponentAttributeMob attribute = new ComponentAttributeMob();
|
||||
private MutableStringTextComponent customName = new MutableStringTextComponent();
|
||||
private List<EntityNBT> passengers = new ArrayList<EntityNBT>();
|
||||
private ResourceLocation[] armorItems = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()};
|
||||
private ResourceLocation[] handItems = {Blocks.AIR.getRegistryName(), Blocks.AIR.getRegistryName()};
|
||||
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();
|
||||
|
||||
public EntityNBT()
|
||||
@@ -64,22 +64,22 @@ public class EntityNBT implements IBuilderComponent
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public void setAttribute(EnumAttributes attribute, double ammount)
|
||||
public void setAttribute(Attribute attribute, double ammount)
|
||||
{
|
||||
this.attribute.set(attribute, ammount);
|
||||
}
|
||||
|
||||
public void removeAttribute(EnumAttributes attribute)
|
||||
public void removeAttribute(Attribute attribute)
|
||||
{
|
||||
this.attribute.remove(attribute);
|
||||
}
|
||||
|
||||
public double getAttributeAmmount(EnumAttributes attribute)
|
||||
public double getAttributeAmmount(Attribute attribute)
|
||||
{
|
||||
return this.attribute.getAmmount(attribute);
|
||||
}
|
||||
|
||||
public Set<EnumAttributes> getAttributes()
|
||||
public Set<Attribute> getAttributes()
|
||||
{
|
||||
return this.attribute.getAttributes();
|
||||
}
|
||||
@@ -173,7 +173,7 @@ public class EntityNBT implements IBuilderComponent
|
||||
|
||||
public void setArmorItem(int index, ResourceLocation location)
|
||||
{
|
||||
if(EntityNBT.isArrayIndexValid(this.armorItems, index) && location != null)
|
||||
if(EntityNBT.isArrayIndexValid(this.armorItems, index) && location != null) //TODO
|
||||
{
|
||||
this.armorItems[index] = location;
|
||||
}
|
||||
|
||||
@@ -5,10 +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.builder.impl.EnumAttributes.Applyable;
|
||||
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 net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -27,7 +28,7 @@ public class BuilderCustomItem extends BuilderGive
|
||||
public BuilderCustomItem(String player, ResourceLocation item)
|
||||
{
|
||||
super(player, item);
|
||||
this.attribute = this.registerNBTComponent(new ComponentAttributeItem(attribute -> attribute.getApplyable().equals(Applyable.BOTH) || attribute.getApplyable().equals(Applyable.PLAYER)));
|
||||
this.attribute = this.registerNBTComponent(new ComponentAttributeItem());
|
||||
this.display = this.registerNBTComponent(new ComponentDisplay());
|
||||
this.enchantment = this.registerNBTComponent(new ComponentEnchantment());
|
||||
}
|
||||
@@ -47,22 +48,22 @@ public class BuilderCustomItem extends BuilderGive
|
||||
return this.enchantment.getEnchantments();
|
||||
}
|
||||
|
||||
public void setAttribute(EnumAttributes attribute, double ammount)
|
||||
public void setAttribute(Attribute attribute, double ammount)
|
||||
{
|
||||
this.attribute.set(attribute, ammount);
|
||||
}
|
||||
|
||||
public void removeAttribute(EnumAttributes attribute)
|
||||
public void removeAttribute(Attribute attribute)
|
||||
{
|
||||
this.attribute.remove(attribute);
|
||||
}
|
||||
|
||||
public double getAttributeAmmount(EnumAttributes attribute)
|
||||
public double getAttributeAmmount(Attribute attribute)
|
||||
{
|
||||
return this.attribute.getAmmount(attribute);
|
||||
}
|
||||
|
||||
public Set<EnumAttributes> getAttributes()
|
||||
public Set<Attribute> getAttributes()
|
||||
{
|
||||
return this.attribute.getAttributes();
|
||||
}
|
||||
@@ -77,22 +78,22 @@ public class BuilderCustomItem extends BuilderGive
|
||||
return this.display.getName();
|
||||
}
|
||||
|
||||
public void setLore1(String lore)
|
||||
public void setLore1(ITextComponent lore)
|
||||
{
|
||||
this.display.setLore1(lore);
|
||||
}
|
||||
|
||||
public String getLore1()
|
||||
public ITextComponent getLore1()
|
||||
{
|
||||
return this.display.getLore1();
|
||||
}
|
||||
|
||||
public void setLore2(String lore)
|
||||
public void setLore2(ITextComponent lore)
|
||||
{
|
||||
this.display.setLore2(lore);
|
||||
}
|
||||
|
||||
public String getLore2()
|
||||
public ITextComponent getLore2()
|
||||
{
|
||||
return this.display.getLore2();
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ 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.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -39,7 +39,7 @@ public class BuilderSetBlock extends BuilderBlockPos
|
||||
this.setMode(mode);
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> void setState(IProperty<T> property, T value)
|
||||
public <T extends Comparable<T>> void setState(Property<T> property, T value)
|
||||
{
|
||||
this.blockResourceLocation.setProperty(property, value);
|
||||
this.setBlock(this.blockResourceLocation);
|
||||
|
||||
@@ -20,6 +20,7 @@ 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;
|
||||
@@ -107,22 +108,22 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
return this.nbt.getId();
|
||||
}
|
||||
|
||||
public void setAttribute(EnumAttributes attribute, double ammount)
|
||||
public void setAttribute(Attribute attribute, double ammount)
|
||||
{
|
||||
this.nbt.setAttribute(attribute, ammount);
|
||||
}
|
||||
|
||||
public void removeAttribute(EnumAttributes attribute)
|
||||
public void removeAttribute(Attribute attribute)
|
||||
{
|
||||
this.nbt.removeAttribute(attribute);
|
||||
}
|
||||
|
||||
public double getAttributeAmmount(EnumAttributes attribute)
|
||||
public double getAttributeAmmount(Attribute attribute)
|
||||
{
|
||||
return this.nbt.getAttributeAmmount(attribute);
|
||||
}
|
||||
|
||||
public Set<EnumAttributes> getAttributes()
|
||||
public Set<Attribute> getAttributes()
|
||||
{
|
||||
return this.nbt.getAttributes();
|
||||
}
|
||||
@@ -491,7 +492,7 @@ public class BuilderSummon extends CommandBuilderNBT
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Pigman") || entity.equalsIgnoreCase("ZombiePig") || entity.equalsIgnoreCase("ZombiePigman"))
|
||||
{
|
||||
return EntityType.ZOMBIE_PIGMAN.getRegistryName();
|
||||
return EntityType.field_233592_ba_.getRegistryName();
|
||||
}
|
||||
else if(entity.equalsIgnoreCase("Wither"))
|
||||
{
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
package exopandora.worldhandler.builder.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public enum EnumAttributes
|
||||
{
|
||||
MAX_HEALTH("generic.maxHealth", EnumOperation.ADDITIVE, Applyable.BOTH),
|
||||
FOLLOW_RANGE("generic.followRange", EnumOperation.ADDITIVE, Applyable.MOB),
|
||||
KNOCKBACK_RESISTANCE("generic.knockbackResistance", EnumOperation.PERCENTAGE, Applyable.BOTH),
|
||||
MOVEMENT_SPEED("generic.movementSpeed", EnumOperation.PERCENTAGE, Applyable.BOTH),
|
||||
ATTACK_DAMAGE("generic.attackDamage", EnumOperation.ADDITIVE, Applyable.BOTH),
|
||||
ARMOR("generic.armor", EnumOperation.ADDITIVE, Applyable.BOTH),
|
||||
ARMOR_TOUGHNESS("generic.armorToughness", EnumOperation.ADDITIVE, Applyable.BOTH),
|
||||
ATTACK_SPEED("generic.attackSpeed", EnumOperation.PERCENTAGE, Applyable.BOTH),
|
||||
LUCK("generic.luck", EnumOperation.PERCENTAGE, Applyable.PLAYER),
|
||||
HORSE_JUMP_STRENGTH("horse.jumpStrength", EnumOperation.PERCENTAGE, Applyable.MOB),
|
||||
ZOMBIE_SPAWN_REINFORCEMENTS("zombie.spawnReinforcements", EnumOperation.PERCENTAGE, Applyable.MOB);
|
||||
|
||||
private String attribute;
|
||||
private EnumOperation operation;
|
||||
private Applyable applyable;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static enum Applyable
|
||||
{
|
||||
BOTH,
|
||||
PLAYER,
|
||||
MOB
|
||||
}
|
||||
|
||||
private EnumAttributes(String attribute, EnumOperation operation, Applyable applyable)
|
||||
{
|
||||
this.attribute = attribute;
|
||||
this.operation = operation;
|
||||
this.applyable = applyable;
|
||||
}
|
||||
|
||||
public String getAttribute()
|
||||
{
|
||||
return this.attribute;
|
||||
}
|
||||
|
||||
public String getTranslationKey()
|
||||
{
|
||||
return "attribute.name." + this.attribute;
|
||||
}
|
||||
|
||||
public String getTranslation()
|
||||
{
|
||||
return I18n.format(this.getTranslationKey(), new Object[0]);
|
||||
}
|
||||
|
||||
public EnumOperation getOperation()
|
||||
{
|
||||
return this.operation;
|
||||
}
|
||||
|
||||
public Applyable getApplyable()
|
||||
{
|
||||
return this.applyable;
|
||||
}
|
||||
|
||||
public double calculate(Double value)
|
||||
{
|
||||
return this.operation.getOperation().apply(value);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static enum EnumOperation
|
||||
{
|
||||
ADDITIVE(value -> value, "(+)"),
|
||||
PERCENTAGE(value -> value / 100, "%");
|
||||
|
||||
private final Function<Double, Double> operation;
|
||||
private final String declaration;
|
||||
|
||||
private EnumOperation(Function<Double, Double> operation, String declaration)
|
||||
{
|
||||
this.operation = operation;
|
||||
this.declaration = declaration;
|
||||
}
|
||||
|
||||
public Function<Double, Double> getOperation()
|
||||
{
|
||||
return this.operation;
|
||||
}
|
||||
|
||||
public String getDeclaration()
|
||||
{
|
||||
return this.declaration;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<EnumAttributes> getAttributesFor(Applyable applyable)
|
||||
{
|
||||
return Arrays.stream(EnumAttributes.values()).filter(attribute -> attribute.getApplyable().equals(applyable)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ 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.IProperty;
|
||||
import net.minecraft.state.Property;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -70,9 +70,9 @@ public class BlockResourceLocation extends ItemResourceLocation
|
||||
return this.state;
|
||||
}
|
||||
|
||||
public <T extends Comparable<T>> void setProperty(IProperty<T> property, T value)
|
||||
public <T extends Comparable<T>> void setProperty(Property<T> property, T value)
|
||||
{
|
||||
if(this.state != null && this.state.has(property))
|
||||
if(this.state != null && this.state.func_235901_b_(property)) //has
|
||||
{
|
||||
this.state = this.state.with(property, value);
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public class CommandWH
|
||||
|
||||
private static int pos1(CommandSource source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
|
||||
BlockPos pos = BlockHelper.getPos1();
|
||||
@@ -74,7 +74,7 @@ public class CommandWH
|
||||
|
||||
private static int pos2(CommandSource source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
|
||||
BlockPos pos = BlockHelper.getPos2();
|
||||
@@ -87,7 +87,7 @@ public class CommandWH
|
||||
|
||||
private static int fill(CommandSource source, BlockStateInput block)
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BuilderFill builder = new BuilderFill();
|
||||
builder.setBlock1(new BlockResourceLocation(block.getState().getBlock().getRegistryName(), block.getState(), block.tag));
|
||||
@@ -99,7 +99,7 @@ public class CommandWH
|
||||
|
||||
private static int replace(CommandSource source, BlockStateInput block, BlockStateInput replace)
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BuilderFill builder = new BuilderFill();
|
||||
builder.setPosition1(BlockHelper.getPos1());
|
||||
@@ -114,7 +114,7 @@ public class CommandWH
|
||||
|
||||
private static int clone(CommandSource source, String mask, String filter)
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BuilderClone builder = new BuilderClone();
|
||||
builder.setPosition1(BlockHelper.getPos1());
|
||||
@@ -129,7 +129,7 @@ public class CommandWH
|
||||
|
||||
private static int clone(CommandSource source, String mask)
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () ->
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () ->
|
||||
{
|
||||
BuilderClone builder = new BuilderClone();
|
||||
builder.setPosition1(BlockHelper.getPos1());
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CommandWorldHandler
|
||||
|
||||
private static int display(CommandSource source) throws CommandSyntaxException
|
||||
{
|
||||
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> Minecraft.getInstance().execute(ActionHelper::displayGui));
|
||||
DistExecutor.safeRunWhenOn(Dist.CLIENT, () -> () -> Minecraft.getInstance().execute(ActionHelper::displayGui));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ConfigCategorySettings
|
||||
this.watch = builder
|
||||
.translation("gui.worldhandler.config.settings.watch")
|
||||
.comment("Whether or not to display a watch")
|
||||
.define("watch", true);
|
||||
.define("watch", false);
|
||||
this.smoothWatch = builder
|
||||
.translation("gui.worldhandler.config.settings.smooth_watch")
|
||||
.comment("Whether or not the watch pointers move smoothly")
|
||||
|
||||
@@ -15,7 +15,7 @@ import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.command.CommandSource;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.math.vector.Vector3d;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.client.event.ClientChatEvent;
|
||||
@@ -30,7 +30,7 @@ public class ClientEventHandler
|
||||
{
|
||||
if(Config.getSettings().highlightBlocks() && Minecraft.getInstance().world != null && Minecraft.getInstance().getRenderManager().info != null)
|
||||
{
|
||||
Vec3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView();
|
||||
Vector3d projected = Minecraft.getInstance().getRenderManager().info.getProjectedView();
|
||||
|
||||
MatrixStack matrix = event.getMatrixStack();
|
||||
matrix.push();
|
||||
|
||||
@@ -17,7 +17,7 @@ public class DummyScreen extends Screen
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init()
|
||||
protected void func_231160_c_()
|
||||
{
|
||||
this.runnable.run();
|
||||
}
|
||||
|
||||
@@ -1,63 +1,66 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.button.Button;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiButtonBase extends Button
|
||||
{
|
||||
public GuiButtonBase(int x, int y, int widthIn, int heightIn, String buttonText, ActionHandler actionHandler)
|
||||
public GuiButtonBase(int x, int y, int widthIn, int heightIn, ITextComponent buttonText, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, button -> ActionHelper.tryRun(actionHandler));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
this.renderBg(Minecraft.getInstance(), mouseX, mouseY);
|
||||
this.drawCenteredString(Minecraft.getInstance().fontRenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, this.getFGColor());
|
||||
this.func_230441_a_(matrix, Minecraft.getInstance(), mouseX, mouseY); //renderBg
|
||||
this.func_238472_a_(matrix, Minecraft.getInstance().fontRenderer, this.func_230458_i_(), this.field_230690_l_ + this.field_230688_j_ / 2, this.field_230691_m_ + (this.field_230689_k_ - 8) / 2, this.getFGColor()); //drawCenteredString
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(Minecraft minecraft, int mouseX, int mouseY)
|
||||
protected void func_230441_a_(MatrixStack matrix, Minecraft minecraft, int mouseX, int mouseY) //renderBg
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
RenderUtils.color(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
|
||||
int hovered = this.getYImage(this.isHovered());
|
||||
int hovered = this.func_230989_a_(this.func_230449_g_());
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getButtonTexture());
|
||||
|
||||
int hWidth = this.width / 2;
|
||||
int hHeight = this.height / 2;
|
||||
int hWidth = this.field_230688_j_ / 2;
|
||||
int hHeight = this.field_230689_k_ / 2;
|
||||
|
||||
if(Config.getSkin().getTextureType().equals("resourcepack"))
|
||||
{
|
||||
int textureOffset = 46 + hovered * 20;
|
||||
|
||||
this.blit(this.x, this.y, 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(this.x, this.y + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(this.x + hWidth, this.y, 200 - hWidth, textureOffset, hWidth, hHeight);
|
||||
this.blit(this.x + hWidth, this.y + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_, 0, textureOffset, hWidth, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_ + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + hWidth, this.field_230691_m_, 200 - hWidth, textureOffset, hWidth, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + hWidth, this.field_230691_m_ + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight); //blit
|
||||
}
|
||||
else
|
||||
{
|
||||
int textureOffset = hovered * 20;
|
||||
|
||||
this.blit(this.x, this.y, 0, textureOffset, hWidth, hHeight);
|
||||
this.blit(this.x, this.y + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.blit(this.x + hWidth, this.y, 200 - hWidth, textureOffset, this.width / 2, hHeight);
|
||||
this.blit(this.x + hWidth, this.y + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_, 0, textureOffset, hWidth, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_ + hHeight, 0, textureOffset + 20 - hHeight, hWidth, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + hWidth, this.field_230691_m_, 200 - hWidth, textureOffset, this.field_230688_j_ / 2, hHeight); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + hWidth, this.field_230691_m_ + hHeight, 200 - hWidth, textureOffset + 20 - hHeight, hWidth, hHeight); //blit
|
||||
}
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -13,36 +15,36 @@ public class GuiButtonIcon extends GuiButtonTooltip
|
||||
{
|
||||
private final EnumIcon icon;
|
||||
|
||||
public GuiButtonIcon(int x, int y, int widthIn, int heightIn, EnumIcon icon, String tooltip, ActionHandler actionHandler)
|
||||
public GuiButtonIcon(int x, int y, int widthIn, int heightIn, EnumIcon icon, ITextComponent tooltip, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, tooltip, tooltip, actionHandler);
|
||||
this.icon = icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
super.renderBg(Minecraft.getInstance(), mouseX, mouseY);
|
||||
super.func_230441_a_(matrix, Minecraft.getInstance(), mouseX, mouseY); //renderBg
|
||||
|
||||
if(this.icon != null)
|
||||
{
|
||||
this.renderIcon();
|
||||
this.renderIcon(matrix);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderIcon()
|
||||
private void renderIcon(MatrixStack matrix)
|
||||
{
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
|
||||
|
||||
if(this.active)
|
||||
if(this.field_230693_o_)
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderSystem.color4f(0.8F, 0.8F, 0.8F, 1.0F);
|
||||
RenderUtils.color(0.8F, 0.8F, 0.8F, 1.0F);
|
||||
}
|
||||
|
||||
this.blit(this.x + this.width / 2 - 4, this.y + this.height / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + this.field_230688_j_ / 2 - 4, this.field_230691_m_ + this.field_230689_k_ / 2 - 4, this.icon.getX() * 8, this.icon.getY() * 8, 8, 8); //blit
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -19,14 +21,14 @@ public class GuiButtonItem extends GuiButtonBase
|
||||
|
||||
public GuiButtonItem(int x, int y, int width, int height, ItemStack stack, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, width, height, stack.getTextComponent().getString(), actionHandler);
|
||||
super(x, y, width, height, stack.getTextComponent(), actionHandler);
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
super.renderBg(Minecraft.getInstance(), mouseX, mouseY);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(this.stack, this.x + this.width / 2 - 8, this.y + 2);
|
||||
super.func_230441_a_(matrix, Minecraft.getInstance(), mouseX, mouseY); //renderBg
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(this.stack, this.field_230690_l_ + this.field_230688_j_ / 2 - 8, this.field_230691_m_ + 2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,17 @@ package exopandora.worldhandler.gui.button;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.impl.ILogicMapped;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -20,7 +25,7 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
|
||||
public GuiButtonList(int x, int y, List<T> items, int widthIn, int heightIn, Container container, ILogicMapped<T> logic)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, null, null, null);
|
||||
super(x, y, widthIn, heightIn, StringTextComponent.field_240750_d_, null, null);
|
||||
this.items = items;
|
||||
this.logic = logic;
|
||||
this.persistence = container.getContent().getPersistence(this.logic.getId(), Persistence::new);
|
||||
@@ -34,46 +39,46 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
super.renderBg(Minecraft.getInstance(), mouseX, mouseY);
|
||||
this.func_230441_a_(matrix, Minecraft.getInstance(), mouseX, mouseY); //renderBg
|
||||
this.updateMessage();
|
||||
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
|
||||
if(this.getMessage() != null && !this.getMessage().isEmpty())
|
||||
if(this.func_230458_i_() != null && !this.func_230458_i_().getString().isEmpty())
|
||||
{
|
||||
String leftArrow = this.isHoveringLeft(mouseX, mouseY) ? TextFormatting.BOLD + "<" + TextFormatting.RESET : "<";
|
||||
String rightArrow = this.isHoveringRight(mouseX, mouseY) ? TextFormatting.BOLD + ">" + TextFormatting.RESET : ">";
|
||||
ITextComponent leftArrow = this.isHoveringLeft(mouseX, mouseY) ? TextUtils.ARROW_LEFT_BOLD : TextUtils.ARROW_LEFT;
|
||||
ITextComponent rightArrow = this.isHoveringRight(mouseX, mouseY) ? TextUtils.ARROW_RIGHT_BOLD : TextUtils.ARROW_RIGHT;
|
||||
|
||||
int maxWidth = Math.max(0, this.width - fontRenderer.getStringWidth("< >"));
|
||||
int maxWidth = Math.max(0, this.field_230688_j_ - fontRenderer.getStringWidth("< >"));
|
||||
int spaceWidth = fontRenderer.getStringWidth(" ");
|
||||
|
||||
String display = exopandora.worldhandler.util.TextFormatting.shortenString(this.getMessage(), maxWidth, fontRenderer);
|
||||
int yPos = this.y + (this.height - 8) / 2;
|
||||
ITextComponent display = TextUtils.stripText((IFormattableTextComponent) this.func_230458_i_(), maxWidth, fontRenderer);
|
||||
int yPos = this.field_230691_m_ + (this.field_230689_k_ - 8) / 2;
|
||||
|
||||
this.drawCenteredString(fontRenderer, display, this.x + this.width / 2, yPos, this.getFGColor());
|
||||
this.drawCenteredString(fontRenderer, leftArrow, this.x + this.width / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
||||
this.drawCenteredString(fontRenderer, rightArrow, this.x + this.width / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
||||
this.func_238472_a_(matrix, fontRenderer, display, this.field_230690_l_ + this.field_230688_j_ / 2, yPos, this.getFGColor());
|
||||
this.func_238472_a_(matrix, fontRenderer, leftArrow, this.field_230690_l_ + this.field_230688_j_ / 2 - maxWidth / 2 - spaceWidth, yPos, this.getFGColor());
|
||||
this.func_238472_a_(matrix, fontRenderer, rightArrow, this.field_230690_l_ + this.field_230688_j_ / 2 + maxWidth / 2 + spaceWidth, yPos, this.getFGColor());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTooltip(int mouseX, int mouseY)
|
||||
public void renderTooltip(MatrixStack matrix, int mouseX, int mouseY)
|
||||
{
|
||||
this.tooltip = this.logic.formatTooltip(this.items.get(this.persistence.getIndex()), this.persistence.getIndex() + 1, this.items.size());
|
||||
super.renderTooltip(mouseX, mouseY);
|
||||
super.renderTooltip(matrix, mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY)
|
||||
public void func_230982_a_(double mouseX, double mouseY) //onClick
|
||||
{
|
||||
int max = this.items.size() - 1;
|
||||
int index = this.persistence.getIndex();
|
||||
|
||||
if(this.isHoveringLeft(mouseX, mouseY))
|
||||
{
|
||||
if(Screen.hasShiftDown())
|
||||
if(Screen.func_231173_s_())
|
||||
{
|
||||
if(index < 10)
|
||||
{
|
||||
@@ -98,7 +103,7 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
}
|
||||
else if(this.isHoveringRight(mouseX, mouseY))
|
||||
{
|
||||
if(Screen.hasShiftDown())
|
||||
if(Screen.func_231173_s_())
|
||||
{
|
||||
if(index > max - 10)
|
||||
{
|
||||
@@ -127,22 +132,22 @@ public class GuiButtonList<T> extends GuiButtonTooltip
|
||||
|
||||
private void updateMessage()
|
||||
{
|
||||
this.setMessage(this.logic.translate(this.items.get(this.persistence.getIndex())));
|
||||
this.func_238482_a_(this.logic.translate(this.items.get(this.persistence.getIndex()))); //setMessage
|
||||
}
|
||||
|
||||
private boolean isHoveringLeft(double mouseX, double mouseY)
|
||||
{
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.x && mouseX < this.x + Math.ceil(this.width / 2);
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.field_230690_l_ && mouseX < this.field_230690_l_ + Math.ceil(this.field_230688_j_ / 2);
|
||||
}
|
||||
|
||||
private boolean isHoveringRight(double mouseX, double mouseY)
|
||||
{
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.x + Math.ceil(this.width / 2) && mouseX < this.x + this.width;
|
||||
return this.isHoveringVertical(mouseY) && mouseX >= this.field_230690_l_ + Math.ceil(this.field_230688_j_ / 2) && mouseX < this.field_230690_l_ + this.field_230688_j_;
|
||||
}
|
||||
|
||||
private boolean isHoveringVertical(double mouseY)
|
||||
{
|
||||
return mouseY >= this.y && mouseY < this.y + this.height;
|
||||
return mouseY >= this.field_230691_m_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.audio.SimpleSound;
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -22,7 +24,7 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
private final SoundEvent sound;
|
||||
private final float pitch;
|
||||
|
||||
public GuiButtonPiano(int x, int y, int widthIn, int heightIn, String buttonText, SoundEvent sound, float pitch, Type type, ActionHandler actionHandler)
|
||||
public GuiButtonPiano(int x, int y, int widthIn, int heightIn, ITextComponent buttonText, SoundEvent sound, float pitch, Type type, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, actionHandler);
|
||||
this.sound = sound;
|
||||
@@ -31,28 +33,28 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
switch(this.type)
|
||||
{
|
||||
case LEFT:
|
||||
this.isHovered = this.isHoveringLeft(mouseX, mouseY);
|
||||
this.field_230692_n_ = this.isHoveringLeft(mouseX, mouseY);
|
||||
break;
|
||||
case NORMAL:
|
||||
this.isHovered = this.isHoveringNormal(mouseX, mouseY);
|
||||
this.field_230692_n_ = this.isHoveringNormal(mouseX, mouseY);
|
||||
break;
|
||||
case RIGHT:
|
||||
this.isHovered = this.isHoveringRight(mouseX, mouseY);
|
||||
this.field_230692_n_ = this.isHoveringRight(mouseX, mouseY);
|
||||
break;
|
||||
case BLACK:
|
||||
this.isHovered = this.isHoveringBlack(mouseX, mouseY);
|
||||
this.field_230692_n_ = this.isHoveringBlack(mouseX, mouseY);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
int hoverstate = this.getYImage(this.isHovered);
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlphaF());
|
||||
int hovered = this.func_230989_a_(this.func_230449_g_());
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, Config.getSkin().getButtonAlphaF());
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
|
||||
|
||||
switch(this.type)
|
||||
@@ -60,28 +62,28 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
case LEFT:
|
||||
case NORMAL:
|
||||
case RIGHT:
|
||||
this.drawWhiteKey(hoverstate);
|
||||
this.drawWhiteKey(matrix, hovered);
|
||||
break;
|
||||
case BLACK:
|
||||
this.drawBlackKey(hoverstate);
|
||||
this.drawBlackKey(matrix, hovered);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawWhiteKey(int hoverstate)
|
||||
protected void drawWhiteKey(MatrixStack matrix, int hoverstate)
|
||||
{
|
||||
int textColor = this.getFGColor();
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
|
||||
this.blit(this.x, this.y, 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||
fontRenderer.drawString(this.getMessage(), this.x + this.width / 2 - fontRenderer.getStringWidth(this.getMessage()) / 2, this.y + (this.height - 8) / 2 + 36, textColor);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_, 25 + hoverstate * 15 - 15, 0, 15, 92);
|
||||
fontRenderer.func_238422_b_(matrix, this.func_230458_i_(), (float) (this.field_230690_l_ + this.field_230688_j_ / 2 - fontRenderer.func_238414_a_(this.func_230458_i_()) / 2), (float) (this.field_230691_m_ + (this.field_230689_k_ - 8) / 2 + 36), textColor); //drawString
|
||||
}
|
||||
|
||||
protected void drawBlackKey(int hoverstate)
|
||||
protected void drawBlackKey(MatrixStack matrix, int hoverstate)
|
||||
{
|
||||
this.blit(this.x, this.y, 55 + hoverstate * -9 + 18, 0, 9, 58);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_, this.field_230691_m_, 55 + hoverstate * -9 + 18, 0, 9, 58); //blit
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,11 +91,11 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
{
|
||||
int textColor = 0x000000;
|
||||
|
||||
if(!this.active)
|
||||
if(!this.field_230693_o_)
|
||||
{
|
||||
textColor = 0xA0A0A0;
|
||||
}
|
||||
else if (this.isHovered())
|
||||
else if (this.func_230449_g_())
|
||||
{
|
||||
textColor = 0x8B8B8B;
|
||||
}
|
||||
@@ -102,53 +104,53 @@ public class GuiButtonPiano extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playDownSound(SoundHandler soundHandler)
|
||||
public void func_230988_a_(SoundHandler soundHandler) //playDownSound
|
||||
{
|
||||
soundHandler.play(SimpleSound.master(this.sound, this.pitch));
|
||||
}
|
||||
|
||||
private boolean isHoveringBlack(double mouseX, double mouseY)
|
||||
{
|
||||
return mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
|
||||
return mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + this.field_230688_j_ && mouseY < this.field_230691_m_ + this.field_230689_k_;
|
||||
}
|
||||
|
||||
private boolean isHoveringLeft(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x && mouseY >= this.y && mouseX < this.x + 10 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + 10 && mouseY < this.field_230691_m_ + 60) || (mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ + 58 && mouseX < this.field_230690_l_ + 14 && mouseY < this.field_230691_m_ + 93);
|
||||
}
|
||||
|
||||
private boolean isHoveringNormal(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x + 4 && mouseY >= this.y && mouseX < this.x + 10 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.field_230690_l_ + 4 && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + 10 && mouseY < this.field_230691_m_ + 60) || (mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ + 58 && mouseX < this.field_230690_l_ + 14 && mouseY < this.field_230691_m_ + 93);
|
||||
}
|
||||
|
||||
private boolean isHoveringRight(double mouseX, double mouseY)
|
||||
{
|
||||
return (mouseX >= this.x + 4 && mouseY >= this.y && mouseX < this.x + 14 && mouseY < this.y + 60) || (mouseX >= this.x && mouseY >= this.y + 58 && mouseX < this.x + 14 && mouseY < this.y + 93);
|
||||
return (mouseX >= this.field_230690_l_ + 4 && mouseY >= this.field_230691_m_ && mouseX < this.field_230690_l_ + 14 && mouseY < this.field_230691_m_ + 60) || (mouseX >= this.field_230690_l_ && mouseY >= this.field_230691_m_ + 58 && mouseX < this.field_230690_l_ + 14 && mouseY < this.field_230691_m_ + 93);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY)
|
||||
public boolean func_231047_b_(double mouseX, double mouseY) //isMouseOver
|
||||
{
|
||||
switch(this.type)
|
||||
{
|
||||
case LEFT:
|
||||
return this.active && this.visible && this.isHoveringLeft(mouseX, mouseY);
|
||||
return this.field_230693_o_ && this.field_230694_p_ && this.isHoveringLeft(mouseX, mouseY);
|
||||
case NORMAL:
|
||||
return this.active && this.visible && this.isHoveringNormal(mouseX, mouseY);
|
||||
return this.field_230693_o_ && this.field_230694_p_ && this.isHoveringNormal(mouseX, mouseY);
|
||||
case RIGHT:
|
||||
return this.active && this.visible && this.isHoveringRight(mouseX, mouseY);
|
||||
return this.field_230693_o_ && this.field_230694_p_ && this.isHoveringRight(mouseX, mouseY);
|
||||
case BLACK:
|
||||
return this.active && this.visible && this.isHoveringBlack(mouseX, mouseY);
|
||||
return this.field_230693_o_ && this.field_230694_p_ && this.isHoveringBlack(mouseX, mouseY);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean clicked(double mouseX, double mouseY)
|
||||
protected boolean func_230992_c_(double mouseX, double mouseY) //clicked
|
||||
{
|
||||
return this.isMouseOver(mouseX, mouseY);
|
||||
return this.func_231047_b_(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.audio.SoundHandler;
|
||||
import net.minecraft.client.gui.widget.button.AbstractButton;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public abstract class GuiButtonTab extends AbstractButton
|
||||
{
|
||||
public GuiButtonTab(int x, int y, int widthIn, int heightIn, String narration)
|
||||
public GuiButtonTab(int x, int y, int widthIn, int heightIn, ITextComponent narration)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, narration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230430_a_(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) //render
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void playDownSound(SoundHandler soundHandlerIn)
|
||||
public void func_230988_a_(SoundHandler soundHandler) //playDownSound
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ package exopandora.worldhandler.gui.button;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
@@ -12,27 +15,27 @@ import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiButtonTooltip extends GuiButtonBase
|
||||
{
|
||||
protected String tooltip;
|
||||
protected ITextComponent tooltip;
|
||||
|
||||
public GuiButtonTooltip(int x, int y, int widthIn, int heightIn, String buttonText, String tooltip, ActionHandler actionHandler)
|
||||
public GuiButtonTooltip(int x, int y, int widthIn, int heightIn, ITextComponent buttonText, ITextComponent tooltip, ActionHandler actionHandler)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, buttonText, actionHandler);
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public void renderTooltip(int mouseX, int mouseY)
|
||||
public void renderTooltip(MatrixStack matrix, int mouseX, int mouseY)
|
||||
{
|
||||
if(this.isHovered() && this.tooltip != null && !this.tooltip.isEmpty())
|
||||
if(this.func_230449_g_() && this.tooltip != null && !this.tooltip.getString().isEmpty())
|
||||
{
|
||||
List<String> list = Arrays.asList(this.tooltip.split("\n"));
|
||||
List<ITextComponent> list = Arrays.asList(this.tooltip);
|
||||
|
||||
if(!list.isEmpty())
|
||||
{
|
||||
int tooltipWidth = Minecraft.getInstance().fontRenderer.getStringWidth(this.tooltip) + 9;
|
||||
int width = Minecraft.getInstance().currentScreen.width;
|
||||
int height = Minecraft.getInstance().currentScreen.height;
|
||||
int tooltipWidth = Minecraft.getInstance().fontRenderer.func_238414_a_(this.tooltip) + 9;
|
||||
int width = Minecraft.getInstance().currentScreen.field_230708_k_;
|
||||
int height = Minecraft.getInstance().currentScreen.field_230709_l_;
|
||||
|
||||
GuiUtils.drawHoveringText(list, mouseX, mouseY, width, height, tooltipWidth, Minecraft.getInstance().fontRenderer);
|
||||
GuiUtils.drawHoveringText(matrix, list, mouseX, mouseY, width, height, tooltipWidth, Minecraft.getInstance().fontRenderer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,18 @@ package exopandora.worldhandler.gui.button;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.util.ILogic;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -22,7 +26,7 @@ public class GuiSlider extends GuiButtonBase
|
||||
|
||||
public GuiSlider(int x, int y, int widthIn, int heightIn, double min, double max, double start, Container container, ILogicSlider logic)
|
||||
{
|
||||
super(x, y, widthIn, heightIn, null, null);
|
||||
super(x, y, widthIn, heightIn, StringTextComponent.field_240750_d_, null);
|
||||
this.logic = Objects.requireNonNull(logic);
|
||||
this.container = Objects.requireNonNull(container);
|
||||
this.persistence = this.container.getContent().getPersistence(this.logic.getId(), () -> new Persistence(min, max, min == max ? 0.0 : ((start - min) / (max - min))));
|
||||
@@ -32,40 +36,38 @@ public class GuiSlider extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBg(Minecraft minecraft, int mouseX, int mouseY)
|
||||
protected void func_230441_a_(MatrixStack matrix, Minecraft minecraft, int mouseX, int mouseY) //renderBg
|
||||
{
|
||||
super.renderBg(minecraft, mouseX, mouseY);
|
||||
super.func_230441_a_(matrix, minecraft, mouseX, mouseY); //renderBg
|
||||
|
||||
int hovered = super.getYImage(this.isHovered());
|
||||
int hovered = super.func_230989_a_(this.func_230449_g_());
|
||||
int textureOffset = (Config.getSkin().getTextureType().equals("resourcepack") ? 46 : 0) + hovered * 20;
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
RenderUtils.color(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
|
||||
this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)), this.y, 0, textureOffset, 4, 20);
|
||||
this.blit(this.x + (int) (this.persistence.getValue() * (float) (this.width - 8)) + 4, this.y, 196, textureOffset, 4, 20);
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + (int) (this.persistence.getValue() * (float) (this.field_230688_j_ - 8)), this.field_230691_m_, 0, textureOffset, 4, 20); //blit
|
||||
this.func_238474_b_(matrix, this.field_230690_l_ + (int) (this.persistence.getValue() * (float) (this.field_230688_j_ - 8)) + 4, this.field_230691_m_, 196, textureOffset, 4, 20); //blit
|
||||
|
||||
RenderSystem.disableBlend();
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(double mouseX, double mouseY)
|
||||
public void func_230982_a_(double mouseX, double mouseY) //onClick
|
||||
{
|
||||
this.updateSlider(mouseX);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY)
|
||||
protected void func_230983_a_(double mouseX, double mouseY, double deltaX, double deltaY) //onDrag
|
||||
{
|
||||
this.updateSlider(mouseX);
|
||||
super.onDrag(mouseX, mouseY, deltaX, deltaY);
|
||||
super.func_230983_a_(mouseX, mouseY, deltaX, deltaY); //onDrag
|
||||
}
|
||||
|
||||
protected void updateSlider(double mouseX)
|
||||
{
|
||||
this.persistence.setValue((mouseX - (this.x + 4)) / (float) (this.width - 8));
|
||||
this.persistence.setValue((mouseX - (this.field_230690_l_ + 4)) / (float) (this.field_230688_j_ - 8));
|
||||
|
||||
if(this.persistence.getValue() < 0.0F)
|
||||
{
|
||||
@@ -82,7 +84,7 @@ public class GuiSlider extends GuiButtonBase
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getYImage(boolean mouseOver)
|
||||
protected int func_230989_a_(boolean mouseOver) //getYImage
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -90,17 +92,18 @@ public class GuiSlider extends GuiButtonBase
|
||||
private void updateDisplayString()
|
||||
{
|
||||
int value = this.persistence.getValueInt();
|
||||
String suffix = this.logic.formatValue(value) + this.logic.formatSuffix(value);
|
||||
IFormattableTextComponent suffix = this.logic.formatValue(value).func_230529_a_(this.logic.formatSuffix(value));
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
this.setMessage(TextFormatting.shortenString(this.logic.formatPrefix(value), this.width - fontRenderer.getStringWidth(suffix), fontRenderer) + suffix);
|
||||
IFormattableTextComponent text = TextUtils.stripText(this.logic.formatPrefix(value), this.field_230688_j_ - fontRenderer.func_238414_a_(suffix), fontRenderer).func_230529_a_(suffix);
|
||||
this.func_238482_a_(text); //setMessage
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static interface ILogicSlider extends ILogic
|
||||
{
|
||||
String formatPrefix(int value);
|
||||
String formatSuffix(int value);
|
||||
String formatValue(int value);
|
||||
IFormattableTextComponent formatPrefix(int value);
|
||||
IFormattableTextComponent formatSuffix(int value);
|
||||
IFormattableTextComponent formatValue(int value);
|
||||
|
||||
void onChangeSliderValue(int value);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package exopandora.worldhandler.gui.button;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -9,14 +12,14 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class GuiTextFieldTooltip extends TextFieldWidget
|
||||
{
|
||||
private String tooltip;
|
||||
private ITextComponent tooltip;
|
||||
|
||||
public GuiTextFieldTooltip(int x, int y, int width, int height)
|
||||
{
|
||||
this(x, y, width, height, null);
|
||||
}
|
||||
|
||||
public GuiTextFieldTooltip(int x, int y, int width, int height, String tooltip)
|
||||
public GuiTextFieldTooltip(int x, int y, int width, int height, ITextComponent tooltip)
|
||||
{
|
||||
super(Minecraft.getInstance().fontRenderer, x, y, width, height, null);
|
||||
this.setMaxStringLength(Integer.MAX_VALUE);
|
||||
@@ -24,43 +27,45 @@ public class GuiTextFieldTooltip extends TextFieldWidget
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderButton(int x, int y, float partialTicks)
|
||||
public void func_230431_b_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //renderButton
|
||||
{
|
||||
super.renderButton(x, y, partialTicks);
|
||||
super.func_230431_b_(matrix, mouseX, mouseY, partialTicks); // renderButton
|
||||
|
||||
if(this.getVisible() && !this.isFocused() && this.tooltip != null && TextFormatting.getTextWithoutFormattingCodes(this.getText()).isEmpty())
|
||||
if(this.getVisible() && !this.func_230999_j_() && this.tooltip != null && TextFormatting.getTextWithoutFormattingCodes(this.getText()).isEmpty())
|
||||
{
|
||||
boolean enableBackgroundDrawing = this.getAdjustedWidth() != this.width;
|
||||
int tx = enableBackgroundDrawing ? this.x + 4 : this.x;
|
||||
int ty = enableBackgroundDrawing ? this.y + (this.height - 8) / 2 : this.y;
|
||||
boolean enableBackgroundDrawing = this.getAdjustedWidth() != this.field_230688_j_;
|
||||
int tx = enableBackgroundDrawing ? this.field_230690_l_ + 4 : this.field_230690_l_;
|
||||
int ty = enableBackgroundDrawing ? this.field_230691_m_ + (this.field_230689_k_ - 8) / 2 : this.field_230691_m_;
|
||||
|
||||
Minecraft.getInstance().fontRenderer.drawStringWithShadow(this.tooltip, (float) tx, (float) ty, 0x7F7F7F);
|
||||
Minecraft.getInstance().fontRenderer.func_238407_a_(matrix, this.tooltip, (float) tx, (float) ty, 0x7F7F7F); //drawStringWithShadow
|
||||
}
|
||||
}
|
||||
|
||||
public void setTooltip(String tooltip)
|
||||
public void setTooltip(ITextComponent tooltip)
|
||||
{
|
||||
this.tooltip = tooltip;
|
||||
}
|
||||
|
||||
public String getTooltip()
|
||||
public ITextComponent getTooltip()
|
||||
{
|
||||
return this.tooltip;
|
||||
}
|
||||
|
||||
public void setPosition(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.field_230690_l_ = x;
|
||||
this.field_230691_m_ = y;
|
||||
}
|
||||
|
||||
public void setWidth(int width)
|
||||
public void setText(ITextComponent text)
|
||||
{
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public void setHeight(int height)
|
||||
{
|
||||
this.height = height;
|
||||
if(text != null)
|
||||
{
|
||||
this.setText(text.getString());
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setText((String) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,24 +2,23 @@ package exopandora.worldhandler.gui.button;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import net.minecraft.entity.ai.attributes.Attribute;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class LogicSliderAttribute extends LogicSliderSimple
|
||||
{
|
||||
private final EnumAttributes attribute;
|
||||
|
||||
public LogicSliderAttribute(EnumAttributes attribute, String text, Consumer<Integer> listener)
|
||||
public LogicSliderAttribute(Attribute attribute, IFormattableTextComponent text, Consumer<Integer> listener)
|
||||
{
|
||||
super(attribute.getAttribute(), text, listener);
|
||||
this.attribute = attribute;
|
||||
super(attribute.getRegistryName().toString(), text, listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatSuffix(int value)
|
||||
public IFormattableTextComponent formatSuffix(int value)
|
||||
{
|
||||
return " " + this.attribute.getOperation().getDeclaration();
|
||||
return new StringTextComponent("%");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package exopandora.worldhandler.gui.button;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiSlider.ILogicSlider;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -10,10 +12,10 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public class LogicSliderSimple implements ILogicSlider
|
||||
{
|
||||
private final String id;
|
||||
private final String text;
|
||||
private final IFormattableTextComponent text;
|
||||
private final Consumer<Integer> listener;
|
||||
|
||||
public LogicSliderSimple(String id, String text, Consumer<Integer> listener)
|
||||
public LogicSliderSimple(String id, IFormattableTextComponent text, Consumer<Integer> listener)
|
||||
{
|
||||
this.id = id;
|
||||
this.text = text;
|
||||
@@ -21,21 +23,21 @@ public class LogicSliderSimple implements ILogicSlider
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatPrefix(int value)
|
||||
public IFormattableTextComponent formatPrefix(int value)
|
||||
{
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatSuffix(int value)
|
||||
public IFormattableTextComponent formatSuffix(int value)
|
||||
{
|
||||
return "";
|
||||
return new StringTextComponent("");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatValue(int value)
|
||||
public IFormattableTextComponent formatValue(int value)
|
||||
{
|
||||
return ": " + String.valueOf(value);
|
||||
return new StringTextComponent(": " + String.valueOf(value));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -23,21 +23,20 @@ public abstract class Container extends Screen implements IContainer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
public void func_231160_c_()
|
||||
{
|
||||
super.init();
|
||||
super.func_231160_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Widget> T add(T button)
|
||||
{
|
||||
return super.addButton(button);
|
||||
return super.func_230480_a_(button);
|
||||
}
|
||||
|
||||
public <T extends TextFieldWidget> T add(T textfield)
|
||||
{
|
||||
this.children.add(textfield);
|
||||
return textfield;
|
||||
return super.func_230481_d_(textfield);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.function.BiConsumer;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
@@ -25,15 +26,18 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.IContent;
|
||||
import exopandora.worldhandler.gui.menu.IMenu;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
import exopandora.worldhandler.util.UtilRender;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.vector.Quaternion;
|
||||
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.fml.client.gui.GuiUtils;
|
||||
@@ -62,7 +66,7 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
public GuiWorldHandler(Content content) throws Exception
|
||||
{
|
||||
super(new StringTextComponent(content.getTitle()));
|
||||
super(content.getTitle());
|
||||
this.content = content;
|
||||
this.tabSize = this.content.getCategory().getSize();
|
||||
this.tabDistanceTotal = Math.max(this.tabSize - 1, 1) * this.tabDistance;
|
||||
@@ -73,16 +77,16 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
public void func_231160_c_()
|
||||
{
|
||||
super.init();
|
||||
super.func_231160_c_();
|
||||
|
||||
ActionHelper.tryRun(() ->
|
||||
{
|
||||
this.finalButtons.clear();
|
||||
this.menus.clear();
|
||||
this.buttons.clear();
|
||||
this.children.clear();
|
||||
this.field_230710_m_.clear();
|
||||
this.field_230705_e_.clear();
|
||||
|
||||
//INIT
|
||||
this.content.onPlayerNameChanged(this.getPlayer());
|
||||
@@ -97,33 +101,33 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
//SHORTCUTS
|
||||
|
||||
final int x = this.width / 2 - 10;
|
||||
final int x = this.field_230708_k_ / 2 - 10;
|
||||
final int delta = 21;
|
||||
|
||||
if(Config.getSettings().shortcuts())
|
||||
{
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 7, 0, 20, 20, EnumIcon.TIME_DAWN, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 6, 0, 20, 20, EnumIcon.TIME_NOON, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 5, 0, 20, 20, EnumIcon.TIME_SUNSET, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 4, 0, 20, 20, EnumIcon.TIME_MIDNIGHT, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 3, 0, 20, 20, EnumIcon.WEATHER_SUN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 2, 0, 20, 20, EnumIcon.WEATHER_RAIN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 1, 0, 20, 20, EnumIcon.WEATHER_STORM, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 0, 0, 20, 20, EnumIcon.DIFFICULTY_PEACEFUL, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 1, 0, 20, 20, EnumIcon.DIFFICULTY_EASY, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 2, 0, 20, 20, EnumIcon.DIFFICULTY_NORMAL, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 3, 0, 20, 20, EnumIcon.DIFFICULTY_HARD, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 4, 0, 20, 20, EnumIcon.GAMEMODE_SURVIVAL, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 5, 0, 20, 20, EnumIcon.GAMEMODE_CREATIVE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 6, 0, 20, 20, EnumIcon.GAMEMODE_ADVENTURE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 7, 0, 20, 20, EnumIcon.GAMEMODE_SPECTATOR, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 7, 0, 20, 20, EnumIcon.TIME_DAWN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 6, 0, 20, 20, EnumIcon.TIME_NOON, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 5, 0, 20, 20, EnumIcon.TIME_SUNSET, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 4, 0, 20, 20, EnumIcon.TIME_MIDNIGHT, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 3, 0, 20, 20, EnumIcon.WEATHER_SUN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 2, 0, 20, 20, EnumIcon.WEATHER_RAIN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 1, 0, 20, 20, EnumIcon.WEATHER_STORM, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
this.finalButtons.add(new GuiButtonIcon(x - delta * 0, 0, 20, 20, EnumIcon.DIFFICULTY_PEACEFUL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 1, 0, 20, 20, EnumIcon.DIFFICULTY_EASY, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 2, 0, 20, 20, EnumIcon.DIFFICULTY_NORMAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 3, 0, 20, 20, EnumIcon.DIFFICULTY_HARD, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 4, 0, 20, 20, EnumIcon.GAMEMODE_SURVIVAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 5, 0, 20, 20, EnumIcon.GAMEMODE_CREATIVE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 6, 0, 20, 20, EnumIcon.GAMEMODE_ADVENTURE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
this.finalButtons.add(new GuiButtonIcon(x + delta * 7, 0, 20, 20, EnumIcon.GAMEMODE_SPECTATOR, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
}
|
||||
|
||||
//SYNTAX
|
||||
|
||||
if(Config.getSettings().commandSyntax())
|
||||
{
|
||||
this.syntaxField = new GuiTextFieldTooltip(x - delta * 7 + 1, this.height - 22, delta * 15 - 3, 20);
|
||||
this.syntaxField = new GuiTextFieldTooltip(x - delta * 7 + 1, this.field_230709_l_ - 22, delta * 15 - 3, 20);
|
||||
this.updateSyntax();
|
||||
}
|
||||
|
||||
@@ -158,7 +162,7 @@ public class GuiWorldHandler extends Container
|
||||
this.finalButtons.add(new GuiButtonTab((int) (backgroundX + xOffset), backgroundY - 20, (int) this.tabWidth + (int) Math.ceil(this.tabEpsilon / this.tabSize), 21, tab.getTabTitle())
|
||||
{
|
||||
@Override
|
||||
public void onPress()
|
||||
public void func_230930_b_() //onPress
|
||||
{
|
||||
ActionHelper.changeTab(GuiWorldHandler.this.content, index);
|
||||
}
|
||||
@@ -168,8 +172,8 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
public void initButtons()
|
||||
{
|
||||
this.buttons.clear();
|
||||
this.children.clear();
|
||||
this.field_230710_m_.clear();
|
||||
this.field_230705_e_.clear();
|
||||
this.content.initButtons(this, this.getContentX(), this.getContentY());
|
||||
|
||||
if(this.finalButtons != null && !this.finalButtons.isEmpty())
|
||||
@@ -191,7 +195,7 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
public void func_231023_e_() //tick
|
||||
{
|
||||
ActionHelper.tryRun(this::update);
|
||||
}
|
||||
@@ -210,12 +214,12 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
private int getBackgroundX()
|
||||
{
|
||||
return (this.width - this.bgTextureWidth) / 2 + this.getXOffset();
|
||||
return (this.field_230708_k_ - this.bgTextureWidth) / 2 + this.getXOffset();
|
||||
}
|
||||
|
||||
private int getBackgroundY()
|
||||
{
|
||||
return (this.height - this.bgTextureHeight) / 2 + this.getYOffset();
|
||||
return (this.field_230709_l_ - this.bgTextureHeight) / 2 + this.getYOffset();
|
||||
}
|
||||
|
||||
private int getWatchOffset()
|
||||
@@ -238,7 +242,7 @@ public class GuiWorldHandler extends Container
|
||||
{
|
||||
if(Config.getSettings().commandSyntax() && this.syntaxField != null)
|
||||
{
|
||||
if(!this.syntaxField.isFocused())
|
||||
if(!this.syntaxField.func_230999_j_()) //isFocused
|
||||
{
|
||||
this.syntaxField.setValidator(Predicates.alwaysTrue());
|
||||
|
||||
@@ -266,14 +270,14 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
if(GuiWorldHandler.player.isEmpty())
|
||||
{
|
||||
int width = this.font.getStringWidth(I18n.format("gui.worldhandler.generic.edit_username")) + 2;
|
||||
this.nameField.setWidth(width);
|
||||
this.nameField.setPosition(backgroundX + this.bgTextureWidth - this.getWatchOffset() - 7 - (this.font.getStringWidth(this.content.getTitle()) + 2), backgroundY + 6);
|
||||
int width = this.field_230712_o_.getStringWidth(I18n.format("gui.worldhandler.generic.edit_username")) + 2;
|
||||
this.nameField.func_230991_b_(width); //setWidth
|
||||
this.nameField.setPosition(backgroundX + this.bgTextureWidth - this.getWatchOffset() - 7 - (this.field_230712_o_.func_238414_a_(this.content.getTitle()) + 2), backgroundY + 6);
|
||||
}
|
||||
else
|
||||
{
|
||||
int width = this.font.getStringWidth(GuiWorldHandler.player) + 2;
|
||||
this.nameField.setWidth(width);
|
||||
int width = this.field_230712_o_.getStringWidth(GuiWorldHandler.player) + 2;
|
||||
this.nameField.func_230991_b_(width); //setWidth
|
||||
this.nameField.setPosition(backgroundX + this.bgTextureWidth - this.getWatchOffset() - 7 - width, backgroundY + 6);
|
||||
}
|
||||
|
||||
@@ -281,7 +285,7 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(int mouseX, int mouseY, float partialTicks)
|
||||
public void func_230430_a_(MatrixStack matrix, int mouseX, int mouseY, float partialTicks) //render
|
||||
{
|
||||
ActionHelper.tryRun(() ->
|
||||
{
|
||||
@@ -292,8 +296,8 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
if(Config.getSkin().drawBackground())
|
||||
{
|
||||
this.setBlitOffset(-1);
|
||||
super.renderBackground();
|
||||
this.func_230926_e_(-1); //setBlitOffset
|
||||
super.func_230446_a_(matrix); //renderBackground
|
||||
}
|
||||
|
||||
//COLOR
|
||||
@@ -303,12 +307,12 @@ public class GuiWorldHandler extends Container
|
||||
//BACKGROUND
|
||||
|
||||
this.bindBackground();
|
||||
this.blit(backgroundX, backgroundY, 0, 0, this.bgTextureWidth, this.bgTextureHeight);
|
||||
this.func_238474_b_(matrix, backgroundX, backgroundY, 0, 0, this.bgTextureWidth, this.bgTextureHeight); //blit
|
||||
|
||||
//TABS
|
||||
|
||||
this.setBlitOffset(0);
|
||||
this.forEachTab(this::drawTab);
|
||||
this.func_230926_e_(0); //setBlitOffset
|
||||
this.forEachTab((index, xOffset) -> this.drawTab(matrix, index, xOffset));
|
||||
this.defaultColor();
|
||||
|
||||
//VERSION LABEL
|
||||
@@ -316,20 +320,20 @@ public class GuiWorldHandler extends Container
|
||||
final String label = Main.MC_VERSION + "-" + Main.MOD_VERSION;
|
||||
final int hexAlpha = (int) (0xFF * 0.2) << 24;
|
||||
final int color = Config.getSkin().getLabelColor() + hexAlpha;
|
||||
final int versionWidth = this.width - this.font.getStringWidth(label) - 2;
|
||||
final int versionHeight = this.height - 10;
|
||||
final int versionWidth = this.field_230708_k_ - this.field_230712_o_.getStringWidth(label) - 2;
|
||||
final int versionHeight = this.field_230709_l_ - 10;
|
||||
|
||||
this.font.drawString(label, versionWidth, versionHeight, color);
|
||||
this.field_230712_o_.func_238421_b_(matrix, label, versionWidth, versionHeight, color);
|
||||
|
||||
//TITLE
|
||||
|
||||
final int maxWidth = this.bgTextureWidth - 7 - 2 - this.font.getStringWidth(GuiWorldHandler.player) - 2 - this.getWatchOffset() - 7;
|
||||
this.font.drawString(TextFormatting.shortenString(this.content.getTitle(), maxWidth, this.font), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
final int maxWidth = this.bgTextureWidth - 7 - 2 - this.field_230712_o_.getStringWidth(GuiWorldHandler.player) - 2 - this.getWatchOffset() - 7;
|
||||
this.field_230712_o_.func_238422_b_(matrix, TextUtils.stripText(this.content.getTitle(), maxWidth, this.field_230712_o_), backgroundX + 7, backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
|
||||
//NAME FIELD
|
||||
|
||||
final String username = GuiWorldHandler.player.isEmpty() && !this.nameField.isFocused() ? I18n.format("gui.worldhandler.generic.edit_username") : GuiWorldHandler.player;
|
||||
this.font.drawString(username, backgroundX + 232 - this.font.getStringWidth(username), backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
final String username = GuiWorldHandler.player.isEmpty() && !this.nameField.func_230999_j_() ? I18n.format("gui.worldhandler.generic.edit_username") : GuiWorldHandler.player; //isFocused
|
||||
this.field_230712_o_.func_238421_b_(matrix, username, backgroundX + 232 - this.field_230712_o_.getStringWidth(username), backgroundY + 7, Config.getSkin().getLabelColor());
|
||||
|
||||
//WATCH
|
||||
|
||||
@@ -338,71 +342,72 @@ public class GuiWorldHandler extends Container
|
||||
final int watchX = backgroundX + 233;
|
||||
final int watchY = backgroundY + 5;
|
||||
|
||||
UtilRender.drawWatchIntoGui(this, watchX, watchY, Minecraft.getInstance().world.getWorldInfo().getDayTime(), Config.getSettings().smoothWatch());
|
||||
RenderUtils.drawWatchIntoGui(matrix, this, watchX, watchY, Minecraft.getInstance().world.getWorldInfo().getDayTime(), Config.getSettings().smoothWatch());
|
||||
|
||||
if(Config.getSettings().tooltips())
|
||||
{
|
||||
if(mouseX >= watchX && mouseX <= watchX + 9 && mouseY >= watchY && mouseY <= watchY + 9)
|
||||
{
|
||||
GuiUtils.drawHoveringText(Arrays.asList(TextFormatting.formatWorldTime(Minecraft.getInstance().world.getDayTime())), mouseX, mouseY + 9, this.width, this.height, this.width, this.font);
|
||||
RenderSystem.disableLighting();
|
||||
GuiUtils.drawHoveringText(matrix, Arrays.asList(new StringTextComponent(TextUtils.formatWorldTime(Minecraft.getInstance().world.getDayTime()))), mouseX, mouseY + 9, this.field_230708_k_, this.field_230709_l_, this.field_230708_k_, this.field_230712_o_);
|
||||
RenderUtils.disableLighting();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//BUTTONS
|
||||
|
||||
for(int x = 0; x < this.buttons.size(); x++)
|
||||
for(int x = 0; x < this.field_230710_m_.size(); x++)
|
||||
{
|
||||
this.buttons.get(x).render(mouseX, mouseY, partialTicks);
|
||||
this.field_230710_m_.get(x).func_230430_a_(matrix, mouseX, mouseY, partialTicks); //render
|
||||
}
|
||||
|
||||
//CONTAINER
|
||||
|
||||
this.content.drawScreen(this, this.getContentX(), this.getContentY(), mouseX, mouseY, partialTicks);
|
||||
this.content.drawScreen(matrix, this, this.getContentX(), this.getContentY(), mouseX, mouseY, partialTicks);
|
||||
|
||||
//MENUS
|
||||
|
||||
for(IMenu menu : this.menus)
|
||||
{
|
||||
menu.draw(mouseX, mouseY, partialTicks);
|
||||
menu.draw(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
//SYNTAX
|
||||
|
||||
if(Config.getSettings().commandSyntax() && this.syntaxField != null)
|
||||
{
|
||||
this.syntaxField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.syntaxField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
|
||||
//SPLASHTEXT
|
||||
|
||||
if(this.splash != null)
|
||||
{
|
||||
RenderSystem.pushMatrix();
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
RenderSystem.disableLighting();
|
||||
RenderSystem.translatef((float) (backgroundX + 212), backgroundY + 15, 0.0F);
|
||||
RenderSystem.rotatef(17.0F, 0.0F, 0.0F, 1.0F);
|
||||
RenderUtils.disableLighting();
|
||||
|
||||
matrix.push();
|
||||
matrix.translate((float) (backgroundX + 212), backgroundY + 15, 0.0F);
|
||||
matrix.rotate(new Quaternion(17.0F, 0.0F, 0.0F, 1.0F));
|
||||
|
||||
float scale = 1.1F - MathHelper.abs(MathHelper.sin((float) (System.currentTimeMillis() % 1000L) / 1000.0F * (float) Math.PI * 2.0F) * 0.1F);
|
||||
scale = scale * 100.0F / this.font.getStringWidth(this.splash);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
scale = scale * 100.0F / this.field_230712_o_.getStringWidth(this.splash);
|
||||
matrix.scale(scale, scale, scale);
|
||||
|
||||
this.drawCenteredString(this.font, this.splash, 0, (int) scale, 0xFFFF00);
|
||||
this.func_238471_a_(matrix, this.field_230712_o_, this.splash, 0, (int) scale, 0xFFFF00);
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
//TOOLTIPS
|
||||
|
||||
if(Config.getSettings().tooltips())
|
||||
{
|
||||
for(Widget button : this.buttons)
|
||||
for(Widget button : this.field_230710_m_)
|
||||
{
|
||||
if(button instanceof GuiButtonTooltip)
|
||||
{
|
||||
((GuiButtonTooltip) button).renderTooltip(mouseX, mouseY);
|
||||
((GuiButtonTooltip) button).renderTooltip(matrix, mouseX, mouseY);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -411,12 +416,12 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
if(mouseX >= versionWidth && mouseY >= versionHeight)
|
||||
{
|
||||
GuiUtils.drawHoveringText(Arrays.asList(label), versionWidth - 12, versionHeight + 12, this.width + this.font.getStringWidth(label), this.height + 10, this.width, this.font);
|
||||
GuiUtils.drawHoveringText(matrix, Arrays.asList(new StringTextComponent(label)), versionWidth - 12, versionHeight + 12, this.field_230708_k_ + this.field_230712_o_.getStringWidth(label), this.field_230709_l_ + 10, this.field_230708_k_, this.field_230712_o_);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void drawTab(int index, Double xOffset)
|
||||
private void drawTab(MatrixStack matrix, int index, double xOffset)
|
||||
{
|
||||
final IContent tab = this.content.getCategory().getContent(index);
|
||||
|
||||
@@ -443,9 +448,9 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
this.bindBackground();
|
||||
this.setBlitOffset(-1);
|
||||
this.blit((int) (backgroundX + xOffset), (int) (backgroundY + yOffset), 0, 0, (int) Math.ceil(this.tabHalf), fHeight);
|
||||
this.blit((int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY + yOffset), this.bgTextureWidth - (int) Math.floor(this.tabHalf + 1), 0, (int) Math.floor(this.tabHalf + 1), fHeight);
|
||||
this.func_230926_e_(-1); //setBlitOffset
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + xOffset), (int) (backgroundY + yOffset), 0, 0, (int) Math.ceil(this.tabHalf), fHeight);
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY + yOffset), this.bgTextureWidth - (int) Math.floor(this.tabHalf + 1), 0, (int) Math.floor(this.tabHalf + 1), fHeight);
|
||||
|
||||
if(!Config.getSkin().sharpEdges())
|
||||
{
|
||||
@@ -459,7 +464,7 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
for(int x = 0; x < factor; x++)
|
||||
{
|
||||
this.blit((int) (backgroundX + xOffset - x - 1 + Math.floor(this.tabHalf + 1) + this.tabHalf), (int) (backgroundY + x + 1), (int) (this.tabWidth - x - 1), x + 1, x + 1, 1);
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + xOffset - x - 1 + Math.floor(this.tabHalf + 1) + this.tabHalf), (int) (backgroundY + x + 1), (int) (this.tabWidth - x - 1), x + 1, x + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +476,7 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
for(int x = 0; x < factor; x++)
|
||||
{
|
||||
this.blit((int) (backgroundX + xOffset), (int) (backgroundY + x + 1), xOffset.intValue(), x + 1, x + 1, 1);
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + xOffset), (int) (backgroundY + x + 1), (int) xOffset, x + 1, x + 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -485,7 +490,7 @@ public class GuiWorldHandler extends Container
|
||||
for(int x = 0; x < width; x += interval)
|
||||
{
|
||||
this.defaultColor(1.0F - (x / (width + 5.0F * interval)));
|
||||
this.blit((int) (backgroundX + xOffset), (int) (backgroundY + yOffset + fHeight + x / interval), 0, fHeight, width - x, 1);
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + xOffset), (int) (backgroundY + yOffset + fHeight + x / interval), 0, fHeight, width - x, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,7 +503,7 @@ public class GuiWorldHandler extends Container
|
||||
for(int x = 0; x < width; x += interval)
|
||||
{
|
||||
this.defaultColor(1.0F - (x / (width + 5.0F * interval)));
|
||||
this.blit((int) (backgroundX + Math.ceil(xOffset) + x + offset), (int) (backgroundY + yOffset + fHeight + x / interval), this.bgTextureWidth - width + x, fHeight, width - x, 1);
|
||||
this.func_238474_b_(matrix, (int) (backgroundX + Math.ceil(xOffset) + x + offset), (int) (backgroundY + yOffset + fHeight + x / interval), this.bgTextureWidth - width + x, fHeight, width - x, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -512,7 +517,7 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
for(int x = 0; x < factor; x++)
|
||||
{
|
||||
this.blit(backgroundX, backgroundY + x, 0, fHeight, factor - x, 1);
|
||||
this.func_238474_b_(matrix, backgroundX, backgroundY + x, 0, fHeight, factor - x, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -524,14 +529,14 @@ public class GuiWorldHandler extends Container
|
||||
|
||||
for(int x = 0; x < factor + 1; x++)
|
||||
{
|
||||
this.blit(backgroundX + this.bgTextureWidth - x, backgroundY + factor - x, this.bgTextureWidth - x, fHeight, x, 1);
|
||||
this.func_238474_b_(matrix, backgroundX + this.bgTextureWidth - x, backgroundY + factor - x, this.bgTextureWidth - x, fHeight, x, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.setBlitOffset(0);
|
||||
this.drawCenteredString(this.font, TextFormatting.shortenString(net.minecraft.util.text.TextFormatting.UNDERLINE + tab.getTabTitle(), (int) this.tabWidth, this.font), (int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY - 13), color);
|
||||
this.func_230926_e_(0); //setBlitOffset
|
||||
this.func_238472_a_(matrix, this.field_230712_o_, TextUtils.stripText(tab.getTabTitle().func_240699_a_(TextFormatting.UNDERLINE), (int) this.tabWidth, this.field_230712_o_), (int) (backgroundX + this.tabHalf + xOffset), (int) (backgroundY - 13), color); //drawCenteredString
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,76 +546,76 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseClicked(double mouseX, double mouseY, int keyCode)
|
||||
public boolean func_231044_a_(double mouseX, double mouseY, int keyCode) //mouseClicked
|
||||
{
|
||||
if(this.nameField.isFocused())
|
||||
if(this.nameField.func_230999_j_()) //isFocused
|
||||
{
|
||||
this.nameField.setCursorPositionEnd();
|
||||
}
|
||||
|
||||
if(this.content.mouseClicked(mouseX, mouseY, keyCode))
|
||||
if(this.content.func_231044_a_(mouseX, mouseY, keyCode))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.mouseClicked(mouseX, mouseY, keyCode);
|
||||
return super.func_231044_a_(mouseX, mouseY, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseReleased(double mouseX, double mouseY, int keyCode)
|
||||
public boolean func_231048_c_(double mouseX, double mouseY, int keyCode) //mouseReleased
|
||||
{
|
||||
if(this.content.mouseReleased(mouseX, mouseY, keyCode))
|
||||
if(this.content.func_231048_c_(mouseX, mouseY, keyCode))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.mouseReleased(mouseX, mouseY, keyCode);
|
||||
return super.func_231048_c_(mouseX, mouseY, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseDragged(double mouseX, double mouseY, int keyCode, double deltaX, double deltaY)
|
||||
public boolean func_231045_a_(double mouseX, double mouseY, int keyCode, double deltaX, double deltaY) //mouseDragged
|
||||
{
|
||||
if(this.content.mouseDragged(mouseX, mouseY, keyCode, deltaX, deltaY))
|
||||
if(this.content.func_231045_a_(mouseX, mouseY, keyCode, deltaX, deltaY))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.mouseDragged(mouseX, mouseY, keyCode, deltaX, deltaY);
|
||||
return super.func_231045_a_(mouseX, mouseY, keyCode, deltaX, deltaY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mouseScrolled(double mouseX, double mouseY, double distance)
|
||||
public boolean func_231043_a_(double mouseX, double mouseY, double distance) //mouseScrolled
|
||||
{
|
||||
if(this.content.mouseScrolled(mouseX, mouseY, distance))
|
||||
if(this.content.func_231043_a_(mouseX, mouseY, distance))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.mouseScrolled(mouseX, mouseY, distance);
|
||||
return super.func_231043_a_(mouseX, mouseY, distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
|
||||
public boolean func_231046_a_(int keyCode, int scanCode, int modifiers) //keyPressed
|
||||
{
|
||||
boolean focused = this.getFocused() != null;
|
||||
boolean focused = this.func_241217_q_() != null;
|
||||
|
||||
if(focused && this.getFocused() instanceof Widget)
|
||||
if(focused && this.func_241217_q_() instanceof Widget)
|
||||
{
|
||||
focused = ((Widget) this.getFocused()).isFocused();
|
||||
focused = ((Widget) this.func_241217_q_()).func_230999_j_(); //getFocused().isFocused()
|
||||
}
|
||||
|
||||
if(!focused && KeyHandler.isPressed(KeyHandler.KEY_WORLD_HANDLER, keyCode))
|
||||
{
|
||||
this.onClose();
|
||||
this.func_231175_as__();
|
||||
return true;
|
||||
}
|
||||
|
||||
if(this.content.keyPressed(keyCode, scanCode, modifiers))
|
||||
if(this.content.func_231046_a_(keyCode, scanCode, modifiers))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.keyPressed(keyCode, scanCode, modifiers);
|
||||
return super.func_231046_a_(keyCode, scanCode, modifiers);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -625,41 +630,41 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean charTyped(char charTyped, int keyCode)
|
||||
public boolean func_231042_a_(char charTyped, int keyCode) //charTyped
|
||||
{
|
||||
if(this.nameField.isFocused())
|
||||
if(this.nameField.func_230999_j_()) //isFocused
|
||||
{
|
||||
this.nameField.setCursorPositionEnd();
|
||||
}
|
||||
|
||||
if(this.content.charTyped(charTyped, keyCode))
|
||||
if(this.content.func_231042_a_(charTyped, keyCode))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.charTyped(charTyped, keyCode);
|
||||
return super.func_231042_a_(charTyped, keyCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean changeFocus(boolean focus)
|
||||
public boolean func_231049_c__(boolean focus) //changeFocus
|
||||
{
|
||||
if(this.content.changeFocus(focus))
|
||||
if(this.content.func_231049_c__(focus))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.changeFocus(focus);
|
||||
return super.func_231049_c__(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isMouseOver(double mouseX, double mouseY)
|
||||
public boolean func_231047_b_(double mouseX, double mouseY) //isMouseOver
|
||||
{
|
||||
if(this.content.isMouseOver(mouseX, mouseY))
|
||||
if(this.content.func_231047_b_(mouseX, mouseY))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.isMouseOver(mouseX, mouseY);
|
||||
return super.func_231047_b_(mouseX, mouseY);
|
||||
}
|
||||
|
||||
private void defaultColor()
|
||||
@@ -670,13 +675,13 @@ public class GuiWorldHandler extends Container
|
||||
private void defaultColor(float alpha)
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(Config.getSkin().getBackgroundRedF(), Config.getSkin().getBackgroundGreenF(), Config.getSkin().getBackgroundBlueF(), alpha * Config.getSkin().getBackgroundAlphaF());
|
||||
RenderUtils.color(Config.getSkin().getBackgroundRedF(), Config.getSkin().getBackgroundGreenF(), Config.getSkin().getBackgroundBlueF(), alpha * Config.getSkin().getBackgroundAlphaF());
|
||||
}
|
||||
|
||||
private void darkColor()
|
||||
{
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.color4f(Config.getSkin().getBackgroundRedF() - 0.3F, Config.getSkin().getBackgroundGreenF() - 0.3F, Config.getSkin().getBackgroundBlueF() - 0.3F, Config.getSkin().getBackgroundAlphaF());
|
||||
RenderUtils.color(Config.getSkin().getBackgroundRedF() - 0.3F, Config.getSkin().getBackgroundGreenF() - 0.3F, Config.getSkin().getBackgroundBlueF() - 0.3F, Config.getSkin().getBackgroundAlphaF());
|
||||
}
|
||||
|
||||
private void bindBackground()
|
||||
@@ -732,14 +737,14 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClose()
|
||||
public void func_231175_as__() //onClose
|
||||
{
|
||||
ActionHelper.tryRun(this.content::onGuiClosed);
|
||||
super.onClose();
|
||||
super.func_231175_as__();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPauseScreen()
|
||||
public boolean func_231177_au__() //isPauseScreen
|
||||
{
|
||||
return Config.getSettings().pause();
|
||||
}
|
||||
@@ -757,7 +762,7 @@ public class GuiWorldHandler extends Container
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCloseOnEsc()
|
||||
public boolean func_231178_ax__() //shouldCloseOnEsc
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,13 @@ package exopandora.worldhandler.gui.content;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.gui.category.Category;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import net.minecraft.client.gui.IGuiEventListener;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -30,7 +33,7 @@ public interface IContent extends IGuiEventListener
|
||||
|
||||
}
|
||||
|
||||
default void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
default void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -42,8 +45,8 @@ public interface IContent extends IGuiEventListener
|
||||
|
||||
Category getCategory();
|
||||
|
||||
String getTitle();
|
||||
String getTabTitle();
|
||||
IFormattableTextComponent getTitle();
|
||||
IFormattableTextComponent getTabTitle();
|
||||
|
||||
Content getActiveContent();
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ import exopandora.worldhandler.util.AdvancementHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -53,15 +55,15 @@ public class ContentAdvancements extends Content
|
||||
MenuPageList<Advancement> list = new MenuPageList<Advancement>(x, y, advancements, 114, 20, 3, container, new ILogicPageList<Advancement>()
|
||||
{
|
||||
@Override
|
||||
public String translate(Advancement item)
|
||||
public IFormattableTextComponent translate(Advancement item)
|
||||
{
|
||||
return item.getDisplay().getTitle().getString();
|
||||
return (IFormattableTextComponent) item.getDisplay().getTitle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Advancement item)
|
||||
public IFormattableTextComponent toTooltip(Advancement item)
|
||||
{
|
||||
return item.getId().toString();
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +74,7 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, Advancement item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Advancement item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -90,21 +92,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, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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 GuiButtonList<EnumMode>(x + 118, y, this.modes, 114, 20, container, new ILogicMapped<EnumMode>()
|
||||
{
|
||||
@Override
|
||||
public String translate(EnumMode item)
|
||||
public IFormattableTextComponent translate(EnumMode item)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.advancements." + item.toString());
|
||||
return new TranslationTextComponent("gui.worldhandler.advancements." + item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(EnumMode item)
|
||||
public IFormattableTextComponent toTooltip(EnumMode item)
|
||||
{
|
||||
return item.toString();
|
||||
return new StringTextComponent(item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,15 +122,15 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.advancements.grant"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.grant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderAdvancement.getBuilderForAction(EnumActionType.GRANT));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.advancements.revoke"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.advancements.revoke"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderAdvancement.getBuilderForAction(EnumActionType.REVOKE));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.actions.reset"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.reset").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderAdvancement.getBuilder(EnumActionType.REVOKE, EnumMode.EVERYTHING)).withParent(Contents.ADVANCEMENTS)));
|
||||
}));
|
||||
@@ -141,15 +143,15 @@ public class ContentAdvancements extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.player.advancements");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.advancements");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.player.advancements");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.advancements");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderButcher;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
@@ -14,10 +19,14 @@ import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.EntityType;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class ContentButcher extends Content
|
||||
@@ -35,7 +44,7 @@ public class ContentButcher extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.radiusField = new GuiTextFieldTooltip(x + 116 / 2, y + 12, 116, 20, I18n.format("gui.worldhandler.butcher.radius"));
|
||||
this.radiusField = new GuiTextFieldTooltip(x + 116 / 2, y + 12, 116, 20, new TranslationTextComponent("gui.worldhandler.butcher.radius"));
|
||||
this.radiusField.setValidator(string ->
|
||||
{
|
||||
if(string == null)
|
||||
@@ -80,24 +89,36 @@ public class ContentButcher extends Content
|
||||
{
|
||||
GuiButtonBase slaughter;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(this.radiusField);
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 232 / 2, 20, I18n.format("gui.worldhandler.butcher.configure"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.butcher.configure"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.BUTCHER_SETTINGS.withParent(Contents.BUTCHER)));
|
||||
}));
|
||||
|
||||
container.add(slaughter = new GuiButtonBase(x + 116 / 2, y + 60, 232 / 2, 20, I18n.format("gui.worldhandler.butcher.slaughter"), () ->
|
||||
container.add(slaughter = new GuiButtonBase(x + 116 / 2, y + 60, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.butcher.slaughter"), () ->
|
||||
{
|
||||
AxisAlignedBB aabb = new AxisAlignedBB(Minecraft.getInstance().player.func_233580_cy_()).grow(Double.valueOf(this.radius));
|
||||
|
||||
for(ResourceLocation entry : Config.getButcher().getEntities())
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderButcher(entry, Integer.valueOf(this.radius)));
|
||||
EntityType<?> entity = ForgeRegistries.ENTITIES.getValue(entry);
|
||||
|
||||
if(entity != null)
|
||||
{
|
||||
List<?> entities = Minecraft.getInstance().world.getEntitiesWithinAABB(entity, aabb, Predicates.alwaysTrue());
|
||||
|
||||
if(!entities.isEmpty())
|
||||
{
|
||||
CommandHelper.sendCommand(new BuilderButcher(entry, Integer.valueOf(this.radius)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
slaughter.active = this.radius != null && !this.radius.isEmpty() && !Config.CLIENT.getButcher().getEntities().isEmpty();
|
||||
slaughter.field_230693_o_ = this.radius != null && !this.radius.isEmpty() && !Config.CLIENT.getButcher().getEntities().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -107,9 +128,9 @@ public class ContentButcher extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack stack, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.radiusField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.radiusField.func_230431_b_(stack, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -119,15 +140,15 @@ public class ContentButcher extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.entities.butcher");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.entities.butcher");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.entities.butcher");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.entities.butcher");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,9 +11,11 @@ import exopandora.worldhandler.gui.menu.impl.ILogicPageList;
|
||||
import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -31,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 String translate(EntityType<?> item)
|
||||
public IFormattableTextComponent translate(EntityType<?> item)
|
||||
{
|
||||
return I18n.format(item.getTranslationKey());
|
||||
return new TranslationTextComponent(item.getTranslationKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(EntityType<?> item)
|
||||
public IFormattableTextComponent toTooltip(EntityType<?> item)
|
||||
{
|
||||
return item.getRegistryName().toString();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -50,7 +52,7 @@ public class ContentButcherSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, EntityType<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, EntityType<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -71,15 +73,15 @@ public class ContentButcherSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().addEntity(this.entity);
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
Config.CLIENT.getButcher().removeEntity(this.entity);
|
||||
container.initButtons();
|
||||
@@ -87,12 +89,12 @@ public class ContentButcherSettings extends ContentChild
|
||||
|
||||
boolean contains = Config.CLIENT.getButcher().containsEntity(this.entity);
|
||||
|
||||
button1.active = !contains;
|
||||
button2.active = contains;
|
||||
button1.field_230693_o_ = !contains;
|
||||
button2.field_230693_o_ = contains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return this.getParentContent().getTitle();
|
||||
}
|
||||
|
||||
@@ -4,10 +4,9 @@ import exopandora.worldhandler.gui.DummyScreen;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.Connection;
|
||||
import exopandora.worldhandler.util.Connection.DedicatedConnection;
|
||||
import exopandora.worldhandler.util.Connection.IntegratedConnection;
|
||||
import exopandora.worldhandler.util.Connection.Type;
|
||||
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;
|
||||
@@ -16,9 +15,13 @@ 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.multiplayer.ServerData;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.realms.RealmsBridge;
|
||||
import net.minecraft.realms.RealmsBridgeScreen;
|
||||
import net.minecraft.server.IDynamicRegistries;
|
||||
import net.minecraft.server.integrated.IntegratedServer;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -28,18 +31,18 @@ public class ContentChangeWorld extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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 + 116 / 2, y + 24, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 24, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.singleplayer"), () ->
|
||||
{
|
||||
Connection connection = ContentChangeWorld.disconnect();
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
Minecraft.getInstance().displayGuiScreen(new WorldSelectionScreen(new DummyScreen(() -> ContentChangeWorld.reconnect(connection))));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, I18n.format("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 48, 232 / 2, 20, new TranslationTextComponent("gui.worldhandler.change_world.multiplayer"), () ->
|
||||
{
|
||||
Connection connection = ContentChangeWorld.disconnect();
|
||||
IConnection connection = ContentChangeWorld.disconnect();
|
||||
DummyScreen dummy = new DummyScreen(() -> ContentChangeWorld.reconnect(connection));
|
||||
|
||||
if(Minecraft.getInstance().gameSettings.field_230152_Z_)
|
||||
@@ -53,7 +56,7 @@ public class ContentChangeWorld extends ContentChild
|
||||
}));
|
||||
}
|
||||
|
||||
private static Connection disconnect()
|
||||
private static IConnection disconnect()
|
||||
{
|
||||
boolean isIntegrated = Minecraft.getInstance().isIntegratedServerRunning();
|
||||
boolean isRealms = Minecraft.getInstance().isConnectedToRealms();
|
||||
@@ -61,13 +64,15 @@ public class ContentChangeWorld extends ContentChild
|
||||
|
||||
if(isIntegrated)
|
||||
{
|
||||
String worldName = Minecraft.getInstance().getIntegratedServer().getWorldName();
|
||||
String folderName = Minecraft.getInstance().getIntegratedServer().getFolderName();
|
||||
IntegratedServer integrated = Minecraft.getInstance().getIntegratedServer();
|
||||
String folder = integrated.anvilConverterForAnvilFile.func_237282_a_();
|
||||
DimensionGeneratorSettings dimensionGeneratorSettings = integrated.func_240793_aU_().func_230418_z_();
|
||||
WorldSettings worldSettings = integrated.func_240793_aU_().func_230408_H_();
|
||||
|
||||
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
|
||||
Minecraft.getInstance().unloadWorld(new DirtMessageScreen(new TranslationTextComponent("menu.savingLevel")));
|
||||
|
||||
return new IntegratedConnection(Type.INTEGRATED, worldName, folderName);
|
||||
return new IntegratedConnection(folder, worldSettings, dimensionGeneratorSettings);
|
||||
}
|
||||
|
||||
Minecraft.getInstance().world.sendQuittingDisconnectingPacket();
|
||||
@@ -78,20 +83,20 @@ public class ContentChangeWorld extends ContentChild
|
||||
return null;
|
||||
}
|
||||
|
||||
return new DedicatedConnection(Type.DEDICATED, data);
|
||||
return new DedicatedConnection(data);
|
||||
}
|
||||
|
||||
private static void reconnect(Connection connection)
|
||||
private static void reconnect(IConnection connection)
|
||||
{
|
||||
if(connection == null)
|
||||
{
|
||||
RealmsBridge realmsbridge = new RealmsBridge();
|
||||
realmsbridge.switchToRealms(new MainMenuScreen());
|
||||
RealmsBridgeScreen realmsbridge = new RealmsBridgeScreen();
|
||||
realmsbridge.func_231394_a_(new MainMenuScreen());
|
||||
}
|
||||
else if(connection instanceof IntegratedConnection)
|
||||
{
|
||||
IntegratedConnection integrated = (IntegratedConnection) connection;
|
||||
Minecraft.getInstance().launchIntegratedServer(integrated.getFolderName(), integrated.getWorldName(), null);
|
||||
Minecraft.getInstance().func_238192_a_(integrated.getFolder(), integrated.getWorldSettings(), IDynamicRegistries.func_239770_b_(), integrated.getDimensionGeneratorSettings()); //launchIntegratedServer
|
||||
Minecraft.getInstance().mouseHelper.grabMouse();
|
||||
}
|
||||
else if(connection instanceof DedicatedConnection)
|
||||
@@ -103,8 +108,8 @@ public class ContentChangeWorld extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.change_world");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.change_world");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -29,7 +30,7 @@ public abstract class ContentChild extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
if(this.parent != null)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.EntityNBT;
|
||||
@@ -28,9 +29,11 @@ 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.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -39,6 +42,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 final List<GuiTextFieldTooltip> textfields = new ArrayList<GuiTextFieldTooltip>();
|
||||
private int scroll;
|
||||
@@ -92,7 +97,7 @@ public class ContentCommandStack extends ContentChild
|
||||
{
|
||||
int command = index + this.scroll;
|
||||
|
||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, I18n.format("gui.worldhandler.command_stack.command_n", command + 1));
|
||||
GuiTextFieldTooltip textfield = new GuiTextFieldTooltip(x, y + 24 * index, 232 - 48, 20, new TranslationTextComponent("gui.worldhandler.command_stack.command_n", command + 1));
|
||||
textfield.setValidator(Predicates.notNull());
|
||||
textfield.setText(command < this.getCommandCount() ? this.getCommand(command) : null);
|
||||
textfield.setResponder(text ->
|
||||
@@ -110,8 +115,8 @@ public class ContentCommandStack extends ContentChild
|
||||
GuiButtonBase buttonScrollUp;
|
||||
GuiButtonBase buttonScrollDown;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
this.iterate(index ->
|
||||
{
|
||||
@@ -119,17 +124,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, I18n.format("gui.worldhandler.actions.move_up"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
this.swapCommands(index + this.scroll, index + this.scroll - 1);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(buttonDown = new GuiButtonIcon(x + 232 - 20 - 24, y + index * 24 + 11, 20, 10, EnumIcon.ARROW_DOWN, I18n.format("gui.worldhandler.actions.move_down"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
this.swapCommands(index + this.scroll, index + this.scroll + 1);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, "-", I18n.format("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
container.add(buttonRemove = new GuiButtonTooltip(x + 232 - 20, y + index * 24 - 1, 20, 10, MINUS, new TranslationTextComponent("gui.worldhandler.command_stack.remove_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll;
|
||||
this.removeCommand(pos);
|
||||
@@ -139,9 +144,9 @@ public class ContentCommandStack extends ContentChild
|
||||
this.scrollUp();
|
||||
}
|
||||
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, "+", I18n.format("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
container.add(new GuiButtonTooltip(x + 232 - 20, y + index * 24 + 11, 20, 10, PLUS, new TranslationTextComponent("gui.worldhandler.command_stack.insert_command"), () ->
|
||||
{
|
||||
int pos = index + this.scroll + 1;
|
||||
this.addCommand(pos);
|
||||
@@ -151,33 +156,33 @@ public class ContentCommandStack extends ContentChild
|
||||
this.scrollDown();
|
||||
}
|
||||
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(this.textfields.get(index));
|
||||
|
||||
buttonRemove.active = this.getCommandCount() > 1;
|
||||
buttonUp.active = index + this.scroll > 0;
|
||||
buttonDown.active = index + this.scroll + 1 < this.getCommandCount();
|
||||
buttonRemove.field_230693_o_ = this.getCommandCount() > 1;
|
||||
buttonUp.field_230693_o_ = index + this.scroll > 0;
|
||||
buttonDown.field_230693_o_ = index + this.scroll + 1 < this.getCommandCount();
|
||||
});
|
||||
|
||||
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
container.add(this.buttonCopy = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.command_stack.copy_command"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardListener.setClipboardString(this.builderCommandStack.toActualCommand());
|
||||
}));
|
||||
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, I18n.format("gui.worldhandler.actions.move_up"), () ->
|
||||
container.add(buttonScrollUp = new GuiButtonIcon(x + 118, y + 72, 56, 20, EnumIcon.ARROW_UP, new TranslationTextComponent("gui.worldhandler.actions.move_up"), () ->
|
||||
{
|
||||
this.scrollUp();
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, I18n.format("gui.worldhandler.actions.move_down"), () ->
|
||||
container.add(buttonScrollDown = new GuiButtonIcon(x + 118 + 60, y + 72, 54, 20, EnumIcon.ARROW_DOWN, new TranslationTextComponent("gui.worldhandler.actions.move_down"), () ->
|
||||
{
|
||||
this.scrollDown();
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
this.updateCopyButton();
|
||||
buttonScrollUp.active = this.scroll > 0;
|
||||
buttonScrollDown.active = this.scroll < this.getCommandCount() - 3;
|
||||
buttonScrollUp.field_230693_o_ = this.scroll > 0;
|
||||
buttonScrollDown.field_230693_o_ = this.scroll < this.getCommandCount() - 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,11 +195,11 @@ public class ContentCommandStack extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.iterate(index ->
|
||||
{
|
||||
this.textfields.get(index).renderButton(mouseX, mouseY, partialTicks);
|
||||
this.textfields.get(index).func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
});
|
||||
}
|
||||
|
||||
@@ -208,12 +213,12 @@ public class ContentCommandStack extends ContentChild
|
||||
|
||||
private void scrollUp()
|
||||
{
|
||||
this.scroll = Math.max(0, this.scroll - (Screen.hasShiftDown() ? 10 : 1));
|
||||
this.scroll = Math.max(0, this.scroll - (Screen.func_231173_s_() ? 10 : 1));
|
||||
}
|
||||
|
||||
private void scrollDown()
|
||||
{
|
||||
this.scroll = Math.min(this.getCommandCount() - 3, this.scroll + (Screen.hasShiftDown() ? 10 : 1));
|
||||
this.scroll = Math.min(this.getCommandCount() - 3, this.scroll + (Screen.func_231173_s_() ? 10 : 1));
|
||||
}
|
||||
|
||||
private void updateCopyButton()
|
||||
@@ -230,7 +235,7 @@ public class ContentCommandStack extends ContentChild
|
||||
}
|
||||
}
|
||||
|
||||
this.buttonCopy.active = active;
|
||||
this.buttonCopy.field_230693_o_ = active;
|
||||
}
|
||||
|
||||
private void setCommand(int index, String command)
|
||||
@@ -264,8 +269,8 @@ public class ContentCommandStack extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.command_stack");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.command_stack");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,9 @@ import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -29,24 +30,24 @@ public class ContentContainers extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 232, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x, y + 96, 232, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.getNameTextComponent().getFormattedText(), () ->
|
||||
container.add(new GuiButtonBase(x + 24, y, 208, 20, Blocks.CRAFTING_TABLE.func_235333_g_(), () ->
|
||||
{
|
||||
BlockHelper.setBlockNearPlayer(Blocks.CRAFTING_TABLE);
|
||||
ActionHelper.backToGame();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.getNameTextComponent().getFormattedText(), () ->
|
||||
container.add(new GuiButtonBase(x + 24, y + 24, 208, 20, Blocks.ENDER_CHEST.func_235333_g_(), () ->
|
||||
{
|
||||
BlockHelper.setBlockNearPlayer(Blocks.ENDER_CHEST);
|
||||
ActionHelper.backToGame();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.getNameTextComponent().getFormattedText(), () ->
|
||||
container.add(new GuiButtonBase(x + 24, y + 48, 208, 20, Blocks.ANVIL.func_235333_g_(), () ->
|
||||
{
|
||||
BlockHelper.setBlockNearPlayer(Blocks.ANVIL);
|
||||
ActionHelper.backToGame();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.getNameTextComponent().getFormattedText(), () ->
|
||||
container.add(new GuiButtonBase(x + 24, y + 72, 208, 20, Blocks.ENCHANTING_TABLE.func_235333_g_(), () ->
|
||||
{
|
||||
double angle = Minecraft.getInstance().player.getHorizontalFacing().getHorizontalIndex() * Math.PI / 2;
|
||||
double sin = Math.sin(angle);
|
||||
@@ -107,15 +108,15 @@ public class ContentContainers extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.containers");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.containers");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.containers");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.containers");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.ICommandBuilderSyntax;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
@@ -9,8 +11,9 @@ import exopandora.worldhandler.gui.container.impl.GuiWorldHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -61,26 +64,26 @@ public class ContentContinue extends ContentChild
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, TextFormatting.RED + I18n.format("gui.worldhandler.generic.yes"), () ->
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 36, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.yes").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builder, this.special);
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(this.getParentContent()));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, I18n.format("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 116 / 2, y + 60, 116, 20, new TranslationTextComponent("gui.worldhandler.generic.no"), () -> ActionHelper.back(this)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.commandField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.commandField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return this.getParentContent().getTitle();
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentAttribute;
|
||||
import exopandora.worldhandler.builder.impl.BuilderCustomItem;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiSlider;
|
||||
@@ -29,8 +26,12 @@ import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import exopandora.worldhandler.util.ResourceHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -49,8 +50,6 @@ public class ContentCustomItem extends Content
|
||||
private Page page = Page.START;
|
||||
private String item;
|
||||
|
||||
private final List<EnumAttributes> attributes = Stream.concat(EnumAttributes.getAttributesFor(Applyable.BOTH).stream(), EnumAttributes.getAttributesFor(Applyable.PLAYER).stream()).collect(Collectors.toList());
|
||||
|
||||
@Override
|
||||
public ICommandBuilder getCommandBuilder()
|
||||
{
|
||||
@@ -60,7 +59,7 @@ public class ContentCustomItem extends Content
|
||||
@Override
|
||||
public void init(Container container)
|
||||
{
|
||||
for(EnumAttributes attribute : this.builderCutomItem.getAttributes())
|
||||
for(Attribute attribute : this.builderCutomItem.getAttributes())
|
||||
{
|
||||
double ammount = this.builderCutomItem.getAttributeAmmount(attribute);
|
||||
|
||||
@@ -84,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, I18n.format("gui.worldhandler.items.custom_item.start.item_id"));
|
||||
this.itemField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.item_id"));
|
||||
this.itemField.setValidator(Predicates.<String>notNull());
|
||||
this.itemField.setText(this.item);
|
||||
this.itemField.setResponder(text ->
|
||||
@@ -94,21 +93,21 @@ public class ContentCustomItem extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.items.custom_item.start.lore_1"));
|
||||
this.itemLore1Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_1"));
|
||||
this.itemLore1Field.setValidator(Predicates.<String>notNull());
|
||||
this.itemLore1Field.setText(this.builderCutomItem.getLore1());
|
||||
this.itemLore1Field.setResponder(text ->
|
||||
{
|
||||
this.builderCutomItem.setLore1(text);
|
||||
this.builderCutomItem.setLore1(new StringTextComponent(text));
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.items.custom_item.start.lore_2"));
|
||||
this.itemLore2Field = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start.lore_2"));
|
||||
this.itemLore2Field.setValidator(Predicates.<String>notNull());
|
||||
this.itemLore2Field.setText(this.builderCutomItem.getLore2());
|
||||
this.itemLore2Field.setResponder(text ->
|
||||
{
|
||||
this.builderCutomItem.setLore2(text);
|
||||
this.builderCutomItem.setLore2(new StringTextComponent(text));
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
@@ -124,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 String translate(Enchantment item)
|
||||
public IFormattableTextComponent translate(Enchantment item)
|
||||
{
|
||||
return I18n.format(item.getName());
|
||||
return new TranslationTextComponent(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Enchantment item)
|
||||
public IFormattableTextComponent toTooltip(Enchantment item)
|
||||
{
|
||||
return item.getRegistryName().toString();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,9 +141,9 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, Enchantment item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiSlider(x, y, width, height, 0, Config.getSliders().getMaxItemEnchantment(), 0, container, new LogicSliderSimple(this.toTooltip(item), text, value ->
|
||||
return new GuiSlider(x, y, width, height, 0, Config.getSliders().getMaxItemEnchantment(), 0, container, new LogicSliderSimple(item.getRegistryName().toString(), text, value ->
|
||||
{
|
||||
ContentCustomItem.this.builderCutomItem.setEnchantment(item, value.shortValue());
|
||||
}));
|
||||
@@ -166,28 +165,28 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
else if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
MenuPageList<EnumAttributes> attributes = new MenuPageList<EnumAttributes>(x + 118, y, this.attributes, 114, 20, 3, container, new ILogicPageList<EnumAttributes>()
|
||||
MenuPageList<Attribute> attributes = new MenuPageList<Attribute>(x + 118, y, ComponentAttribute.ATTRIBUTES, 114, 20, 3, container, new ILogicPageList<Attribute>()
|
||||
{
|
||||
@Override
|
||||
public String translate(EnumAttributes item)
|
||||
public IFormattableTextComponent translate(Attribute item)
|
||||
{
|
||||
return item.getTranslation();
|
||||
return new TranslationTextComponent(item.func_233754_c_());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(EnumAttributes item)
|
||||
public IFormattableTextComponent toTooltip(Attribute item)
|
||||
{
|
||||
return item.getAttribute();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(EnumAttributes item)
|
||||
public void onClick(Attribute item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, EnumAttributes item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent 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 ->
|
||||
{
|
||||
@@ -222,71 +221,71 @@ public class ContentCustomItem extends Content
|
||||
GuiButtonBase button5;
|
||||
GuiButtonBase button6;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.items.custom_item.start"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.enchantment"), () ->
|
||||
{
|
||||
this.page = Page.ENCHANT;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.attributes"), () ->
|
||||
{
|
||||
this.page = Page.ATTRIBUTES;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
button1.active = false;
|
||||
button1.field_230693_o_ = false;
|
||||
|
||||
container.add(button5 = new GuiButtonBase(x + 118, y + 72, 56, 20, "<", () ->
|
||||
container.add(button5 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.startPage--;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button6 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, ">", () ->
|
||||
container.add(button6 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.startPage++;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(this.startPage == 0)
|
||||
{
|
||||
button5.active = false;
|
||||
button5.field_230693_o_ = false;
|
||||
container.add(this.itemField);
|
||||
container.add(this.itemLore1Field);
|
||||
container.add(this.itemLore2Field);
|
||||
}
|
||||
else if(this.startPage == 1)
|
||||
{
|
||||
button6.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
}
|
||||
}
|
||||
else if(Page.ENCHANT.equals(this.page))
|
||||
{
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
button3.active = false;
|
||||
button3.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
if(!this.builderCutomItem.needsCommandBlock() && !this.builderCutomItem.getName().isSpecial())
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.items.custom_item.custom_item"), this::send));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.items.custom_item.custom_item"), this::send));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.actions.place_command_block"), this::send));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), this::send));
|
||||
}
|
||||
|
||||
button4.active = ResourceHelper.isRegistered(ResourceHelper.stringToResourceLocation(this.item), ForgeRegistries.ITEMS);
|
||||
button4.field_230693_o_ = ResourceHelper.isRegistered(ResourceHelper.stringToResourceLocation(this.item), ForgeRegistries.ITEMS);
|
||||
}
|
||||
|
||||
private void send()
|
||||
@@ -306,13 +305,13 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page) && this.startPage == 0)
|
||||
{
|
||||
this.itemField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.itemLore1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.itemLore2Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.itemField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.itemLore1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.itemLore2Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@@ -323,15 +322,15 @@ public class ContentCustomItem extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.items.custom_item");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.custom_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.items.custom_item");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.custom_item");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +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.brigadier.StringReader;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -25,7 +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.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -126,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) ? I18n.format("gui.worldhandler.edit_blocks.fill.block_id_to_fill") : I18n.format("gui.worldhandler.edit_blocks.replace.block_id_replace"));
|
||||
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.setValidator(Predicates.notNull());
|
||||
this.block1Field.setText(this.block1);
|
||||
this.block1Field.setResponder(text ->
|
||||
@@ -136,7 +139,7 @@ public class ContentEditBlocks extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
||||
this.block2Field = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace.block_id_place"));
|
||||
this.block2Field.setValidator(Predicates.notNull());
|
||||
this.block2Field.setText(this.block2);
|
||||
this.block2Field.setResponder(text ->
|
||||
@@ -146,7 +149,7 @@ public class ContentEditBlocks extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.edit_blocks.clone.filter"));
|
||||
this.filterField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone.filter"));
|
||||
this.filterField.setValidator(Predicates.notNull());
|
||||
this.filterField.setText(this.filter);
|
||||
this.filterField.setResponder(text ->
|
||||
@@ -165,28 +168,28 @@ public class ContentEditBlocks extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.coordinates"), () ->
|
||||
{
|
||||
this.page = Page.COORDINATES;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
this.page = Page.FILL;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
this.page = Page.REPLACE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
this.page = Page.CLONE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
int yOffset1 = 0;
|
||||
@@ -197,7 +200,7 @@ public class ContentEditBlocks extends Content
|
||||
|
||||
if(Page.COORDINATES.equals(this.page))
|
||||
{
|
||||
button1.active = false;
|
||||
button1.field_230693_o_ = false;
|
||||
|
||||
yOffset1 = 72;
|
||||
yOffset2 = 72;
|
||||
@@ -214,7 +217,7 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
else if(Page.FILL.equals(this.page))
|
||||
{
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
|
||||
yOffset1 = 24;
|
||||
yOffset2 = 48;
|
||||
@@ -223,15 +226,15 @@ public class ContentEditBlocks extends Content
|
||||
xOffset2 = 0;
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.fill"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderFill.getBuilderForFill());
|
||||
}));
|
||||
button1.active = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS);
|
||||
button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS);
|
||||
}
|
||||
else if(Page.REPLACE.equals(this.page))
|
||||
{
|
||||
button3.active = false;
|
||||
button3.field_230693_o_ = false;
|
||||
|
||||
yOffset1 = 48;
|
||||
yOffset2 = 48;
|
||||
@@ -241,15 +244,15 @@ public class ContentEditBlocks extends Content
|
||||
|
||||
container.add(this.block1Field);
|
||||
container.add(this.block2Field);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.replace"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderFill.getBuilderForReplace());
|
||||
}));
|
||||
button1.active = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS) && ResourceHelper.isRegistered(this.builderFill.getBlock2(), ForgeRegistries.BLOCKS);
|
||||
button1.field_230693_o_ = ResourceHelper.isRegistered(this.builderFill.getBlock1(), ForgeRegistries.BLOCKS) && ResourceHelper.isRegistered(this.builderFill.getBlock2(), ForgeRegistries.BLOCKS);
|
||||
}
|
||||
else if(Page.CLONE.equals(this.page))
|
||||
{
|
||||
button4.active = false;
|
||||
button4.field_230693_o_ = false;
|
||||
|
||||
yOffset1 = 48;
|
||||
yOffset2 = 48;
|
||||
@@ -265,29 +268,29 @@ public class ContentEditBlocks extends Content
|
||||
else
|
||||
{
|
||||
this.builderClone.setFilter(null);
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, null, null));
|
||||
button1.active = false;
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, StringTextComponent.field_240750_d_, null));
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
container.add(new GuiButtonList<EnumMask>(x + 118, y, Arrays.asList(EnumMask.values()), 114, 20, container, new ILogicMapped<EnumMask>()
|
||||
{
|
||||
@Override
|
||||
public String translate(EnumMask item)
|
||||
public IFormattableTextComponent translate(EnumMask item)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.edit_blocks.clone.mode." + item.toString());
|
||||
return new TranslationTextComponent("gui.worldhandler.edit_blocks.clone.mode." + item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(EnumMask item)
|
||||
public IFormattableTextComponent toTooltip(EnumMask item)
|
||||
{
|
||||
return item.toString();
|
||||
return new StringTextComponent(item.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(EnumMask item)
|
||||
{
|
||||
ContentEditBlocks.this.builderClone.setMask(item);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -297,7 +300,7 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.clone"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderClone);
|
||||
}));
|
||||
@@ -311,19 +314,19 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, I18n.format("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + yOffset1, width1, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.pos.set_pos_1"), () ->
|
||||
{
|
||||
BlockHelper.setPos1(BlockHelper.getFocusedBlockPos());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, I18n.format("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
container.add(new GuiButtonBase(x + 118 + xOffset2, y + yOffset2, width2, 20, new TranslationTextComponent("gui.worldhandler.edit_blocks.pos.set_pos_2"), () ->
|
||||
{
|
||||
BlockHelper.setPos2(BlockHelper.getFocusedBlockPos());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
}
|
||||
|
||||
@@ -359,32 +362,32 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.COORDINATES.equals(this.page))
|
||||
{
|
||||
this.x1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.y1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.z1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.x1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.y1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.z1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
|
||||
this.x2Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.y2Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.z2Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.x2Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.y2Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.z2Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.FILL.equals(this.page))
|
||||
{
|
||||
this.block1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.block1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.REPLACE.equals(this.page))
|
||||
{
|
||||
this.block1Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.block2Field.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.block1Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.block2Field.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.CLONE.equals(this.page))
|
||||
{
|
||||
if(EnumMask.FILTERED.equals(this.builderClone.getMask()))
|
||||
{
|
||||
this.filterField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.filterField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -416,15 +419,15 @@ public class ContentEditBlocks extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.blocks.edit_blocks");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.edit_blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.blocks.edit_blocks");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.edit_blocks");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,8 +18,10 @@ import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -41,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 String translate(Enchantment item)
|
||||
public IFormattableTextComponent translate(Enchantment item)
|
||||
{
|
||||
return I18n.format(item.getName());
|
||||
return new TranslationTextComponent(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Enchantment item)
|
||||
public IFormattableTextComponent toTooltip(Enchantment item)
|
||||
{
|
||||
return item.getRegistryName().toString();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,7 +63,7 @@ public class ContentEnchantment extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, Enchantment item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Enchantment item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -79,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, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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 GuiSlider(x + 118, y + 24, 114, 20, 1, ForgeRegistries.ENCHANTMENTS.getValue(this.builderEnchantment.getEnchantment()).getMaxLevel(), 1, container, new LogicSliderSimple("enchantment", I18n.format("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 TranslationTextComponent("gui.worldhandler.items.enchantment.level"), value ->
|
||||
{
|
||||
this.builderEnchantment.setLevel(value.intValue());
|
||||
})));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.items.enchantment.enchant"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderEnchantment);
|
||||
}));
|
||||
@@ -100,15 +102,15 @@ public class ContentEnchantment extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.items.enchantment");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.enchantment");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.items.enchantment");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.enchantment");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -14,7 +14,8 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
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.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -44,33 +45,33 @@ public class ContentExperience extends Content
|
||||
@Override
|
||||
public void initButtons(Container container, int x, int y)
|
||||
{
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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 GuiSlider(x + 116 / 2, y, 114, 20, 0, Config.getSliders().getMaxExperience(), 0, container, new LogicSliderSimple("experience", I18n.format("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 TranslationTextComponent("gui.worldhandler.title.player.experience"), value ->
|
||||
{
|
||||
this.builderExperience.setLevel(value);
|
||||
})));
|
||||
|
||||
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, I18n.format("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.buttonAdd = new GuiButtonBase(x + 116 / 2, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderExperience.getBuilderForAddLevels());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, I18n.format("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(this.buttonRemove = new GuiButtonBase(x + 116 / 2, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderExperience.getBuilderForRemoveLevels());
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 116 / 2, y + 72, 114, 20, I18n.format("gui.worldhandler.actions.reset"), I18n.format("gui.worldhandler.actions.set_to_0"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderExperience.getBuilderForResetLevels());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
boolean enabled = this.builderExperience.getLevel() > 0;
|
||||
|
||||
this.buttonAdd.active = enabled;
|
||||
this.buttonRemove.active = enabled;
|
||||
this.buttonAdd.field_230693_o_ = enabled;
|
||||
this.buttonRemove.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,8 +79,8 @@ public class ContentExperience extends Content
|
||||
{
|
||||
boolean enabled = this.builderExperience.getLevel() > 0;
|
||||
|
||||
this.buttonAdd.active = enabled;
|
||||
this.buttonRemove.active = enabled;
|
||||
this.buttonAdd.field_230693_o_ = enabled;
|
||||
this.buttonRemove.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -89,15 +90,15 @@ public class ContentExperience extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.player.experience");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.player.experience");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.experience");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +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.brigadier.arguments.ArgumentType;
|
||||
import com.mojang.brigadier.arguments.BoolArgumentType;
|
||||
|
||||
@@ -23,7 +24,9 @@ import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
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.TranslationTextComponent;
|
||||
import net.minecraft.world.GameRules;
|
||||
import net.minecraft.world.GameRules.IRuleEntryVisitor;
|
||||
import net.minecraft.world.GameRules.RuleKey;
|
||||
@@ -51,7 +54,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, I18n.format("gui.worldhandler.generic.value"));
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField.setValidator(Predicates.notNull());
|
||||
this.valueField.setText(this.value);
|
||||
this.valueField.setCursorPositionEnd();
|
||||
@@ -75,15 +78,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 String translate(String item)
|
||||
public IFormattableTextComponent translate(String item)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.gamerules.rule." + item);
|
||||
return new TranslationTextComponent("gamerule." + item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(String item)
|
||||
public IFormattableTextComponent toTooltip(String item)
|
||||
{
|
||||
return item;
|
||||
return new StringTextComponent(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,7 +108,7 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, String item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, String item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -123,16 +126,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, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
if(this.booleanValue)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderGamerule.getBuilderForValue(String.valueOf(true)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderGamerule.getBuilderForValue(String.valueOf(false)));
|
||||
}));
|
||||
@@ -140,7 +143,7 @@ public class ContentGamerules extends Content
|
||||
else
|
||||
{
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderGamerule);
|
||||
}));
|
||||
@@ -157,11 +160,11 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!this.booleanValue)
|
||||
{
|
||||
this.valueField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.valueField.func_230431_b_(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,15 +175,15 @@ public class ContentGamerules extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.world.gamerules");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.world.gamerules");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.world.gamerules");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.world.gamerules");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -13,8 +13,11 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.OptionsScreen;
|
||||
import net.minecraft.client.gui.screen.ResourcePacksScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -24,71 +27,76 @@ 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, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.dawn", Config.getSettings().getDawn())), ActionHelper::timeDawn));
|
||||
container.add(new GuiButtonIcon(x + 26, y, 22, 20, EnumIcon.TIME_NOON, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.noon", Config.getSettings().getNoon())), ActionHelper::timeNoon));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y, 22, 20, EnumIcon.TIME_SUNSET, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.sunset", Config.getSettings().getSunset())), ActionHelper::timeSunset));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y, 23, 20, EnumIcon.TIME_MIDNIGHT, I18n.format("gui.worldhandler.shortcuts.tooltip.time", I18n.format("gui.worldhandler.shortcuts.tooltip.time.midnight", Config.getSettings().getMidnight())), ActionHelper::timeMidnight));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y, 24, 20, EnumIcon.DIFFICULTY_PEACEFUL, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.peaceful")), ActionHelper::difficultyPeaceful));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y, 23, 20, EnumIcon.DIFFICULTY_EASY, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.easy")), ActionHelper::difficultyEasy));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y, 22, 20, EnumIcon.DIFFICULTY_NORMAL, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.normal")), ActionHelper::difficultyNormal));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y, 22, 20, EnumIcon.DIFFICULTY_HARD, I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty", I18n.format("gui.worldhandler.shortcuts.tooltip.difficulty.hard")), ActionHelper::difficultyHard));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y, 22, 20, EnumIcon.SETTINGS, I18n.format("gui.worldhandler.shortcuts.tooltip.settings"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SETTINGS.withParent(Contents.MAIN)));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, I18n.format("gui.worldhandler.shortcuts.tooltip.weather", I18n.format("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, I18n.format("gui.worldhandler.shortcuts.tooltip.potions"), () ->
|
||||
container.add(new GuiButtonIcon(x, y + 24, 22, 20, EnumIcon.WEATHER_SUN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.clear")), ActionHelper::weatherClear));
|
||||
container.add(new GuiButtonIcon(x + 26, y + 24, 22, 20, EnumIcon.WEATHER_RAIN, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.rainy")), ActionHelper::weatherRain));
|
||||
container.add(new GuiButtonIcon(x + 26 * 2, y + 24, 22, 20, EnumIcon.WEATHER_STORM, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.weather.thunder")), ActionHelper::weatherThunder));
|
||||
container.add(new GuiButtonIcon(x + 26 * 3, y + 24, 23, 20, EnumIcon.POTION, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.potions"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.POTIONS.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, I18n.format("gui.worldhandler.shortcuts.tooltip.command_stack"), () ->
|
||||
container.add(new GuiButtonIcon(x + 26 * 4, y + 24, 24, 20, EnumIcon.COMMAND_STACK, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.command_stack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.COMMAND_STACK.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode", I18n.format("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
container.add(new GuiButtonIcon(x + 26 * 5 + 2, y + 24, 23, 20, EnumIcon.GAMEMODE_SURVIVAL, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.survival")), ActionHelper::gamemodeSurvival));
|
||||
container.add(new GuiButtonIcon(x + 26 * 6 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_CREATIVE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.creative")), ActionHelper::gamemodeCreative));
|
||||
container.add(new GuiButtonIcon(x + 26 * 7 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_ADVENTURE, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.adventure")), ActionHelper::gamemodeAdventure));
|
||||
container.add(new GuiButtonIcon(x + 26 * 8 + 2, y + 24, 22, 20, EnumIcon.GAMEMODE_SPECTATOR, new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode", new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.gamemode.spectator")), ActionHelper::gamemodeSpectator));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, I18n.format("gui.worldhandler.items"), () ->
|
||||
container.add(new GuiButtonBase(x, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.items"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CUSTOM_ITEM));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, I18n.format("gui.worldhandler.blocks"), () ->
|
||||
container.add(new GuiButtonBase(x + 78, y + 48, 76, 20, new TranslationTextComponent("gui.worldhandler.blocks"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.EDIT_BLOCKS));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, I18n.format("gui.worldhandler.entities"), () ->
|
||||
container.add(new GuiButtonBase(x + 158, y + 48, 74, 20, new TranslationTextComponent("gui.worldhandler.entities"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SUMMON));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, I18n.format("gui.worldhandler.world"), () ->
|
||||
container.add(new GuiButtonBase(x, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.world"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.WORLD_INFO));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, I18n.format("gui.worldhandler.player"), () ->
|
||||
container.add(new GuiButtonBase(x + 78, y + 72, 76, 20, new TranslationTextComponent("gui.worldhandler.player"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.PLAYER));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, I18n.format("gui.worldhandler.scoreboard"), () ->
|
||||
container.add(new GuiButtonBase(x + 158, y + 72, 74, 20, new TranslationTextComponent("gui.worldhandler.scoreboard"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.SCOREBOARD_OBJECTIVES));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, I18n.format("gui.worldhandler.change_world"), () ->
|
||||
container.add(new GuiButtonBase(x, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.change_world"), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CHANGE_WORLD.withParent(Contents.MAIN)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, I18n.format("gui.worldhandler.resourcepack"), () ->
|
||||
container.add(new GuiButtonBase(x + 78, y + 96, 76, 20, new TranslationTextComponent("gui.worldhandler.resourcepack"), () ->
|
||||
{
|
||||
Minecraft.getInstance().gameSettings.saveOptions();
|
||||
Minecraft.getInstance().displayGuiScreen(new ResourcePacksScreen(container, Minecraft.getInstance().gameSettings));
|
||||
Minecraft.getInstance().displayGuiScreen(new ResourcePacksScreen(container, Minecraft.getInstance().getResourcePackList(), resourcePackList ->
|
||||
{
|
||||
OptionsScreen optionsScreen = new OptionsScreen(container, Minecraft.getInstance().gameSettings);
|
||||
optionsScreen.func_231158_b_(Minecraft.getInstance(), 0, 0);
|
||||
optionsScreen.func_241584_a_(resourcePackList);
|
||||
}, Minecraft.getInstance().getFileResourcePacks()));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x + 158, y + 96, 74, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,15 +106,15 @@ public class ContentMain extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return Main.NAME;
|
||||
return new StringTextComponent(Main.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return Main.NAME;
|
||||
return new StringTextComponent(Main.NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderGeneric;
|
||||
@@ -24,7 +25,10 @@ import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.Minecraft;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -81,7 +85,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, I18n.format("gui.worldhandler.multiplayer.username"));
|
||||
this.playerField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.username"));
|
||||
this.playerField.setValidator(Predicates.notNull());
|
||||
this.playerField.setFocused2(false);
|
||||
this.playerField.setText(this.builderKick.getPlayer());
|
||||
@@ -92,7 +96,7 @@ public class ContentMultiplayer extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, I18n.format("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||
this.reasonField = new GuiTextFieldTooltip(x + 118, y + 24 + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick_ban.reason"));
|
||||
this.reasonField.setValidator(Predicates.notNull());
|
||||
this.reasonField.setFocused2(false);
|
||||
this.reasonField.setText(this.builderKick.getReason());
|
||||
@@ -114,144 +118,144 @@ public class ContentMultiplayer extends Content
|
||||
GuiButtonBase button6;
|
||||
GuiButtonBase button7;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.multiplayer.kick") + " / " + I18n.format("gui.worldhandler.multiplayer.ban"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.multiplayer.kick") + " / " + I18n.format("gui.worldhandler.multiplayer.ban")), () ->
|
||||
{
|
||||
this.page = Page.KICK_AND_BAN;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), () ->
|
||||
{
|
||||
this.page = Page.PARDON;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions"), () ->
|
||||
{
|
||||
this.page = Page.PERMISSIONS;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime"), () ->
|
||||
{
|
||||
this.page = Page.RUNTIME;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
container.add(button5 = new GuiButtonBase(x, y + 96, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist"), () ->
|
||||
{
|
||||
this.page = Page.WHITELIST;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(Page.KICK_AND_BAN.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(this.reasonField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.multiplayer.kick"), this.builderKick.toActualCommand(), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.kick"), new StringTextComponent(this.builderKick.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderKick);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.multiplayer.ban"), this.builderBan.toActualCommand(), () ->
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.ban"), new StringTextComponent(this.builderBan.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderBan);
|
||||
}));
|
||||
|
||||
if(this.playerField.getText().isEmpty())
|
||||
{
|
||||
button6.active = false;
|
||||
button7.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
button7.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
button1.active = false;
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.PARDON.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.multiplayer.pardon"), this.builderPardon.toActualCommand(), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.pardon"), new StringTextComponent(this.builderPardon.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPardon);
|
||||
}));
|
||||
|
||||
if(this.playerField.getText().isEmpty())
|
||||
{
|
||||
button6.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.PERMISSIONS.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, I18n.format("gui.worldhandler.multiplayer.permissions.give"), this.builderOp.toActualCommand(), () ->
|
||||
container.add(button6 = new GuiButtonTooltip(x + 118, y + 24 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.give"), new StringTextComponent(this.builderOp.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderOp);
|
||||
}));
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, I18n.format("gui.worldhandler.multiplayer.permissions.take"), this.builderDeop.toActualCommand(), () ->
|
||||
container.add(button7 = new GuiButtonTooltip(x + 118, y + 48 + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.permissions.take"), new StringTextComponent(this.builderDeop.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderDeop);
|
||||
}));
|
||||
|
||||
if(this.playerField.getText().isEmpty())
|
||||
{
|
||||
button6.active = false;
|
||||
button7.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
button7.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
button3.active = false;
|
||||
button3.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.RUNTIME.equals(this.page))
|
||||
{
|
||||
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, I18n.format("gui.worldhandler.multiplayer.runtime.save_world"), this.builderSaveAll.toActualCommand(), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.save_world"), new StringTextComponent(this.builderSaveAll.toActualCommand()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderSaveAll);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.multiplayer.runtime.autosave", I18n.format("gui.worldhandler.generic.on")), this.builderSaveOn.toActualCommand(), () ->
|
||||
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()), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderSaveOn);
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.multiplayer.runtime.autosave", I18n.format("gui.worldhandler.generic.off")), this.builderSaveOff.toActualCommand(), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.autosave", new TranslationTextComponent("gui.worldhandler.generic.off")).func_240699_a_(TextFormatting.RED), new StringTextComponent(this.builderSaveOff.toActualCommand()), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSaveOff).withParent(Contents.MULTIPLAYER)));
|
||||
}));
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.multiplayer.runtime.stop_server"), this.builderStop.toActualCommand(), () ->
|
||||
container.add(new GuiButtonTooltip(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.runtime.stop_server").func_240699_a_(TextFormatting.RED), new StringTextComponent(this.builderStop.toActualCommand()), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderStop).withParent(Contents.MULTIPLAYER)));
|
||||
}));
|
||||
|
||||
button4.active = false;
|
||||
button4.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.WHITELIST.equals(this.page))
|
||||
{
|
||||
container.add(this.playerField);
|
||||
container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, I18n.format("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
container.add(button6 = new GuiButtonBase(x + 118, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.ADD));
|
||||
}));
|
||||
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, I18n.format("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
container.add(button7 = new GuiButtonBase(x + 118 + 47, y + 24, 44, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.REMOVE));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.multiplayer.whitelist.whitelist", I18n.format("gui.worldhandler.generic.on")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.on")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.ON));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.multiplayer.whitelist.whitelist", I18n.format("gui.worldhandler.generic.off")), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.whitelist", new TranslationTextComponent("gui.worldhandler.generic.off")), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.OFF));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, I18n.format("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
container.add(new GuiButtonIcon(x + 232 - 20, y + 24, 20, 20, EnumIcon.RELOAD, new TranslationTextComponent("gui.worldhandler.multiplayer.whitelist.reload"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderWhitelist.getBuilder(EnumMode.RELOAD));
|
||||
}));
|
||||
|
||||
if(this.playerField.getText().isEmpty())
|
||||
{
|
||||
button6.active = false;
|
||||
button7.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
button7.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
button5.active = false;
|
||||
button5.field_230693_o_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,16 +274,16 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.KICK_AND_BAN.equals(this.page))
|
||||
{
|
||||
this.reasonField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.reasonField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
|
||||
if(!Page.RUNTIME.equals(this.page))
|
||||
{
|
||||
this.playerField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.playerField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,15 +312,15 @@ public class ContentMultiplayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.multiplayer");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.multiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.multiplayer");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.multiplayer");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -18,16 +18,19 @@ import exopandora.worldhandler.gui.content.Contents;
|
||||
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.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -55,117 +58,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, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
BlockPos pos = this.builderNoteEditor.getBlockPos();
|
||||
SoundEvent sound = this.getSoundEvent(pos.down());
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 + 15, y, 14, 92, new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.g"), sound, 0.53F, Type.NORMAL, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(1));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 2, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.a"), sound, 0.6F, Type.NORMAL, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(3));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 3, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.b"), sound, 0.67F, Type.RIGHT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(5));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 4, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.c"), sound, 0.7F, Type.LEFT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(6));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 5, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.d"), sound, 0.8F, Type.NORMAL, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(8));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 6, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.e"), sound, 0.9F, Type.RIGHT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(10));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 7, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.f"), sound, 0.95F, Type.LEFT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(11));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 8, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.g"), sound, 1.05F, Type.NORMAL, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(13));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 9, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.a"), sound, 1.2F, Type.NORMAL, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(15));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 10, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.b"), sound, 1.32F, Type.RIGHT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(17));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 11, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.c"), sound, 1.4F, Type.LEFT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(18));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 12, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.d"), sound, 1.6F, Type.NORMAL, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(20));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 13, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.e"), sound, 1.8F, Type.RIGHT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(22));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 + 15 * 14, y, 14, 92, I18n.format("gui.worldhandler.blocks.note_block_editor.f"), sound, 1.9F, Type.LEFT, () ->
|
||||
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, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(23));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, "F#", sound, 0.5F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15, y, 9, 58, new StringTextComponent("F#"), sound, 0.5F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(0));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, "G#", sound, 0.56F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 2, y, 9, 58, new StringTextComponent("G#"), sound, 0.56F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(2));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, "A#", sound, 0.63F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 3, y, 9, 58, new StringTextComponent("A#"), sound, 0.63F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(4));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, "C#", sound, 0.75F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 5, y, 9, 58, new StringTextComponent("C#"), sound, 0.75F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(7));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, "D#", sound, 0.85F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 6, y, 9, 58, new StringTextComponent("D#"), sound, 0.85F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(9));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, "F#", sound, 1.0F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 8, y, 9, 58, new StringTextComponent("F#"), sound, 1.0F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(12));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, "G#", sound, 1.1F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 9, y, 9, 58, new StringTextComponent("G#"), sound, 1.1F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(14));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, "A#", sound, 1.25F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 10, y, 9, 58, new StringTextComponent("A#"), sound, 1.25F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(16));
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, "C#", sound, 1.5F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 12, y, 9, 58, new StringTextComponent("C#"), sound, 1.5F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(19));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, "D#", sound, 1.7F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 13, y, 9, 58, new StringTextComponent("D#"), sound, 1.7F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(21));
|
||||
}));
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, "F#", sound, 2.0F, Type.BLACK, () ->
|
||||
container.add(new GuiButtonPiano(x - 3 - 5 + 15 * 15, y, 9, 58, new StringTextComponent("F#"), sound, 2.0F, Type.BLACK, () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderNoteEditor.getBuilderForNote(24));
|
||||
}));
|
||||
@@ -173,38 +176,36 @@ public class ContentNoteEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(NOTE);
|
||||
|
||||
container.blit(x - 1, y - 1, 0, 0, 8, 59);
|
||||
container.blit(x - 1, y - 1 + 59, 0, 59, 13, 35);
|
||||
container.func_238474_b_(matrix, x - 1, y - 1, 0, 0, 8, 59); //blit
|
||||
container.func_238474_b_(matrix, x - 1, y - 1 + 59, 0, 59, 13, 35); //blit
|
||||
|
||||
container.blit(x - 1 + 232 - 5, y - 1, 18, 0, 7, 59);
|
||||
container.blit(x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35);
|
||||
container.func_238474_b_(matrix, x - 1 + 232 - 5, y - 1, 18, 0, 7, 59); //blit
|
||||
container.func_238474_b_(matrix, x - 1 + 232 - 10, y - 1 + 59, 13, 59, 12, 35); //blit
|
||||
|
||||
container.blit(x - 1 + 8, y - 1, 0, 94, 219, 1);
|
||||
container.blit(x - 1 + 13, y - 1 + 93, 0, 94, 209, 1);
|
||||
container.func_238474_b_(matrix, x - 1 + 8, y - 1, 0, 94, 219, 1); //blit
|
||||
container.func_238474_b_(matrix, x - 1 + 13, y - 1 + 93, 0, 94, 209, 1); //blit
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale = 4;
|
||||
|
||||
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.pushMatrix();
|
||||
matrix.push();
|
||||
matrix.translate(container.field_230708_k_ / 2 - 8 * scale, container.field_230709_l_ / 2 - 15 - 8 * scale, 0);
|
||||
matrix.scale(scale, scale, scale);
|
||||
|
||||
RenderSystem.translatef(container.width / 2 - 8 * scale, container.height / 2 - 15 - 8 * scale, 0);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Blocks.NOTE_BLOCK), 0, 0);
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Blocks.NOTE_BLOCK), 0, 0);
|
||||
matrix.pop();
|
||||
|
||||
String displayString = I18n.format("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName());
|
||||
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.note_block_editor.look_at_note_block", KeyHandler.KEY_WORLD_HANDLER.func_238171_j_());
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
fontRenderer.drawString(displayString, x + 116 - fontRenderer.getStringWidth(displayString) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
fontRenderer.func_238422_b_(matrix, text, x + 116 - fontRenderer.func_238414_a_(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,15 +221,15 @@ public class ContentNoteEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.blocks.note_block_editor");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.note_block_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.blocks.note_block_editor");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.note_block_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -16,12 +17,15 @@ import exopandora.worldhandler.gui.container.impl.GuiWorldHandler;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.RenderUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.inventory.InventoryScreen;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -77,43 +81,43 @@ public class ContentPlayer extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.entities.player.start"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.entities.player.score"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.score"), () ->
|
||||
{
|
||||
this.page = Page.SCORE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.entities.player.position"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.position"), () ->
|
||||
{
|
||||
this.page = Page.POSITION;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous"), () ->
|
||||
{
|
||||
this.page = Page.MISC;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
button1.active = false;
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.SCORE.equals(this.page))
|
||||
{
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.POSITION.equals(this.page))
|
||||
{
|
||||
button3.active = false;
|
||||
button3.field_230693_o_ = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.position.copy_position"), () ->
|
||||
{
|
||||
int posX = MathHelper.floor(Minecraft.getInstance().player.getPosX());
|
||||
int posY = MathHelper.floor(Minecraft.getInstance().player.getPosY());
|
||||
@@ -124,21 +128,21 @@ public class ContentPlayer extends Content
|
||||
}
|
||||
else if(Page.MISC.equals(this.page))
|
||||
{
|
||||
button4.active = false;
|
||||
button4.field_230693_o_ = false;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.entities.player.miscellaneous.set_spawn"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_spawn").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSpawnpoint).withParent(Contents.PLAYER)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.entities.player.miscellaneous.set_global_spawn"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.set_global_spawn").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderSetworldspawn).withParent(Contents.PLAYER)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.entities.player.miscellaneous.kill"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.kill").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderKill).withParent(Contents.PLAYER)));
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, TextFormatting.RED + I18n.format("gui.worldhandler.entities.player.miscellaneous.clear_inventory"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.player.miscellaneous.clear_inventory").func_240699_a_(TextFormatting.RED), () ->
|
||||
{
|
||||
Minecraft.getInstance().displayGuiScreen(new GuiWorldHandler(Contents.CONTINUE.withBuilder(this.builderClear).withParent(Contents.PLAYER)));
|
||||
}));
|
||||
@@ -157,32 +161,32 @@ public class ContentPlayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
int xPos = x + 175;
|
||||
int yPos = y + 82;
|
||||
int playerNameWidth = Minecraft.getInstance().fontRenderer.getStringWidth(Minecraft.getInstance().player.getName().getFormattedText()) / 2;
|
||||
int playerNameWidth = Minecraft.getInstance().fontRenderer.func_238414_a_(Minecraft.getInstance().player.getName()) / 2;
|
||||
|
||||
Screen.fill(container.width / 2 - playerNameWidth - 1 + 59, yPos - 74, container.width / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
||||
Minecraft.getInstance().fontRenderer.drawString(Minecraft.getInstance().player.getName().getFormattedText(), container.width / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
||||
AbstractGui.func_238467_a_(matrix, container.field_230708_k_ / 2 - playerNameWidth - 1 + 59, yPos - 74, container.field_230708_k_ / 2 + playerNameWidth + 1 + 59, yPos - 65, 0x3F000000);
|
||||
Minecraft.getInstance().fontRenderer.func_238422_b_(matrix, Minecraft.getInstance().player.getName(), container.field_230708_k_ / 2 - playerNameWidth + 59, yPos - 73, 0xE0E0E0);
|
||||
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
InventoryScreen.drawEntityOnScreen(xPos, yPos, 30, xPos - mouseX, yPos - mouseY - 44, Minecraft.getInstance().player);
|
||||
RenderSystem.defaultBlendFunc();
|
||||
}
|
||||
else if(Page.SCORE.equals(this.page))
|
||||
{
|
||||
this.scoreField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.xpField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.coinsField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.scoreField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.xpField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.coinsField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.POSITION.equals(this.page))
|
||||
{
|
||||
this.posXField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posYField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posZField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posXField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.posYField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.posZField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,15 +204,15 @@ public class ContentPlayer extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.player.player");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.player.player");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.player.player");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.player.player");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -17,9 +17,12 @@ import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.CommandHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -63,15 +66,15 @@ public class ContentPotions extends ContentChild
|
||||
MenuPageList<Effect> potions = new MenuPageList<Effect>(x, y, new ArrayList<Effect>(ForgeRegistries.POTIONS.getValues()), 114, 20, 3, container, new ILogicPageList<Effect>()
|
||||
{
|
||||
@Override
|
||||
public String translate(Effect item)
|
||||
public IFormattableTextComponent translate(Effect item)
|
||||
{
|
||||
return I18n.format(item.getName());
|
||||
return new TranslationTextComponent(item.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Effect item)
|
||||
public IFormattableTextComponent toTooltip(Effect item)
|
||||
{
|
||||
return item.getRegistryName().toString();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -82,7 +85,7 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, Effect item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Effect item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -106,42 +109,42 @@ public class ContentPotions extends ContentChild
|
||||
GuiButtonBase button4;
|
||||
GuiButtonBase button5;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
if(this.potionPage == 0)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 12, 114, 20, I18n.format("gui.worldhandler.potions.effect.give"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.give"), () ->
|
||||
{
|
||||
this.next(container);
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, I18n.format("gui.worldhandler.potions.effect.remove"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotion.getRemoveCommand());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, I18n.format("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.remove_all"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotion.getClearCommand());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
}
|
||||
else if(this.potionPage == 1)
|
||||
{
|
||||
Effect potion = this.builderPotion.getEffectAsPotion();
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.potions.effect.ambient", this.builderPotionItem.getAmbient(potion) ? I18n.format("gui.worldhandler.generic.on") : I18n.format("gui.worldhandler.generic.off")), () ->
|
||||
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")), () ->
|
||||
{
|
||||
this.builderPotionItem.setAmbient(potion, !this.builderPotionItem.getAmbient(potion));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.potions.effect.particles", this.builderPotion.getHideParticles() ? I18n.format("gui.worldhandler.generic.off") : I18n.format("gui.worldhandler.generic.on")), () ->
|
||||
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")), () ->
|
||||
{
|
||||
this.builderPotion.setHideParticles(!this.builderPotion.getHideParticles());
|
||||
this.builderPotionItem.setShowParticles(potion, !this.builderPotionItem.getShowParticles(potion));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), I18n.format("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 TranslationTextComponent("gui.worldhandler.potions.effect.amplifier"), value ->
|
||||
{
|
||||
this.builderPotion.setAmplifier(value.byteValue());
|
||||
this.builderPotionItem.setAmplifier(potion, value.byteValue());
|
||||
@@ -151,17 +154,17 @@ public class ContentPotions extends ContentChild
|
||||
{
|
||||
Effect potion = this.builderPotion.getEffectAsPotion();
|
||||
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, 59, 0, container, new LogicSliderSimple("s" + potion.getRegistryName(), I18n.format("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 TranslationTextComponent("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(), I18n.format("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 TranslationTextComponent("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(), I18n.format("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 TranslationTextComponent("gui.worldhandler.potion.time.hours"), value ->
|
||||
{
|
||||
this.builderPotion.setHours(value.intValue());
|
||||
this.builderPotionItem.setHours(potion, value.intValue());
|
||||
@@ -169,72 +172,72 @@ public class ContentPotions extends ContentChild
|
||||
}
|
||||
else if(this.potionPage == 3)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, I18n.format("gui.worldhandler.potions.effect"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.potions.effect"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotion.getGiveCommand());
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, I18n.format("gui.worldhandler.potions.effect.tipped_arrow"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 24, 56, 20, new TranslationTextComponent("gui.worldhandler.potions.effect.tipped_arrow"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.TIPPED_ARROW));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonTooltip(x + 178, y + 24, 55, 20, I18n.format("gui.worldhandler.potions.effect.bottle"), I18n.format("gui.worldhandler.actions.place_command_block"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.POTION));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonTooltip(x + 118, y + 48, 56, 20, I18n.format("gui.worldhandler.potions.effect.splash"), I18n.format("gui.worldhandler.actions.place_command_block"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.SPLASH_POTION));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonTooltip(x + 178, y + 48, 55, 20, I18n.format("gui.worldhandler.potions.effect.lingering"), I18n.format("gui.worldhandler.actions.place_command_block"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPotionItem.getBuilderForPotion(Items.LINGERING_POTION));
|
||||
this.potionPage = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
boolean enabled = this.builderPotion.getAmplifier() >= 0 && this.builderPotion.getDuration() > 0;
|
||||
|
||||
button1.active = enabled;
|
||||
button2.active = enabled;
|
||||
button3.active = enabled;
|
||||
button4.active = enabled;
|
||||
button5.active = enabled;
|
||||
button1.field_230693_o_ = enabled;
|
||||
button2.field_230693_o_ = enabled;
|
||||
button3.field_230693_o_ = enabled;
|
||||
button4.field_230693_o_ = enabled;
|
||||
button5.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
if(this.potionPage > 0)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 56, 20, "<", () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.potionPage--;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, ">", () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.next(container);
|
||||
}));
|
||||
|
||||
button1.active = this.potionPage < 3;
|
||||
button1.field_230693_o_ = this.potionPage < 3;
|
||||
}
|
||||
}
|
||||
|
||||
private void next(Container container)
|
||||
{
|
||||
this.potionPage++;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.potions");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.potions");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,9 +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.client.resources.I18n;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -47,20 +49,20 @@ public class ContentRecipes extends Content
|
||||
MenuPageList<IRecipe<?>> list = new MenuPageList<IRecipe<?>>(x, y, recipes, 114, 20, 3, container, new ILogicPageList<IRecipe<?>>()
|
||||
{
|
||||
@Override
|
||||
public String translate(IRecipe<?> item)
|
||||
public IFormattableTextComponent translate(IRecipe<?> item)
|
||||
{
|
||||
if(!item.getRecipeOutput().equals(ItemStack.EMPTY))
|
||||
{
|
||||
return item.getRecipeOutput().getDisplayName().getFormattedText();
|
||||
return (IFormattableTextComponent) item.getRecipeOutput().getDisplayName();
|
||||
}
|
||||
|
||||
return item.getId().toString();
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(IRecipe<?> item)
|
||||
public IFormattableTextComponent toTooltip(IRecipe<?> item)
|
||||
{
|
||||
return item.getId().toString();
|
||||
return new StringTextComponent(item.getId().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +73,7 @@ public class ContentRecipes extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, IRecipe<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, IRecipe<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -89,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, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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 + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.recipes.give"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.give"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderRecipe.getBuilderForMode(EnumMode.GIVE));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.recipes.take"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.recipes.take"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderRecipe.getBuilderForMode(EnumMode.TAKE));
|
||||
container.initButtons();
|
||||
@@ -111,15 +113,15 @@ public class ContentRecipes extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.items.recipes");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.items.recipes");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.items.recipes");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.items.recipes");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,7 +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.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -36,8 +37,8 @@ public abstract class ContentScoreboard extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.scoreboard");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.scoreboard");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderScoreboardObjectives;
|
||||
@@ -24,7 +25,10 @@ import net.minecraft.client.resources.I18n;
|
||||
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;
|
||||
@@ -47,7 +51,7 @@ 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, I18n.format("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField.setValidator(Predicates.notNull());
|
||||
this.objectField.setText(ContentScoreboard.getObjective());
|
||||
this.objectField.setResponder(text ->
|
||||
@@ -62,7 +66,7 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
MenuButtonList objectives = new MenuButtonList(x + 118, y + 24, HELPER.getObjectives(), 2, new ILogicButtonList()
|
||||
{
|
||||
@Override
|
||||
public String translate(String key, int depth)
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
{
|
||||
ResourceLocation resource = this.makeResourceLocation(key);
|
||||
|
||||
@@ -74,25 +78,25 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
{
|
||||
if(type.equals(Stats.CUSTOM))
|
||||
{
|
||||
return I18n.format("gui.worldhandler.scoreboard.objectives.stat.custom");
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.custom");
|
||||
}
|
||||
else if(type.equals(Stats.ENTITY_KILLED))
|
||||
{
|
||||
return I18n.format("gui.worldhandler.scoreboard.objectives.stat.killed");
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.killed");
|
||||
}
|
||||
else if(type.equals(Stats.ENTITY_KILLED_BY))
|
||||
{
|
||||
return I18n.format("gui.worldhandler.scoreboard.objectives.stat.killed_by");
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat.killed_by");
|
||||
}
|
||||
|
||||
return I18n.format(type.getTranslationKey());
|
||||
return new TranslationTextComponent(type.getTranslationKey());
|
||||
}
|
||||
|
||||
String translation = RegistryHelper.translate(resource);
|
||||
|
||||
if(translation != null)
|
||||
{
|
||||
return I18n.format(translation);
|
||||
return new TranslationTextComponent(translation);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,15 +104,15 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
|
||||
if(!translation.equals(I18n.format(translation)))
|
||||
{
|
||||
return I18n.format(translation);
|
||||
return new TranslationTextComponent(translation);
|
||||
}
|
||||
|
||||
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getFriendlyName).anyMatch(Predicates.equalTo(key)))
|
||||
{
|
||||
return I18n.format("gui.worldhandler.color." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return I18n.format("gui.worldhandler.scoreboard.objectives.stat." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.stat." + key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,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 String translate(String key, int depth)
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
{
|
||||
if(depth == 0)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.scoreboard.slot." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.slot." + key);
|
||||
}
|
||||
else if(depth == 1)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.color." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return key;
|
||||
return new StringTextComponent(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -209,34 +213,34 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.create"), () ->
|
||||
{
|
||||
this.page = Page.CREATE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.display"), () ->
|
||||
{
|
||||
this.page = Page.DISPLAY;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.undisplay"), () ->
|
||||
{
|
||||
this.page = Page.UNDISPLAY;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.remove"), () ->
|
||||
{
|
||||
this.page = Page.REMOVE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
button1.active = !Page.CREATE.equals(this.page);
|
||||
button2.active = !Page.DISPLAY.equals(this.page);
|
||||
button3.active = !Page.UNDISPLAY.equals(this.page);
|
||||
button4.active = !Page.REMOVE.equals(this.page);
|
||||
button1.field_230693_o_ = !Page.CREATE.equals(this.page);
|
||||
button2.field_230693_o_ = !Page.DISPLAY.equals(this.page);
|
||||
button3.field_230693_o_ = !Page.UNDISPLAY.equals(this.page);
|
||||
button4.field_230693_o_ = !Page.REMOVE.equals(this.page);
|
||||
|
||||
if(Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
@@ -253,12 +257,12 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
this.builderObjectives.setObjective(ContentScoreboard.getObjective());
|
||||
}
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, I18n.format("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderObjectives);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
button1.active = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid();
|
||||
button1.field_230693_o_ = Page.UNDISPLAY.equals(this.page) || ContentScoreboard.isObjectiveValid();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,18 +275,18 @@ public class ContentScoreboardObjectives extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(!Page.UNDISPLAY.equals(this.page))
|
||||
{
|
||||
this.objectField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.objectField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.scoreboard.objectives");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.objectives");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderMultiCommand;
|
||||
@@ -19,7 +20,8 @@ import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
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.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -77,7 +79,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, I18n.format("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.objectives.objective"));
|
||||
this.objectField.setValidator(Predicates.notNull());
|
||||
this.objectField.setText(ContentScoreboard.getObjective());
|
||||
this.objectField.setResponder(text ->
|
||||
@@ -88,7 +90,7 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, I18n.format("gui.worldhandler.scoreboard.players.tag"));
|
||||
this.tagField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.tag"));
|
||||
this.tagField.setValidator(string -> string != null && !string.contains(" "));
|
||||
this.tagField.setText(this.tag);
|
||||
this.tagField.setResponder(text ->
|
||||
@@ -106,103 +108,103 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
GuiButtonBase button2;
|
||||
GuiButtonBase button3;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y + 12, 114, 20, I18n.format("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.points"), () ->
|
||||
{
|
||||
this.page = Page.ADD_SET_REMOVE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 36, 114, 20, I18n.format("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.tag"), () ->
|
||||
{
|
||||
this.page = Page.TAG;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 60, 114, 20, I18n.format("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.players.trigger"), () ->
|
||||
{
|
||||
this.page = Page.ENABLE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
button1.active = !Page.ADD_SET_REMOVE.equals(this.page);
|
||||
button2.active = !Page.TAG.equals(this.page);
|
||||
button3.active = !Page.ENABLE.equals(this.page);
|
||||
button1.field_230693_o_ = !Page.ADD_SET_REMOVE.equals(this.page);
|
||||
button2.field_230693_o_ = !Page.TAG.equals(this.page);
|
||||
button3.field_230693_o_ = !Page.ENABLE.equals(this.page);
|
||||
|
||||
boolean enabled = ContentScoreboard.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", I18n.format("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 TranslationTextComponent("gui.worldhandler.scoreboard.players.points"), value ->
|
||||
{
|
||||
this.builderPlayers.setPoints(value);
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, I18n.format("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.ADD));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, I18n.format("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.REMOVE));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonTooltip(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.actions.reset"), I18n.format("gui.worldhandler.actions.set_to_0"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPlayers.getBuilderForPoints(EnumMode.SET, 0));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
boolean points = enabled && this.builderPlayers.getPoints() > 0;
|
||||
|
||||
this.addButton.active = points;
|
||||
this.removeButton.active = points;
|
||||
button1.active = enabled;
|
||||
this.addButton.field_230693_o_ = points;
|
||||
this.removeButton.field_230693_o_ = points;
|
||||
button1.field_230693_o_ = enabled;
|
||||
}
|
||||
else if(Page.TAG.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, I18n.format("gui.worldhandler.actions.add"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTag.getBuilderForMode(BuilderTag.EnumMode.ADD));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, I18n.format("gui.worldhandler.actions.remove"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTag.getBuilderForMode(BuilderTag.EnumMode.REMOVE));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
boolean tag = this.tag != null && !this.tag.isEmpty();
|
||||
|
||||
button1.active = tag;
|
||||
button2.active = tag;
|
||||
button1.field_230693_o_ = tag;
|
||||
button2.field_230693_o_ = tag;
|
||||
}
|
||||
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", I18n.format("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 TranslationTextComponent("gui.worldhandler.generic.value"), value ->
|
||||
{
|
||||
this.builderTrigger.setValue(value.intValue());
|
||||
})));
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, I18n.format("gui.worldhandler.actions.add"), () ->
|
||||
container.add(this.addButton = new GuiButtonBase(x + 118, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.add"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.ADD));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, I18n.format("gui.worldhandler.actions.set"), () ->
|
||||
container.add(this.removeButton = new GuiButtonBase(x + 118 + 114 / 2 + 1, y + 48, 56, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTrigger.getBuilderForMode(BuilderTrigger.EnumMode.SET));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderPlayers.getBuilderForEnable());
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
this.addButton.active = enabled && this.builderTrigger.getValue() > 0;
|
||||
this.removeButton.active = enabled;
|
||||
button1.active = enabled;
|
||||
this.addButton.field_230693_o_ = enabled && this.builderTrigger.getValue() > 0;
|
||||
this.removeButton.field_230693_o_ = enabled;
|
||||
button1.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
if(Page.TAG.equals(this.page))
|
||||
@@ -232,13 +234,13 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
{
|
||||
boolean points = enabled && this.builderPlayers.getPoints() > 0;
|
||||
|
||||
this.addButton.active = points;
|
||||
this.removeButton.active = points;
|
||||
this.addButton.field_230693_o_ = points;
|
||||
this.removeButton.field_230693_o_ = points;
|
||||
}
|
||||
else if(Page.ENABLE.equals(this.page))
|
||||
{
|
||||
this.addButton.active = enabled && this.builderTrigger.getValue() > 0;
|
||||
this.removeButton.active = enabled;
|
||||
this.addButton.field_230693_o_ = enabled && this.builderTrigger.getValue() > 0;
|
||||
this.removeButton.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
this.objectField.tick();
|
||||
@@ -246,22 +248,22 @@ public class ContentScoreboardPlayers extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.TAG.equals(this.page))
|
||||
{
|
||||
this.tagField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.tagField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else
|
||||
{
|
||||
this.objectField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.objectField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.scoreboard.players");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.players");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderTeams;
|
||||
@@ -18,7 +19,10 @@ import exopandora.worldhandler.gui.menu.impl.MenuButtonList;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -41,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, I18n.format("gui.worldhandler.scoreboard.team.team"));
|
||||
this.teamField = new GuiTextFieldTooltip(x + 118, y + this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.team"));
|
||||
this.teamField.setValidator(Predicates.notNull());
|
||||
this.teamField.setText(this.team);
|
||||
this.teamField.setResponder(text ->
|
||||
@@ -56,23 +60,23 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
MenuButtonList options = new MenuButtonList(x + 118, y + 24, HELPER.getOptions(), 2, new ILogicButtonList()
|
||||
{
|
||||
@Override
|
||||
public String translate(String key, int depth)
|
||||
public IFormattableTextComponent translate(String key, int depth)
|
||||
{
|
||||
if(depth == 0)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.scoreboard.team.options." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.team.options." + key);
|
||||
}
|
||||
else if(depth == 1)
|
||||
{
|
||||
if(Arrays.stream(TextFormatting.values()).map(TextFormatting::getFriendlyName).anyMatch(Predicates.equalTo(key)))
|
||||
{
|
||||
return I18n.format("gui.worldhandler.color." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.color." + key);
|
||||
}
|
||||
|
||||
return I18n.format("gui.worldhandler.scoreboard.team.suboption." + key);
|
||||
return new TranslationTextComponent("gui.worldhandler.scoreboard.team.suboption." + key);
|
||||
}
|
||||
|
||||
return key;
|
||||
return new StringTextComponent(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -113,34 +117,34 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.create"), () ->
|
||||
{
|
||||
this.page = Page.ADD;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.join") + " / " + I18n.format("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.scoreboard.team.join") + " / " + I18n.format("gui.worldhandler.scoreboard.team.leave")), () ->
|
||||
{
|
||||
this.page = Page.JOIN_OR_LEAVE;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.format("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.scoreboard.team.remove") + " / " + I18n.format("gui.worldhandler.scoreboard.team.empty")), () ->
|
||||
{
|
||||
this.page = Page.REMOVE_OR_EMPTY;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.options"), () ->
|
||||
{
|
||||
this.page = Page.OPTION;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
button1.active = !Page.ADD.equals(this.page);
|
||||
button2.active = !Page.JOIN_OR_LEAVE.equals(this.page);
|
||||
button3.active = !Page.REMOVE_OR_EMPTY.equals(this.page);
|
||||
button4.active = !Page.OPTION.equals(this.page);
|
||||
button1.field_230693_o_ = !Page.ADD.equals(this.page);
|
||||
button2.field_230693_o_ = !Page.JOIN_OR_LEAVE.equals(this.page);
|
||||
button3.field_230693_o_ = !Page.REMOVE_OR_EMPTY.equals(this.page);
|
||||
button4.field_230693_o_ = !Page.OPTION.equals(this.page);
|
||||
|
||||
this.builderTeams.setMode(this.page.getMode());
|
||||
|
||||
@@ -154,44 +158,44 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
{
|
||||
this.builderTeams.setPlayer(container.getPlayer());
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.join"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.JOIN));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.leave"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.LEAVE));
|
||||
container.initButtons();
|
||||
}));
|
||||
|
||||
button1.active = enabled;
|
||||
button1.field_230693_o_ = enabled;
|
||||
}
|
||||
else if(Page.REMOVE_OR_EMPTY.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.remove"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.REMOVE));
|
||||
container.initButtons();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, I18n.format("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.scoreboard.team.empty"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTeams.getBuilderForMode(EnumMode.EMPTY));
|
||||
container.initButtons();
|
||||
}));
|
||||
|
||||
button1.active = enabled;
|
||||
button2.active = enabled;
|
||||
button1.field_230693_o_ = enabled;
|
||||
button2.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
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, I18n.format("gui.worldhandler.actions.perform"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72 - this.page.getShift(), 114, 20, new TranslationTextComponent("gui.worldhandler.actions.perform"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderTeams);
|
||||
container.initButtons();
|
||||
}));
|
||||
button1.active = enabled;
|
||||
button1.field_230693_o_ = enabled;
|
||||
}
|
||||
|
||||
container.add(this.teamField);
|
||||
@@ -204,15 +208,15 @@ public class ContentScoreboardTeams extends ContentScoreboard
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.teamField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.teamField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.scoreboard.teams");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.scoreboard.teams");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -5,6 +5,8 @@ import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonTooltip;
|
||||
@@ -16,7 +18,8 @@ import exopandora.worldhandler.gui.menu.impl.ILogicPageList;
|
||||
import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -52,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 String translate(Setting<?> item)
|
||||
public IFormattableTextComponent translate(Setting<?> item)
|
||||
{
|
||||
return I18n.format("gui.worldhandler.config.settings." + item.getKey());
|
||||
return new TranslationTextComponent("gui.worldhandler.config.settings." + item.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Setting<?> item)
|
||||
public IFormattableTextComponent toTooltip(Setting<?> item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -71,7 +74,7 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, Setting<?> item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, Setting<?> item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
@@ -85,7 +88,7 @@ public class ContentSettings extends ContentChild
|
||||
|
||||
container.add(settings);
|
||||
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.generic.value"));
|
||||
this.valueField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.value"));
|
||||
this.valueField.setValidator(string ->
|
||||
{
|
||||
if(string == null)
|
||||
@@ -115,28 +118,28 @@ public class ContentSettings extends ContentChild
|
||||
GuiButtonBase button1;
|
||||
GuiButtonBase button2;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
if(this.setting instanceof BooleanSetting)
|
||||
{
|
||||
BooleanSetting setting = (BooleanSetting) this.setting;
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.generic.enable"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.enable"), () ->
|
||||
{
|
||||
setting.set(true);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.generic.disable"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.generic.disable"), () ->
|
||||
{
|
||||
setting.set(false);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
boolean enabled = setting.get();
|
||||
|
||||
button1.active = !enabled;
|
||||
button2.active = enabled;
|
||||
button1.field_230693_o_ = !enabled;
|
||||
button2.field_230693_o_ = enabled;
|
||||
}
|
||||
else if(this.setting instanceof IntegerSetting)
|
||||
{
|
||||
@@ -144,7 +147,7 @@ public class ContentSettings extends ContentChild
|
||||
this.valueField.setText(String.valueOf(setting.get()));
|
||||
|
||||
container.add(this.valueField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.actions.set"), () ->
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.set"), () ->
|
||||
{
|
||||
String text = this.valueField.getText();
|
||||
|
||||
@@ -157,7 +160,7 @@ public class ContentSettings extends ContentChild
|
||||
setting.set(Integer.parseInt(text));
|
||||
}
|
||||
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -172,18 +175,18 @@ public class ContentSettings extends ContentChild
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.setting instanceof IntegerSetting)
|
||||
{
|
||||
this.valueField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.valueField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.shortcuts.tooltip.settings");
|
||||
return new TranslationTextComponent("gui.worldhandler.shortcuts.tooltip.settings");
|
||||
}
|
||||
|
||||
public abstract static class Setting<T>
|
||||
|
||||
@@ -2,7 +2,7 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.impl.BuilderSignEditor;
|
||||
@@ -20,12 +20,14 @@ import exopandora.worldhandler.gui.menu.impl.MenuColorField;
|
||||
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.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -59,7 +61,7 @@ public class ContentSignEditor extends Content
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.commmand"));
|
||||
this.commandField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.commmand"));
|
||||
this.commandField.setValidator(Predicates.notNull());
|
||||
this.commandField.setText(this.builderSignEditor.getCommand(this.selectedLine));
|
||||
this.commandField.setCursorPositionEnd();
|
||||
@@ -102,50 +104,50 @@ public class ContentSignEditor extends Content
|
||||
GuiButtonBase button3;
|
||||
GuiButtonBase button4;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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));
|
||||
|
||||
if(this.isActive)
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
container.add(button1 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_1"), () ->
|
||||
{
|
||||
this.selectedLine = 0;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
container.add(button2 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_2"), () ->
|
||||
{
|
||||
this.selectedLine = 1;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
container.add(button3 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_3"), () ->
|
||||
{
|
||||
this.selectedLine = 2;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.text_line_4"), () ->
|
||||
{
|
||||
this.selectedLine = 3;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(this.editColor)
|
||||
{
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.done"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.done"), () -> this.toggleEditColor(container)));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(this.commandField);
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.blocks.sign_editor.format_text_line"), () -> this.toggleEditColor(container)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.actions.place_command_block"), () ->
|
||||
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"), () ->
|
||||
{
|
||||
CommandHelper.sendCommand(this.builderSignEditor, this.builderSignEditor.isSpecial());
|
||||
}));
|
||||
}
|
||||
|
||||
button1.active = this.selectedLine != 0;
|
||||
button2.active = this.selectedLine != 1;
|
||||
button3.active = this.selectedLine != 2;
|
||||
button4.active = this.selectedLine != 3;
|
||||
button1.field_230693_o_ = this.selectedLine != 0;
|
||||
button2.field_230693_o_ = this.selectedLine != 1;
|
||||
button3.field_230693_o_ = this.selectedLine != 2;
|
||||
button4.field_230693_o_ = this.selectedLine != 3;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -161,35 +163,33 @@ public class ContentSignEditor extends Content
|
||||
private void toggleEditColor(Container container)
|
||||
{
|
||||
this.editColor = !this.editColor;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(this.isActive)
|
||||
{
|
||||
if(!this.editColor)
|
||||
{
|
||||
this.commandField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.commandField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
float scale = 4;
|
||||
|
||||
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.pushMatrix();
|
||||
matrix.push();
|
||||
matrix.translate(container.field_230708_k_ / 2 - 8.5F * scale, container.field_230709_l_ / 2 - 15 - 8.5F * scale, 0);
|
||||
matrix.scale(scale, scale, scale);
|
||||
|
||||
RenderSystem.translatef(container.width / 2 - 8.5F * scale, container.height / 2 - 15 - 8.5F * scale, 0);
|
||||
RenderSystem.scalef(scale, scale, scale);
|
||||
Minecraft.getInstance().getItemRenderer().renderItemIntoGUI(new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
RenderUtils.renderItemIntoGUI(matrix, new ItemStack(Items.OAK_SIGN), 0, 0);
|
||||
matrix.pop();
|
||||
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
String displayString = I18n.format("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.getLocalizedName());
|
||||
TranslationTextComponent text = new TranslationTextComponent("gui.worldhandler.blocks.sign_editor.look_at_sign", KeyHandler.KEY_WORLD_HANDLER.func_238171_j_());
|
||||
FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer;
|
||||
fontRenderer.drawString(displayString, x + 116 - fontRenderer.getStringWidth(displayString) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
fontRenderer.func_238422_b_(matrix, text, x + 116 - fontRenderer.func_238414_a_(text) / 2, y + 70, Config.getSkin().getLabelColor());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,15 +200,15 @@ public class ContentSignEditor extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.blocks.sign_editor");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.blocks.sign_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.blocks.sign_editor");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.blocks.sign_editor");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -2,17 +2,19 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import com.google.common.base.Predicates;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
import exopandora.worldhandler.builder.component.impl.ComponentAttribute;
|
||||
import exopandora.worldhandler.builder.impl.BuilderSummon;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes;
|
||||
import exopandora.worldhandler.builder.impl.EnumAttributes.Applyable;
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.button.EnumIcon;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonIcon;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonItem;
|
||||
import exopandora.worldhandler.gui.button.GuiSlider;
|
||||
import exopandora.worldhandler.gui.button.GuiTextFieldTooltip;
|
||||
@@ -28,13 +30,19 @@ import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
@@ -47,7 +55,6 @@ public class ContentSummon extends Content
|
||||
private GuiTextFieldTooltip passengerField;
|
||||
|
||||
private int potionPage = 0;
|
||||
private int equipmentPage = 0;
|
||||
|
||||
private Page page = Page.START;
|
||||
|
||||
@@ -57,7 +64,58 @@ public class ContentSummon extends Content
|
||||
|
||||
private final BuilderSummon builderSummon = new BuilderSummon();
|
||||
|
||||
private final List<EnumAttributes> attributes = Stream.concat(EnumAttributes.getAttributesFor(Applyable.BOTH).stream(), EnumAttributes.getAttributesFor(Applyable.MOB).stream()).collect(Collectors.toList());
|
||||
private final ResourceLocation[] helmets =
|
||||
{
|
||||
Blocks.AIR.getRegistryName(),
|
||||
Items.LEATHER_HELMET.getRegistryName(),
|
||||
Items.IRON_HELMET.getRegistryName(),
|
||||
Items.CHAINMAIL_HELMET.getRegistryName(),
|
||||
Items.GOLDEN_HELMET.getRegistryName(),
|
||||
Items.DIAMOND_HELMET.getRegistryName(),
|
||||
Items.field_234763_ls_.getRegistryName() // netherite_helmet
|
||||
};
|
||||
private final ResourceLocation[] chestplates =
|
||||
{
|
||||
Blocks.AIR.getRegistryName(),
|
||||
Items.LEATHER_CHESTPLATE.getRegistryName(),
|
||||
Items.IRON_CHESTPLATE.getRegistryName(),
|
||||
Items.CHAINMAIL_CHESTPLATE.getRegistryName(),
|
||||
Items.GOLDEN_CHESTPLATE.getRegistryName(),
|
||||
Items.DIAMOND_CHESTPLATE.getRegistryName(),
|
||||
Items.field_234764_lt_.getRegistryName() // netherite_chestplate
|
||||
};
|
||||
private final ResourceLocation[] leggings =
|
||||
{
|
||||
Blocks.AIR.getRegistryName(),
|
||||
Items.LEATHER_LEGGINGS.getRegistryName(),
|
||||
Items.IRON_LEGGINGS.getRegistryName(),
|
||||
Items.CHAINMAIL_LEGGINGS.getRegistryName(),
|
||||
Items.GOLDEN_LEGGINGS.getRegistryName(),
|
||||
Items.DIAMOND_LEGGINGS.getRegistryName(),
|
||||
Items.field_234765_lu_.getRegistryName() // netherite_leggings
|
||||
};
|
||||
private final ResourceLocation[] boots =
|
||||
{
|
||||
Blocks.AIR.getRegistryName(),
|
||||
Items.LEATHER_BOOTS.getRegistryName(),
|
||||
Items.IRON_BOOTS.getRegistryName(),
|
||||
Items.CHAINMAIL_BOOTS.getRegistryName(),
|
||||
Items.GOLDEN_BOOTS.getRegistryName(),
|
||||
Items.DIAMOND_BOOTS.getRegistryName(),
|
||||
Items.field_234766_lv_.getRegistryName() // netherite_boots
|
||||
};
|
||||
private final ResourceLocation[] swords =
|
||||
{
|
||||
Blocks.AIR.getRegistryName(),
|
||||
Items.WOODEN_SWORD.getRegistryName(),
|
||||
Items.STONE_SWORD.getRegistryName(),
|
||||
Items.IRON_SWORD.getRegistryName(),
|
||||
Items.GOLDEN_SWORD.getRegistryName(),
|
||||
Items.DIAMOND_SWORD.getRegistryName(),
|
||||
Items.field_234754_kI_.getRegistryName() // netherite_sword
|
||||
};
|
||||
private final ResourceLocation[][] armor = {this.helmets, this.chestplates, this.leggings, this.boots};
|
||||
private final ResourceLocation[][] hands = {this.swords, this.swords};
|
||||
|
||||
@Override
|
||||
public ICommandBuilder getCommandBuilder()
|
||||
@@ -68,7 +126,7 @@ public class ContentSummon extends Content
|
||||
@Override
|
||||
public void init(Container container)
|
||||
{
|
||||
for(EnumAttributes attribute : this.builderSummon.getAttributes())
|
||||
for(Attribute attribute : this.builderSummon.getAttributes())
|
||||
{
|
||||
double ammount = this.builderSummon.getAttributeAmmount(attribute);
|
||||
|
||||
@@ -99,7 +157,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, I18n.format("gui.worldhandler.entities.summon.start.mob_id") + " (" + I18n.format("gui.worldhandler.generic.name") + ")");
|
||||
this.mobField = new GuiTextFieldTooltip(x + 118, y, 114, 20, new StringTextComponent(I18n.format("gui.worldhandler.entities.summon.start.mob_id") + " (" + I18n.format("gui.worldhandler.generic.name") + ")"));
|
||||
this.mobField.setValidator(Predicates.notNull());
|
||||
this.mobField.setText(this.mob);
|
||||
this.mobField.setResponder(text ->
|
||||
@@ -109,7 +167,7 @@ public class ContentSummon extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.customNameField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, I18n.format("gui.worldhandler.entities.summon.start.custom_name"));
|
||||
this.customNameField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.custom_name"));
|
||||
this.customNameField.setValidator(Predicates.notNull());
|
||||
this.customNameField.setText(this.name);
|
||||
this.customNameField.setResponder(text ->
|
||||
@@ -119,7 +177,7 @@ public class ContentSummon extends Content
|
||||
container.initButtons();
|
||||
});
|
||||
|
||||
this.passengerField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.entities.summon.start.passenger_mob_id"));
|
||||
this.passengerField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start.passenger_mob_id"));
|
||||
this.passengerField.setValidator(Predicates.notNull());
|
||||
this.passengerField.setText(this.passenger);
|
||||
this.passengerField.setResponder(text ->
|
||||
@@ -131,28 +189,28 @@ public class ContentSummon extends Content
|
||||
|
||||
if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
MenuPageList<EnumAttributes> attributes = new MenuPageList<EnumAttributes>(x + 118, y, this.attributes, 114, 20, 3, container, new ILogicPageList<EnumAttributes>()
|
||||
MenuPageList<Attribute> attributes = new MenuPageList<Attribute>(x + 118, y, ComponentAttribute.ATTRIBUTES, 114, 20, 3, container, new ILogicPageList<Attribute>()
|
||||
{
|
||||
@Override
|
||||
public String translate(EnumAttributes item)
|
||||
public IFormattableTextComponent translate(Attribute item)
|
||||
{
|
||||
return item.getTranslation();
|
||||
return new TranslationTextComponent(item.func_233754_c_());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(EnumAttributes item)
|
||||
public IFormattableTextComponent toTooltip(Attribute item)
|
||||
{
|
||||
return item.getAttribute();
|
||||
return new StringTextComponent(item.getRegistryName().toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(EnumAttributes item)
|
||||
public void onClick(Attribute item)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, EnumAttributes item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent 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 ->
|
||||
{
|
||||
@@ -187,52 +245,34 @@ public class ContentSummon extends Content
|
||||
GuiButtonBase button5;
|
||||
GuiButtonBase button6;
|
||||
GuiButtonBase button7;
|
||||
GuiButtonItem button8;
|
||||
GuiButtonItem button9;
|
||||
GuiButtonItem button10;
|
||||
GuiButtonItem button11;
|
||||
GuiButtonItem button12;
|
||||
GuiButtonBase button13;
|
||||
GuiButtonItem button14;
|
||||
GuiButtonItem button15;
|
||||
GuiButtonItem button16;
|
||||
GuiButtonItem button17;
|
||||
GuiButtonItem button18;
|
||||
GuiButtonBase button19;
|
||||
GuiButtonItem button20;
|
||||
GuiButtonItem button21;
|
||||
GuiButtonItem button22;
|
||||
GuiButtonItem button23;
|
||||
GuiButtonItem button24;
|
||||
GuiButtonBase button25;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(button4 = new GuiButtonBase(x, y, 114, 20, I18n.format("gui.worldhandler.entities.summon.start"), () ->
|
||||
container.add(button4 = new GuiButtonBase(x, y, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button5 = new GuiButtonBase(x, y + 24, 114, 20, I18n.format("gui.worldhandler.entities.summon.potion_effects"), () ->
|
||||
container.add(button5 = new GuiButtonBase(x, y + 24, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.potion_effects"), () ->
|
||||
{
|
||||
this.page = Page.POTIONS;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button6 = new GuiButtonBase(x, y + 48, 114, 20, I18n.format("gui.worldhandler.entities.summon.attributes"), () ->
|
||||
container.add(button6 = new GuiButtonBase(x, y + 48, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.attributes"), () ->
|
||||
{
|
||||
this.page = Page.ATTRIBUTES;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button7 = new GuiButtonBase(x, y + 72, 114, 20, I18n.format("gui.worldhandler.entities.summon.equipment"), () ->
|
||||
container.add(button7 = new GuiButtonBase(x, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.entities.summon.equipment"), () ->
|
||||
{
|
||||
this.page = Page.EQUIPMENT;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
button4.active = false;
|
||||
button4.field_230693_o_ = false;
|
||||
|
||||
container.add(this.mobField);
|
||||
container.add(this.customNameField);
|
||||
@@ -240,28 +280,28 @@ public class ContentSummon extends Content
|
||||
|
||||
if(!this.builderSummon.needsCommandBlock() && !this.builderSummon.getCustomName().isSpecial())
|
||||
{
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.title.entities.summon"), this::send));
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.title.entities.summon"), this::send));
|
||||
}
|
||||
else
|
||||
{
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.actions.place_command_block"), this::send));
|
||||
container.add(button3 = new GuiButtonBase(x + 118, y + 72, 114, 20, new TranslationTextComponent("gui.worldhandler.actions.place_command_block"), this::send));
|
||||
}
|
||||
|
||||
button3.active = ForgeRegistries.ENTITIES.containsKey(this.builderSummon.getEntity());
|
||||
button3.field_230693_o_ = ForgeRegistries.ENTITIES.containsKey(this.builderSummon.getEntity());
|
||||
}
|
||||
else if(Page.POTIONS.equals(this.page))
|
||||
{
|
||||
button5.active = false;
|
||||
button5.field_230693_o_ = false;
|
||||
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 56, 20, "<", () ->
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 56, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.potionPage--;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, ">", () ->
|
||||
container.add(button2 = new GuiButtonBase(x + 118 + 60, y + 72, 55, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.potionPage++;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
int count = 0;
|
||||
@@ -274,28 +314,28 @@ public class ContentSummon extends Content
|
||||
{
|
||||
if(this.potionPage == 0)
|
||||
{
|
||||
button1.active = false;
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
if(this.potionPage == ForgeRegistries.POTIONS.getKeys().size() - 3)
|
||||
{
|
||||
button2.active = false;
|
||||
button2.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
if(count == this.potionPage)
|
||||
{
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), I18n.format(potion.getName()), value ->
|
||||
container.add(new GuiSlider(x + 118, y, 114, 20, 0, Config.getSliders().getMaxSummonPotionAmplifier(), 0, container, new LogicSliderSimple("amplifier" + potion.getRegistryName(), new TranslationTextComponent(potion.getName()), 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(), I18n.format("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 TranslationTextComponent("gui.worldhandler.potion.time.minutes"), value ->
|
||||
{
|
||||
this.builderSummon.setMinutes(potion, value);
|
||||
})));
|
||||
container.add(new GuiButtonBase(x + 118, y + 48, 114, 20, I18n.format("gui.worldhandler.potions.effect.particles", this.builderSummon.getShowParticles(potion) ? I18n.format("gui.worldhandler.generic.on") : I18n.format("gui.worldhandler.generic.off")), () ->
|
||||
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")), () ->
|
||||
{
|
||||
this.builderSummon.setShowParticles(potion, !this.builderSummon.getShowParticles(potion));
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
break;
|
||||
}
|
||||
@@ -306,259 +346,50 @@ public class ContentSummon extends Content
|
||||
}
|
||||
else if(Page.ATTRIBUTES.equals(this.page))
|
||||
{
|
||||
button6.active = false;
|
||||
button6.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.EQUIPMENT.equals(this.page))
|
||||
{
|
||||
container.add(button1 = new GuiButtonBase(x + 118, y + 72, 56, 20, "<", () ->
|
||||
{
|
||||
this.equipmentPage--;
|
||||
container.init();
|
||||
}));
|
||||
container.add(button2 = new GuiButtonBase(x + 118 + 60, y + 72, 54, 20, ">", () ->
|
||||
{
|
||||
this.equipmentPage++;
|
||||
container.init();
|
||||
}));
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
final int index = i;
|
||||
|
||||
container.add(new GuiButtonBase(x + 118, y + 24 * i, 20, 20, TextUtils.ARROW_LEFT, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(index, this.armor[index][Math.floorMod(ArrayUtils.indexOf(this.armor[index], this.builderSummon.getArmorItem(index)) - 1, this.armor[index].length)]);
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button1 = new GuiButtonItem(x + 118 + 24, y + 24 * i, 20, 20, ForgeRegistries.ITEMS.getValue(this.builderSummon.getArmorItem(i)), null));
|
||||
container.add(new GuiButtonBase(x + 118 + 47, y + 24 * i, 20, 20, TextUtils.ARROW_RIGHT, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(index, this.armor[index][Math.floorMod(ArrayUtils.indexOf(this.armor[index], this.builderSummon.getArmorItem(index)) + 1, this.armor[index].length)]);
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
if(this.equipmentPage == 0)
|
||||
{
|
||||
button1.active = false;
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
final int index = i;
|
||||
|
||||
container.add(button8 = new GuiButtonItem(x + 118, y, 18, 20, Items.LEATHER_HELMET, () ->
|
||||
container.add(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 12, 20, 20, EnumIcon.ARROW_UP, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Items.LEATHER_HELMET);
|
||||
container.init();
|
||||
this.builderSummon.setHandItem(index, this.hands[index][Math.floorMod(ArrayUtils.indexOf(this.hands[index], this.builderSummon.getHandItem(index)) - 1, this.hands[index].length)]);
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(button9 = new GuiButtonItem(x + 118 + 20 - 1, y, 18, 20, Items.IRON_HELMET, () ->
|
||||
container.add(button1 = new GuiButtonItem(x + 118 + 70 + 24 * i, y + 36, 20, 20, ForgeRegistries.ITEMS.getValue(this.builderSummon.getHandItem(i)), null));
|
||||
container.add(new GuiButtonIcon(x + 118 + 70 + 24 * i, y + 60, 20, 20, EnumIcon.ARROW_DOWN, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Items.IRON_HELMET);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button10 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y, 18, 20, Items.CHAINMAIL_HELMET, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Items.CHAINMAIL_HELMET);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button11 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y, 18, 20, Items.GOLDEN_HELMET, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Items.GOLDEN_HELMET);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button12 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y, 18, 20, Items.DIAMOND_HELMET, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Items.DIAMOND_HELMET);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button13 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(3, Blocks.AIR);
|
||||
container.init();
|
||||
System.out.println(index + " " + ArrayUtils.indexOf(this.hands[index], this.builderSummon.getHandItem(index)) + 1);
|
||||
this.builderSummon.setHandItem(index, this.hands[index][Math.floorMod(ArrayUtils.indexOf(this.hands[index], this.builderSummon.getHandItem(index)) + 1, this.hands[index].length)]);
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
container.add(button14 = new GuiButtonItem(x + 118, y + 24, 18, 20, Items.LEATHER_CHESTPLATE, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Items.LEATHER_CHESTPLATE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button15 = new GuiButtonItem(x + 118 + 20 - 1, y + 24, 18, 20, Items.IRON_CHESTPLATE, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Items.IRON_CHESTPLATE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button16 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y + 24, 18, 20, Items.CHAINMAIL_CHESTPLATE, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Items.CHAINMAIL_CHESTPLATE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button17 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y + 24, 18, 20, Items.GOLDEN_CHESTPLATE, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Items.GOLDEN_CHESTPLATE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button18 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y + 24, 18, 20, Items.DIAMOND_CHESTPLATE, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Items.DIAMOND_CHESTPLATE);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button19 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y + 24, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(2, Blocks.AIR);
|
||||
container.init();
|
||||
}));
|
||||
|
||||
container.add(button20 = new GuiButtonItem(x + 118, y + 48, 18, 20, Items.LEATHER_LEGGINGS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Items.LEATHER_LEGGINGS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button21 = new GuiButtonItem(x + 118 + 20 - 1, y + 48, 18, 20, Items.IRON_LEGGINGS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Items.IRON_LEGGINGS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button22 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y + 48, 18, 20, Items.CHAINMAIL_LEGGINGS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Items.CHAINMAIL_LEGGINGS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button23 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y + 48, 18, 20, Items.GOLDEN_LEGGINGS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Items.GOLDEN_LEGGINGS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button24 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y + 48, 18, 20, Items.DIAMOND_LEGGINGS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Items.DIAMOND_LEGGINGS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button25 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y + 48, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(1, Blocks.AIR);
|
||||
container.init();
|
||||
}));
|
||||
|
||||
button8.active = !this.builderSummon.getArmorItem(3).equals(Items.LEATHER_HELMET.getRegistryName());
|
||||
button9.active = !this.builderSummon.getArmorItem(3).equals(Items.IRON_HELMET.getRegistryName());
|
||||
button10.active = !this.builderSummon.getArmorItem(3).equals(Items.CHAINMAIL_HELMET.getRegistryName());
|
||||
button11.active = !this.builderSummon.getArmorItem(3).equals(Items.GOLDEN_HELMET.getRegistryName());
|
||||
button12.active = !this.builderSummon.getArmorItem(3).equals(Items.DIAMOND_HELMET.getRegistryName());
|
||||
button13.active = !this.builderSummon.getArmorItem(3).equals(Blocks.AIR.getRegistryName());
|
||||
|
||||
button14.active = !this.builderSummon.getArmorItem(2).equals(Items.LEATHER_CHESTPLATE.getRegistryName());
|
||||
button15.active = !this.builderSummon.getArmorItem(2).equals(Items.IRON_CHESTPLATE.getRegistryName());
|
||||
button16.active = !this.builderSummon.getArmorItem(2).equals(Items.CHAINMAIL_CHESTPLATE.getRegistryName());
|
||||
button17.active = !this.builderSummon.getArmorItem(2).equals(Items.GOLDEN_CHESTPLATE.getRegistryName());
|
||||
button18.active = !this.builderSummon.getArmorItem(2).equals(Items.DIAMOND_CHESTPLATE.getRegistryName());
|
||||
button19.active = !this.builderSummon.getArmorItem(2).equals(Blocks.AIR.getRegistryName());
|
||||
|
||||
button20.active = !this.builderSummon.getArmorItem(1).equals(Items.LEATHER_LEGGINGS.getRegistryName());
|
||||
button21.active = !this.builderSummon.getArmorItem(1).equals(Items.IRON_LEGGINGS.getRegistryName());
|
||||
button22.active = !this.builderSummon.getArmorItem(1).equals(Items.CHAINMAIL_LEGGINGS.getRegistryName());
|
||||
button23.active = !this.builderSummon.getArmorItem(1).equals(Items.GOLDEN_LEGGINGS.getRegistryName());
|
||||
button24.active = !this.builderSummon.getArmorItem(1).equals(Items.DIAMOND_LEGGINGS.getRegistryName());
|
||||
button25.active = !this.builderSummon.getArmorItem(1).equals(Blocks.AIR.getRegistryName());
|
||||
}
|
||||
else if(this.equipmentPage == 1)
|
||||
{
|
||||
button2.active = false;
|
||||
|
||||
container.add(button8 = new GuiButtonItem(x + 118, y, 18, 20, Items.LEATHER_BOOTS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Items.LEATHER_BOOTS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button9 = new GuiButtonItem(x + 118 + 20 - 1, y, 18, 20, Items.IRON_BOOTS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Items.IRON_BOOTS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button10 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y, 18, 20, Items.CHAINMAIL_BOOTS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Items.CHAINMAIL_BOOTS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button11 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y, 18, 20, Items.GOLDEN_BOOTS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Items.GOLDEN_BOOTS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button12 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y, 18, 20, Items.DIAMOND_BOOTS, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Items.DIAMOND_BOOTS);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button13 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setArmorItem(0, Blocks.AIR);
|
||||
container.init();
|
||||
}));
|
||||
|
||||
container.add(button14 = new GuiButtonItem(x + 118, y + 24, 18, 20, Items.WOODEN_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Items.WOODEN_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button15 = new GuiButtonItem(x + 118 + 20 - 1, y + 24, 18, 20, Items.STONE_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Items.STONE_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button16 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y + 24, 18, 20, Items.IRON_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Items.IRON_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button17 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y + 24, 18, 20, Items.GOLDEN_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Items.GOLDEN_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button18 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y + 24, 18, 20, Items.DIAMOND_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Items.DIAMOND_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button19 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y + 24, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(0, Blocks.AIR);
|
||||
container.init();
|
||||
}));
|
||||
|
||||
container.add(button20 = new GuiButtonItem(x + 118, y + 48, 18, 20, Items.WOODEN_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Items.WOODEN_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button21 = new GuiButtonItem(x + 118 + 20 - 1, y + 48, 18, 20, Items.STONE_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Items.STONE_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button22 = new GuiButtonItem(x + 118 + 20 * 2 - 2, y + 48, 18, 20, Items.IRON_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Items.IRON_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button23 = new GuiButtonItem(x + 118 + 20 * 3 - 3, y + 48, 18, 20, Items.GOLDEN_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Items.GOLDEN_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button24 = new GuiButtonItem(x + 118 + 20 * 4 - 4, y + 48, 18, 20, Items.DIAMOND_SWORD, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Items.DIAMOND_SWORD);
|
||||
container.init();
|
||||
}));
|
||||
container.add(button25 = new GuiButtonBase(x + 118 + 20 * 5 - 5, y + 48, 20, 20, null, () ->
|
||||
{
|
||||
this.builderSummon.setHandItem(1, Blocks.AIR);
|
||||
container.init();
|
||||
}));
|
||||
|
||||
button8.active = !this.builderSummon.getArmorItem(0).equals(Items.LEATHER_BOOTS.getRegistryName());
|
||||
button9.active = !this.builderSummon.getArmorItem(0).equals(Items.IRON_BOOTS.getRegistryName());
|
||||
button10.active = !this.builderSummon.getArmorItem(0).equals(Items.CHAINMAIL_BOOTS.getRegistryName());
|
||||
button11.active = !this.builderSummon.getArmorItem(0).equals(Items.GOLDEN_BOOTS.getRegistryName());
|
||||
button12.active = !this.builderSummon.getArmorItem(0).equals(Items.DIAMOND_BOOTS.getRegistryName());
|
||||
button13.active = !this.builderSummon.getArmorItem(0).equals(Blocks.AIR.getRegistryName());
|
||||
|
||||
button14.active = !this.builderSummon.getHandItem(0).equals(Items.WOODEN_SWORD.getRegistryName());
|
||||
button15.active = !this.builderSummon.getHandItem(0).equals(Items.STONE_SWORD.getRegistryName());
|
||||
button16.active = !this.builderSummon.getHandItem(0).equals(Items.IRON_SWORD.getRegistryName());
|
||||
button17.active = !this.builderSummon.getHandItem(0).equals(Items.GOLDEN_SWORD.getRegistryName());
|
||||
button18.active = !this.builderSummon.getHandItem(0).equals(Items.DIAMOND_SWORD.getRegistryName());
|
||||
button19.active = !this.builderSummon.getHandItem(0).equals(Blocks.AIR.getRegistryName());
|
||||
|
||||
button20.active = !this.builderSummon.getHandItem(1).equals(Items.WOODEN_SWORD.getRegistryName());
|
||||
button21.active = !this.builderSummon.getHandItem(1).equals(Items.STONE_SWORD.getRegistryName());
|
||||
button22.active = !this.builderSummon.getHandItem(1).equals(Items.IRON_SWORD.getRegistryName());
|
||||
button23.active = !this.builderSummon.getHandItem(1).equals(Items.GOLDEN_SWORD.getRegistryName());
|
||||
button24.active = !this.builderSummon.getHandItem(1).equals(Items.DIAMOND_SWORD.getRegistryName());
|
||||
button25.active = !this.builderSummon.getHandItem(1).equals(Blocks.AIR.getRegistryName());
|
||||
}
|
||||
button1.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
button7.active = false;
|
||||
button7.field_230693_o_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,30 +410,39 @@ public class ContentSummon extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
this.mobField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.customNameField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.passengerField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.mobField.func_230431_b_(matrix, mouseX, mouseY, partialTicks);
|
||||
this.customNameField.func_230431_b_(matrix, mouseX, mouseY, partialTicks);
|
||||
this.passengerField.func_230431_b_(matrix, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
else if(Page.POTIONS.equals(this.page))
|
||||
{
|
||||
Minecraft.getInstance().fontRenderer.drawString((this.potionPage + 1) + "/" + (ForgeRegistries.POTIONS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
Minecraft.getInstance().fontRenderer.func_238421_b_(matrix, (this.potionPage + 1) + "/" + (ForgeRegistries.POTIONS.getKeys().size() - 2), x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
}
|
||||
else if(Page.EQUIPMENT.equals(this.page))
|
||||
{
|
||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/beacon.png"));
|
||||
container.setBlitOffset(0);
|
||||
|
||||
for(int row = 0; row < 3; row++)
|
||||
{
|
||||
container.blit(x + 116 + 99, y + 2 + 24 * row, 112, 221, 16, 16);
|
||||
}
|
||||
|
||||
Minecraft.getInstance().fontRenderer.drawString((this.equipmentPage + 1) + "/2", x + 118, y - 11, Config.getSkin().getHeadlineColor());
|
||||
container.func_230926_e_(0); //setBlitOffset
|
||||
|
||||
for(int i = 0; i < 4; i++)
|
||||
{
|
||||
if(this.builderSummon.getArmorItem(i).equals(Items.AIR.getRegistryName()))
|
||||
{
|
||||
container.func_238474_b_(matrix, x + 118 + 24 + 2, y + 2 + 24 * i, 112, 221, 16, 16); //blit
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
{
|
||||
if(this.builderSummon.getHandItem(i).equals(Items.AIR.getRegistryName()))
|
||||
{
|
||||
container.func_238474_b_(matrix, x + 118 + 70 + 2 + 24 * i, y + 2 + 36, 112, 221, 16, 16); //blit
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -620,15 +460,15 @@ public class ContentSummon extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.entities.summon");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.entities.summon");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.entities.summon");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.entities.summon");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -6,6 +6,8 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.Main;
|
||||
import exopandora.worldhandler.builder.CommandSyntax;
|
||||
import exopandora.worldhandler.builder.ICommandBuilder;
|
||||
@@ -31,13 +33,16 @@ import exopandora.worldhandler.usercontent.model.JsonModel;
|
||||
import exopandora.worldhandler.usercontent.model.JsonText;
|
||||
import exopandora.worldhandler.usercontent.model.JsonUsercontent;
|
||||
import exopandora.worldhandler.usercontent.model.JsonWidget;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -132,13 +137,13 @@ public class ContentUsercontent extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
for(VisibleObject<TextFieldWidget> textfield : this.textfields.values())
|
||||
{
|
||||
if(textfield.getObject().visible)
|
||||
if(textfield.getObject().field_230694_p_)
|
||||
{
|
||||
textfield.getObject().renderButton(mouseX, mouseY, partialTicks);
|
||||
textfield.getObject().func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +153,7 @@ public class ContentUsercontent extends Content
|
||||
{
|
||||
if(text.getVisible() == null || text.getVisible().eval(this.engineAdapter))
|
||||
{
|
||||
container.getMinecraft().fontRenderer.drawString(TextFormatting.formatNullable(text.getText()), text.getX() + x, text.getY() + y, text.getColor());
|
||||
container.getMinecraft().fontRenderer.func_238422_b_(matrix, TextUtils.formatNonnull(text.getText()), text.getX() + x, text.getY() + y, text.getColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,15 +166,15 @@ public class ContentUsercontent extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return TextFormatting.formatNullable(this.content.getGui().getTitle());
|
||||
return TextUtils.formatNonnull(this.content.getGui().getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return TextFormatting.formatNullable(this.content.getGui().getTab().getTitle());
|
||||
return TextUtils.formatNonnull(this.content.getGui().getTab().getTitle());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -251,8 +256,8 @@ public class ContentUsercontent extends Content
|
||||
|
||||
private void printError(String type, int index, Throwable e)
|
||||
{
|
||||
ITextComponent message = new StringTextComponent(net.minecraft.util.text.TextFormatting.RED + "<" + Main.NAME + ":" + this.id + ":" + type + ":" + index + "> " + e.getMessage());
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.CHAT, message);
|
||||
ITextComponent message = new StringTextComponent(TextFormatting.RED + "<" + Main.NAME + ":" + this.id + ":" + type + ":" + index + "> " + e.getMessage());
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.CHAT, message, Util.field_240973_b_);
|
||||
}
|
||||
|
||||
private void updateTextfields()
|
||||
@@ -260,7 +265,7 @@ public class ContentUsercontent extends Content
|
||||
for(VisibleActiveObject<TextFieldWidget> visObj : this.textfields.values())
|
||||
{
|
||||
visObj.getObject().setEnabled(visObj.isEnabled(this.engineAdapter));
|
||||
visObj.getObject().visible = visObj.isVisible(this.engineAdapter);
|
||||
visObj.getObject().field_230694_p_ = visObj.isVisible(this.engineAdapter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,8 +273,8 @@ public class ContentUsercontent extends Content
|
||||
{
|
||||
for(VisibleActiveObject<Widget> visObj : this.buttons)
|
||||
{
|
||||
visObj.getObject().active = visObj.isEnabled(this.engineAdapter);
|
||||
visObj.getObject().visible = visObj.isVisible(this.engineAdapter);
|
||||
visObj.getObject().field_230693_o_ = visObj.isEnabled(this.engineAdapter);
|
||||
visObj.getObject().field_230694_p_ = visObj.isVisible(this.engineAdapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package exopandora.worldhandler.gui.content.impl;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.gui.category.Categories;
|
||||
@@ -10,12 +12,13 @@ import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.gui.content.Contents;
|
||||
import exopandora.worldhandler.util.ActionHelper;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
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.world.dimension.DimensionType;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -30,7 +33,6 @@ public class ContentWorldInfo extends Content
|
||||
|
||||
private GuiTextFieldTooltip worldField;
|
||||
private GuiTextFieldTooltip seedField;
|
||||
private GuiTextFieldTooltip terrainField;
|
||||
|
||||
private GuiTextFieldTooltip totalTimeField;
|
||||
private GuiTextFieldTooltip currentTimeField;
|
||||
@@ -38,25 +40,23 @@ public class ContentWorldInfo extends Content
|
||||
@Override
|
||||
public void initGui(Container container, int x, int y)
|
||||
{
|
||||
World world = this.getWorld();
|
||||
World world = ContentWorldInfo.getSidedWorld();
|
||||
IntegratedServer server = Minecraft.getInstance().getIntegratedServer();
|
||||
|
||||
this.posXField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
||||
this.posXField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " X: " + this.getWorldInfo(WorldInfo::getSpawnX, world));
|
||||
this.posXField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " X: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnX()));
|
||||
|
||||
this.posYField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
||||
this.posYField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Y: " + this.getWorldInfo(WorldInfo::getSpawnY, world));
|
||||
this.posYField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Y: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnY()));
|
||||
|
||||
this.posZField = new GuiTextFieldTooltip(x + 118, y + 60, 114, 20);
|
||||
this.posZField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Z: " + this.getWorldInfo(WorldInfo::getSpawnZ, world));
|
||||
this.posZField.setText(I18n.format("gui.worldhandler.world_info.start.spawn") + " Z: " + ContentWorldInfo.format(world, object -> object.getWorldInfo().getSpawnZ()));
|
||||
|
||||
this.worldField = new GuiTextFieldTooltip(x + 118, y, 114, 20);
|
||||
this.worldField.setText(I18n.format("gui.worldhandler.world_info.world.name") + ": " + this.getWorldInfo(WorldInfo::getWorldName, world));
|
||||
this.worldField = new GuiTextFieldTooltip(x + 118, y + 12, 114, 20);
|
||||
this.worldField.setText(I18n.format("gui.worldhandler.world_info.world.name") + ": " + ContentWorldInfo.format(server, object -> object.func_240793_aU_().getWorldName()));
|
||||
|
||||
this.terrainField = new GuiTextFieldTooltip(x + 118, y + 24, 114, 20);
|
||||
this.terrainField.setText(I18n.format("gui.worldhandler.world_info.world.world_type") + ": " + this.getWorldInfo(info -> I18n.format(info.getGenerator().getTranslationKey()), world));
|
||||
|
||||
this.seedField = new GuiTextFieldTooltip(x + 118, y + 48, 114, 20);
|
||||
this.seedField.setText(I18n.format("gui.worldhandler.world_info.world.seed") + ": " + this.getSeed(world));
|
||||
this.seedField = new GuiTextFieldTooltip(x + 118, y + 36, 114, 20);
|
||||
this.seedField.setText(I18n.format("gui.worldhandler.world_info.world.seed") + ": " + ContentWorldInfo.format(server, object -> object.func_241755_D_().getSeed()));
|
||||
this.seedField.setValidator(string -> string.equals(this.seedField.getText()));
|
||||
this.seedField.setCursorPositionZero();
|
||||
|
||||
@@ -74,44 +74,45 @@ public class ContentWorldInfo extends Content
|
||||
GuiButtonBase world;
|
||||
GuiButtonBase stats;
|
||||
|
||||
container.add(new GuiButtonBase(x, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.back"), () -> ActionHelper.back(this)));
|
||||
container.add(new GuiButtonBase(x + 118, y + 96, 114, 20, I18n.format("gui.worldhandler.generic.backToGame"), ActionHelper::backToGame));
|
||||
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(start = new GuiButtonBase(x, y + 12, 114, 20, I18n.format("gui.worldhandler.world_info.start"), () ->
|
||||
container.add(start = new GuiButtonBase(x, y + 12, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.start"), () ->
|
||||
{
|
||||
this.page = Page.START;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(world = new GuiButtonBase(x, y + 36, 114, 20, I18n.format("gui.worldhandler.world_info.world"), () ->
|
||||
container.add(world = new GuiButtonBase(x, y + 36, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.world"), () ->
|
||||
{
|
||||
this.page = Page.WORLD;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(stats = new GuiButtonBase(x, y + 60, 114, 20, I18n.format("gui.worldhandler.world_info.statistics"), () ->
|
||||
container.add(stats = new GuiButtonBase(x, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.statistics"), () ->
|
||||
{
|
||||
this.page = Page.STATS;
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
start.active = false;
|
||||
start.field_230693_o_ = false;
|
||||
}
|
||||
else if(Page.WORLD.equals(this.page))
|
||||
{
|
||||
GuiButtonBase seed;
|
||||
IntegratedServer server = Minecraft.getInstance().getIntegratedServer();
|
||||
|
||||
world.active = false;
|
||||
container.add(seed = new GuiButtonBase(x + 118, y + 72, 114, 20, I18n.format("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
world.field_230693_o_ = false;
|
||||
container.add(seed = new GuiButtonBase(x + 118, y + 60, 114, 20, new TranslationTextComponent("gui.worldhandler.world_info.world.copy_seed"), () ->
|
||||
{
|
||||
Minecraft.getInstance().keyboardListener.setClipboardString(this.getSeed(this.getWorld()));
|
||||
Minecraft.getInstance().keyboardListener.setClipboardString(String.valueOf(server.func_241755_D_().getSeed()));
|
||||
}));
|
||||
|
||||
seed.active = Minecraft.getInstance().getIntegratedServer() != null;
|
||||
seed.field_230693_o_ = server != null;
|
||||
}
|
||||
else if(Page.STATS.equals(this.page))
|
||||
{
|
||||
stats.active = false;
|
||||
stats.field_230693_o_ = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,62 +125,56 @@ public class ContentWorldInfo extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
public void drawScreen(MatrixStack matrix, Container container, int x, int y, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
if(Page.START.equals(this.page))
|
||||
{
|
||||
this.posXField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posYField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posZField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.posXField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.posYField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.posZField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.WORLD.equals(this.page))
|
||||
{
|
||||
this.worldField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.terrainField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.seedField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.worldField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.seedField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
else if(Page.STATS.equals(this.page))
|
||||
{
|
||||
this.totalTimeField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.currentTimeField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.totalTimeField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
this.currentTimeField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCurrentTime()
|
||||
{
|
||||
this.currentTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.world_time") + ": " + TextFormatting.formatWorldTime(Minecraft.getInstance().world.getWorldInfo().getDayTime()));
|
||||
this.currentTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.world_time") + ": " + TextUtils.formatWorldTime(Minecraft.getInstance().world.getWorldInfo().getDayTime()));
|
||||
}
|
||||
|
||||
private void updateTotalTime()
|
||||
{
|
||||
this.totalTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.played") + ": " + TextFormatting.getTotalTimePlayed(Minecraft.getInstance().world.getWorldInfo().getGameTime()));
|
||||
this.totalTimeField.setText(I18n.format("gui.worldhandler.world_info.statistics.played") + ": " + TextUtils.formatTotalTime(Minecraft.getInstance().world.getWorldInfo().getGameTime()));
|
||||
}
|
||||
|
||||
private <T> String getWorldInfo(Function<WorldInfo, T> function, World world)
|
||||
private static <T> String format(T object, Function<T, Object> function)
|
||||
{
|
||||
if(world != null)
|
||||
if(object != null)
|
||||
{
|
||||
return String.valueOf(function.apply(world.getWorldInfo()));
|
||||
return String.valueOf(function.apply(object));
|
||||
}
|
||||
|
||||
return I18n.format("gui.worldhandler.world_info.n_a");
|
||||
}
|
||||
|
||||
private World getWorld()
|
||||
private static World getSidedWorld()
|
||||
{
|
||||
if(Minecraft.getInstance().getIntegratedServer() != null)
|
||||
if(Minecraft.getInstance().isSingleplayer())
|
||||
{
|
||||
return Minecraft.getInstance().getIntegratedServer().getWorld(DimensionType.OVERWORLD);
|
||||
return Minecraft.getInstance().getIntegratedServer().func_241755_D_();
|
||||
}
|
||||
|
||||
return Minecraft.getInstance().world;
|
||||
}
|
||||
|
||||
private String getSeed(World world)
|
||||
{
|
||||
return Minecraft.getInstance().getIntegratedServer() != null ? String.valueOf(world.getWorldInfo().getSeed()) : I18n.format("gui.worldhandler.world_info.n_a");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Category getCategory()
|
||||
{
|
||||
@@ -187,15 +182,15 @@ public class ContentWorldInfo extends Content
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle()
|
||||
public IFormattableTextComponent getTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.title.world.world");
|
||||
return new TranslationTextComponent("gui.worldhandler.title.world.world");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTabTitle()
|
||||
public IFormattableTextComponent getTabTitle()
|
||||
{
|
||||
return I18n.format("gui.worldhandler.tab.world.world");
|
||||
return new TranslationTextComponent("gui.worldhandler.tab.world.world");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package exopandora.worldhandler.gui.menu;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -10,5 +12,5 @@ public interface IMenu
|
||||
void initGui(Container container);
|
||||
void initButtons(Container container);
|
||||
void tick();
|
||||
void draw(int mouseX, int mouseY, float partialTicks);
|
||||
void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks);
|
||||
}
|
||||
|
||||
@@ -3,13 +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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ILogicButtonList extends ILogic
|
||||
{
|
||||
String translate(String key, int depth);
|
||||
IFormattableTextComponent translate(String key, int depth);
|
||||
|
||||
default String buildTranslationKey(List<String> keys, int depth)
|
||||
{
|
||||
|
||||
@@ -1,25 +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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public interface ILogicMapped<T> extends ILogic
|
||||
{
|
||||
String translate(T item);
|
||||
String toTooltip(T item);
|
||||
IFormattableTextComponent translate(T item);
|
||||
IFormattableTextComponent toTooltip(T item);
|
||||
|
||||
default String formatTooltip(T item, int index, int max)
|
||||
default IFormattableTextComponent formatTooltip(T item, int index, int max)
|
||||
{
|
||||
String tooltip = this.toTooltip(item);
|
||||
IFormattableTextComponent tooltip = this.toTooltip(item);
|
||||
|
||||
if(tooltip != null)
|
||||
{
|
||||
return String.format("%s (%d/%d)", tooltip, index, max);
|
||||
return tooltip.func_240702_b_(String.format(" (%d/%d)", index, max));
|
||||
}
|
||||
|
||||
return null;
|
||||
return (IFormattableTextComponent) StringTextComponent.field_240750_d_;
|
||||
}
|
||||
|
||||
void onClick(T item);
|
||||
|
||||
@@ -2,13 +2,14 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
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, String text, T item, ActionHandler actionHandler);
|
||||
GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, T item, ActionHandler actionHandler);
|
||||
|
||||
default boolean doDisable()
|
||||
{
|
||||
|
||||
@@ -7,12 +7,16 @@ import java.util.function.BiFunction;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonList;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonList.Persistence;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.util.Node;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -52,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 String translate(Node item)
|
||||
public IFormattableTextComponent translate(Node item)
|
||||
{
|
||||
return MenuButtonList.this.logic.translate(MenuButtonList.this.buildKey(container, MenuButtonList.this.logic::buildTranslationKey), MenuButtonList.this.getDepth());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(Node item)
|
||||
public IFormattableTextComponent toTooltip(Node item)
|
||||
{
|
||||
return item.getKey();
|
||||
return new StringTextComponent(item.getKey());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatTooltip(Node item, int index, int max)
|
||||
public IFormattableTextComponent formatTooltip(Node item, int index, int max)
|
||||
{
|
||||
return ILogicMapped.super.formatTooltip(item, index, max);
|
||||
}
|
||||
@@ -73,7 +77,7 @@ public class MenuButtonList extends Menu
|
||||
public void onClick(Node item)
|
||||
{
|
||||
MenuButtonList.this.getPersistence(container, 1).setIndex(0);
|
||||
container.init();
|
||||
container.func_231160_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -95,8 +99,8 @@ 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, null, null);
|
||||
button.active = false;
|
||||
GuiButtonBase button = new GuiButtonBase(this.x, this.y + 24 * x, 114, 20, StringTextComponent.field_240750_d_, null);
|
||||
button.field_230693_o_ = false;
|
||||
container.add(button);
|
||||
}
|
||||
}
|
||||
@@ -109,7 +113,7 @@ public class MenuButtonList extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,14 +3,19 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonList;
|
||||
import exopandora.worldhandler.gui.button.GuiTextFieldTooltip;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.util.MutableStringTextComponent;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
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 net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -61,10 +66,10 @@ public class MenuColorField extends Menu
|
||||
@Override
|
||||
public void initGui(Container container)
|
||||
{
|
||||
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, I18n.format(this.translationKey));
|
||||
this.textField = new GuiTextFieldTooltip(this.x + 118, this.y, 114, 20, new TranslationTextComponent(this.translationKey));
|
||||
this.textField.setValidator(this.logic::validate);
|
||||
this.textField.setTextFormatter(this.string::formatter);
|
||||
this.textField.setText(this.string.getText());
|
||||
this.textField.setText(this.string.getUnformattedComponentText());
|
||||
this.textField.setResponder(text ->
|
||||
{
|
||||
this.string.setText(text);
|
||||
@@ -81,19 +86,19 @@ public class MenuColorField extends Menu
|
||||
container.add(new GuiButtonList<TextFormatting>(this.x + 118, this.y + 24, COLORS, 114, 20, container, new ILogicMapped<TextFormatting>()
|
||||
{
|
||||
@Override
|
||||
public String translate(TextFormatting item)
|
||||
public IFormattableTextComponent translate(TextFormatting item)
|
||||
{
|
||||
return item + I18n.format("gui.worldhandler.color") + ": " + I18n.format("gui.worldhandler.color." + item.getFriendlyName());
|
||||
return new TranslationTextComponent("gui.worldhandler.color").func_240699_a_(item).func_240702_b_(": ").func_230529_a_(new TranslationTextComponent("gui.worldhandler.color." + item.getFriendlyName()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(TextFormatting item)
|
||||
public IFormattableTextComponent toTooltip(TextFormatting item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String formatTooltip(TextFormatting item, int index, int max)
|
||||
public IFormattableTextComponent formatTooltip(TextFormatting item, int index, int max)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -101,7 +106,7 @@ public class MenuColorField extends Menu
|
||||
@Override
|
||||
public void onClick(TextFormatting item)
|
||||
{
|
||||
MenuColorField.this.string.getStyle().setColor(item);
|
||||
MenuColorField.this.string.func_240699_a_(item);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,30 +116,30 @@ public class MenuColorField extends Menu
|
||||
}
|
||||
}));
|
||||
|
||||
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, (this.string.getStyle().getItalic() ? TextFormatting.ITALIC : TextFormatting.RESET) + "I", () ->
|
||||
container.add(new GuiButtonBase(this.x + 118, this.y + 48, 20, 20, new StringTextComponent("I").func_240703_c_(Style.field_240709_b_.func_240722_b_(this.string.getStyle().getItalic())), () ->
|
||||
{
|
||||
this.string.getStyle().setItalic(!this.string.getStyle().getItalic());
|
||||
container.init();
|
||||
this.string.func_240703_c_(this.string.getStyle().func_240722_b_(!this.string.getStyle().getItalic()));
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, (this.string.getStyle().getBold() ? TextFormatting.BOLD : TextFormatting.RESET) + "B", () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 - 1, this.y + 48, 20, 20, new StringTextComponent("B").func_240703_c_(Style.field_240709_b_.func_240713_a_(this.string.getStyle().getBold())), () ->
|
||||
{
|
||||
this.string.getStyle().setBold(!this.string.getStyle().getBold());
|
||||
container.init();
|
||||
this.string.func_240703_c_(this.string.getStyle().func_240713_a_(!this.string.getStyle().getBold()));
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, (this.string.getStyle().getUnderlined() ? TextFormatting.UNDERLINE : TextFormatting.RESET) + "U", () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 2 - 1, this.y + 48, 20, 20, new StringTextComponent("U").func_240703_c_(Style.field_240709_b_.setUnderlined(this.string.getStyle().getUnderlined())), () ->
|
||||
{
|
||||
this.string.getStyle().setUnderlined(!this.string.getStyle().getUnderlined());
|
||||
container.init();
|
||||
this.string.func_240703_c_(this.string.getStyle().setUnderlined(!this.string.getStyle().getUnderlined()));
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, (this.string.getStyle().getStrikethrough() ? TextFormatting.STRIKETHROUGH : TextFormatting.RESET) + "S", () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 3 - 1, this.y + 48, 20, 20, new StringTextComponent("S").func_240703_c_(Style.field_240709_b_.setStrikethrough(this.string.getStyle().getStrikethrough())), () ->
|
||||
{
|
||||
this.string.getStyle().setStrikethrough(!this.string.getStyle().getStrikethrough());
|
||||
container.init();
|
||||
this.string.func_240703_c_(this.string.getStyle().setStrikethrough(!this.string.getStyle().getStrikethrough()));
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, (this.string.getStyle().getObfuscated() ? TextFormatting.OBFUSCATED : TextFormatting.RESET) + "O", () ->
|
||||
container.add(new GuiButtonBase(this.x + 118 + 24 * 4 - 2, this.y + 48, 20, 20, new StringTextComponent("O").func_240703_c_(Style.field_240709_b_.setObfuscated(this.string.getStyle().getObfuscated())), () ->
|
||||
{
|
||||
this.string.getStyle().setObfuscated(!this.string.getStyle().getObfuscated());
|
||||
container.init();
|
||||
this.string.func_240703_c_(this.string.getStyle().setObfuscated(!this.string.getStyle().getObfuscated()));
|
||||
container.func_231160_c_();
|
||||
}));
|
||||
}
|
||||
}
|
||||
@@ -146,8 +151,8 @@ public class MenuColorField extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
this.textField.renderButton(mouseX, mouseY, partialTicks);
|
||||
this.textField.func_230431_b_(matrix, mouseX, mouseY, partialTicks); //renderButton
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,17 @@ package exopandora.worldhandler.gui.menu.impl;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import exopandora.worldhandler.gui.button.GuiButtonBase;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
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.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -31,7 +35,7 @@ public class MenuPageList<T> extends Menu
|
||||
this.height = height;
|
||||
this.length = length;
|
||||
this.logic = Objects.requireNonNull(logic);
|
||||
this.items.sort((a, b) -> this.logic.translate(a).compareTo(this.logic.translate(b)));
|
||||
this.items.sort((a, b) -> this.logic.translate(a).getString().compareTo(this.logic.translate(b).getString()));
|
||||
this.persistence = container.getContent().getPersistence(logic.getId(), Persistence::new);
|
||||
|
||||
if(!this.items.isEmpty())
|
||||
@@ -55,12 +59,12 @@ public class MenuPageList<T> extends Menu
|
||||
{
|
||||
int buttonWidth = (this.width - 4) / 2;
|
||||
|
||||
GuiButtonBase left = new GuiButtonBase(this.x, this.y + (this.height + 4) * this.length, buttonWidth + 1, this.height, "<", () -> this.goLeft(container));
|
||||
left.active = this.persistence.getPage() > 0;
|
||||
GuiButtonBase left = new GuiButtonBase(this.x, this.y + (this.height + 4) * this.length, buttonWidth + 1, this.height, TextUtils.ARROW_LEFT, () -> this.goLeft(container));
|
||||
left.field_230693_o_ = this.persistence.getPage() > 0;
|
||||
container.add(left);
|
||||
|
||||
GuiButtonBase right = new GuiButtonBase(this.x + 5 + buttonWidth, this.y + (this.height + 4) * this.length, buttonWidth, this.height, ">", () -> this.goRight(container));
|
||||
right.active = this.persistence.getPage() < this.getTotalPages() - 1;
|
||||
GuiButtonBase right = new GuiButtonBase(this.x + 5 + buttonWidth, this.y + (this.height + 4) * this.length, buttonWidth, this.height, TextUtils.ARROW_RIGHT, () -> this.goRight(container));
|
||||
right.field_230693_o_ = this.persistence.getPage() < this.getTotalPages() - 1;
|
||||
container.add(right);
|
||||
}
|
||||
|
||||
@@ -74,7 +78,7 @@ public class MenuPageList<T> extends Menu
|
||||
if(index < this.items.size())
|
||||
{
|
||||
T item = this.items.get(index);
|
||||
String text = TextFormatting.shortenString(this.logic.translate(item), this.width, Minecraft.getInstance().fontRenderer);
|
||||
IFormattableTextComponent text = TextUtils.stripText(this.logic.translate(item), this.width, Minecraft.getInstance().fontRenderer);
|
||||
button = this.logic.onRegister(this.x, this.y + (this.height + 4) * x, this.width, this.height, text, item, () ->
|
||||
{
|
||||
this.persistence.setSelectedIndex(index);
|
||||
@@ -83,13 +87,13 @@ public class MenuPageList<T> extends Menu
|
||||
|
||||
if(this.logic.doDisable())
|
||||
{
|
||||
button.active = this.persistence.getSelectedIndex() != index;
|
||||
button.field_230693_o_ = this.persistence.getSelectedIndex() != index;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
button = new GuiButtonBase(this.x, this.y + (this.height + 4) * x, this.width, this.height, null, null);
|
||||
button.active = false;
|
||||
button = new GuiButtonBase(this.x, this.y + (this.height + 4) * x, this.width, this.height, StringTextComponent.field_240750_d_, null);
|
||||
button.field_230693_o_ = false;
|
||||
}
|
||||
|
||||
container.add(button);
|
||||
@@ -103,16 +107,16 @@ public class MenuPageList<T> extends Menu
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mouseX, int mouseY, float partialTicks)
|
||||
public void draw(MatrixStack matrix, int mouseX, int mouseY, float partialTicks)
|
||||
{
|
||||
Minecraft.getInstance().fontRenderer.drawString(String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
|
||||
Minecraft.getInstance().fontRenderer.func_238421_b_(matrix, String.format("%d/%d", this.persistence.getPage() + 1, this.getTotalPages()), this.x, this.y - 11, Config.getSkin().getHeadlineColor());
|
||||
}
|
||||
|
||||
private void goLeft(Container container)
|
||||
{
|
||||
int page = this.persistence.getPage();
|
||||
|
||||
if(Screen.hasShiftDown())
|
||||
if(Screen.func_231173_s_())
|
||||
{
|
||||
this.persistence.setPage(page - Math.min(10, page));
|
||||
}
|
||||
@@ -128,7 +132,7 @@ public class MenuPageList<T> extends Menu
|
||||
{
|
||||
int page = this.persistence.getPage();
|
||||
|
||||
if(Screen.hasShiftDown())
|
||||
if(Screen.func_231173_s_())
|
||||
{
|
||||
this.persistence.setPage(page + Math.min(10, this.getTotalPages() - 1 - page));
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import javax.annotation.Nullable;
|
||||
|
||||
import exopandora.worldhandler.builder.impl.BuilderUsercontent;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -39,7 +40,7 @@ public class UsercontentAPI
|
||||
{
|
||||
if(object != null)
|
||||
{
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.CHAT, new StringTextComponent(object.toString()));
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.CHAT, new StringTextComponent(object.toString()), Util.field_240973_b_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ import exopandora.worldhandler.gui.button.LogicSliderSimple;
|
||||
import exopandora.worldhandler.gui.container.Container;
|
||||
import exopandora.worldhandler.gui.content.Content;
|
||||
import exopandora.worldhandler.usercontent.UsercontentAPI;
|
||||
import exopandora.worldhandler.usercontent.model.JsonItem;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
import exopandora.worldhandler.usercontent.model.JsonButton;
|
||||
import exopandora.worldhandler.usercontent.model.JsonItem;
|
||||
import exopandora.worldhandler.util.TextUtils;
|
||||
import net.minecraft.client.gui.widget.Widget;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
@@ -44,8 +44,8 @@ public class ButtonFactory extends WidgetFactory
|
||||
button.getDimensions().getY() + y,
|
||||
button.getDimensions().getWidth(),
|
||||
button.getDimensions().getHeight(),
|
||||
TextFormatting.formatNonnull(button.getText()),
|
||||
TextFormatting.formatNullable(button.getAttributes() != null ? button.getAttributes().getTooltip() : null),
|
||||
TextUtils.formatNonnull(button.getText()),
|
||||
TextUtils.formatNonnull(button.getAttributes() != null ? button.getAttributes().getTooltip() : null),
|
||||
this.getActionHandlerFactory().createActionHandler(content, button.getAction())
|
||||
);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ public class ButtonFactory extends WidgetFactory
|
||||
button.getDimensions().getWidth(),
|
||||
button.getDimensions().getHeight(),
|
||||
button.getAttributes().getIcon(),
|
||||
TextFormatting.formatNonnull(button.getAttributes().getTooltip()),
|
||||
TextUtils.formatNonnull(button.getAttributes().getTooltip()),
|
||||
this.getActionHandlerFactory().createActionHandler(content, button.getAction())
|
||||
);
|
||||
}
|
||||
@@ -100,7 +100,7 @@ public class ButtonFactory extends WidgetFactory
|
||||
button.getAttributes().getMax(),
|
||||
button.getAttributes().getStart(),
|
||||
container,
|
||||
new LogicSliderSimple(button.getAttributes().getId(), TextFormatting.formatNullable(button.getText()), responder)
|
||||
new LogicSliderSimple(button.getAttributes().getId(), TextUtils.formatNonnull(button.getText()), responder)
|
||||
);
|
||||
}
|
||||
else if(JsonButton.Type.TEXTFIELD.equals(button.getType()))
|
||||
@@ -111,7 +111,7 @@ public class ButtonFactory extends WidgetFactory
|
||||
button.getDimensions().getY() + y,
|
||||
button.getDimensions().getWidth(),
|
||||
button.getDimensions().getHeight(),
|
||||
TextFormatting.formatNullable(button.getText())
|
||||
TextUtils.formatNonnull(button.getText())
|
||||
);
|
||||
textfield.setValidator(Predicates.notNull());
|
||||
textfield.setText(this.getApi().getValue(button.getAttributes().getId()));
|
||||
|
||||
@@ -10,10 +10,11 @@ import exopandora.worldhandler.gui.menu.Menu;
|
||||
import exopandora.worldhandler.gui.menu.impl.ILogicPageList;
|
||||
import exopandora.worldhandler.gui.menu.impl.MenuPageList;
|
||||
import exopandora.worldhandler.usercontent.UsercontentAPI;
|
||||
import exopandora.worldhandler.usercontent.model.JsonMenu;
|
||||
import exopandora.worldhandler.usercontent.model.JsonItem;
|
||||
import exopandora.worldhandler.usercontent.model.JsonMenu;
|
||||
import exopandora.worldhandler.usercontent.model.JsonWidget;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -65,7 +66,7 @@ public class MenuFactory extends WidgetFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, String text, JsonItem item, ActionHandler actionHandler)
|
||||
public GuiButtonBase onRegister(int x, int y, int width, int height, IFormattableTextComponent text, JsonItem item, ActionHandler actionHandler)
|
||||
{
|
||||
return new GuiButtonTooltip(x, y, width, height, text, this.toTooltip(item), actionHandler);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,9 @@ import exopandora.worldhandler.usercontent.UsercontentAPI;
|
||||
import exopandora.worldhandler.usercontent.model.JsonItem;
|
||||
import exopandora.worldhandler.usercontent.model.JsonWidget;
|
||||
import exopandora.worldhandler.util.ActionHandler;
|
||||
import exopandora.worldhandler.util.TextFormatting;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@@ -50,16 +52,20 @@ public abstract class WidgetFactory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String translate(JsonItem item)
|
||||
public IFormattableTextComponent translate(JsonItem item)
|
||||
{
|
||||
String translation = TextFormatting.formatNullable(item.getTranslation());
|
||||
return translation == null ? item.getId() : translation;
|
||||
if(item.getTranslation() != null)
|
||||
{
|
||||
return new TranslationTextComponent(item.getTranslation());
|
||||
}
|
||||
|
||||
return new StringTextComponent(item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toTooltip(JsonItem item)
|
||||
public IFormattableTextComponent toTooltip(JsonItem item)
|
||||
{
|
||||
return item.getId();
|
||||
return new StringTextComponent(item.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,10 +19,10 @@ import net.minecraft.block.AbstractSignBlock;
|
||||
import net.minecraft.block.NoteBlock;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.util.text.ChatType;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
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 net.minecraft.world.Difficulty;
|
||||
@@ -163,13 +163,11 @@ public class ActionHelper
|
||||
Minecraft.getInstance().displayGuiScreen(null);
|
||||
Minecraft.getInstance().mouseHelper.grabMouse();
|
||||
|
||||
Style redColor = new Style().setColor(TextFormatting.RED);
|
||||
ITextComponent message = new TranslationTextComponent("<" + Main.NAME + "> %s", new TranslationTextComponent("worldhandler.error.gui")).func_240699_a_(TextFormatting.RED);
|
||||
ITextComponent cause = new StringTextComponent(" " + e.getClass().getCanonicalName() + ": " + e.getMessage()).func_240699_a_(TextFormatting.RED);
|
||||
|
||||
ITextComponent message = new TranslationTextComponent("<" + Main.NAME + "> %s", new TranslationTextComponent("worldhandler.error.gui")).setStyle(redColor);
|
||||
ITextComponent cause = new StringTextComponent(" " + e.getClass().getCanonicalName() + ": " + e.getMessage()).setStyle(redColor);
|
||||
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, message);
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, cause);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, message, Util.field_240973_b_);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, cause, Util.field_240973_b_);
|
||||
|
||||
WorldHandler.LOGGER.throwing(e);
|
||||
}
|
||||
@@ -179,8 +177,8 @@ public class ActionHelper
|
||||
{
|
||||
if(!CommandHelper.canPlayerIssueCommand() && Config.getSettings().permissionQuery())
|
||||
{
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused")));
|
||||
Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused.change", I18n.format("gui.worldhandler.config.settings.permission_query"))));
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused")), Util.field_240973_b_);
|
||||
Minecraft.getInstance().ingameGUI.func_238450_a_(ChatType.SYSTEM, new StringTextComponent(TextFormatting.RED + I18n.format("worldhandler.permission.refused.change", I18n.format("gui.worldhandler.config.settings.permission_query"))), Util.field_240973_b_);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementManager;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.loot.LootPredicateManager;
|
||||
import net.minecraft.profiler.IProfiler;
|
||||
import net.minecraft.resources.IFutureReloadListener;
|
||||
import net.minecraft.resources.IResourceManager;
|
||||
@@ -25,14 +26,14 @@ import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
public class AdvancementHelper implements IFutureReloadListener
|
||||
{
|
||||
private static final AdvancementHelper INSTANCE = new AdvancementHelper();
|
||||
private final AdvancementManager manager = new AdvancementManager();
|
||||
private final AdvancementManager manager = new AdvancementManager(new LootPredicateManager());
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> reload(IStage stage, IResourceManager resourceManager, IProfiler preparationsProfiler, IProfiler reloadProfiler, Executor backgroundExecutor, Executor gameExecutor)
|
||||
{
|
||||
return CompletableFuture.supplyAsync(() ->
|
||||
{
|
||||
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA, Thread.currentThread());
|
||||
SimpleReloadableResourceManager serverResourceManager = new SimpleReloadableResourceManager(ResourcePackType.SERVER_DATA);
|
||||
serverResourceManager.addReloadListener(new NetworkTagManager());
|
||||
serverResourceManager.addReloadListener(this.manager);
|
||||
return serverResourceManager;
|
||||
|
||||
@@ -51,7 +51,7 @@ public class BlockHelper
|
||||
}
|
||||
}
|
||||
|
||||
return Minecraft.getInstance().player.getPosition();
|
||||
return Minecraft.getInstance().player.func_233580_cy_();
|
||||
}
|
||||
|
||||
public static Block getFocusedBlock()
|
||||
@@ -148,7 +148,7 @@ public class BlockHelper
|
||||
{
|
||||
if(CommandHelper.canPlayerIssueCommand() && Minecraft.getInstance().getConnection() != null)
|
||||
{
|
||||
BlockPos pos = Minecraft.getInstance().player.getPosition().add(0, 3, 0);
|
||||
BlockPos pos = Minecraft.getInstance().player.func_233580_cy_().add(0, 3, 0);
|
||||
|
||||
BuilderFill placeFill = new BuilderFill();
|
||||
placeFill.setPosition1(pos);
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public abstract class Connection
|
||||
{
|
||||
private final Type type;
|
||||
|
||||
public Connection(Type type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public Type getType()
|
||||
{
|
||||
return this.type;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static enum Type
|
||||
{
|
||||
INTEGRATED,
|
||||
DEDICATED;
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class IntegratedConnection extends Connection
|
||||
{
|
||||
private final String worldName;
|
||||
private final String folderName;
|
||||
|
||||
public IntegratedConnection(Type type, String worldName, String folderName)
|
||||
{
|
||||
super(type);
|
||||
this.worldName = worldName;
|
||||
this.folderName = folderName;
|
||||
}
|
||||
|
||||
public String getWorldName()
|
||||
{
|
||||
return this.worldName;
|
||||
}
|
||||
|
||||
public String getFolderName()
|
||||
{
|
||||
return this.folderName;
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class DedicatedConnection extends Connection
|
||||
{
|
||||
private final ServerData data;
|
||||
|
||||
public DedicatedConnection(Type type, ServerData data)
|
||||
{
|
||||
super(type);
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ServerData getData()
|
||||
{
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
56
src/main/java/exopandora/worldhandler/util/IConnection.java
Normal file
56
src/main/java/exopandora/worldhandler/util/IConnection.java
Normal file
@@ -0,0 +1,56 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.minecraft.world.WorldSettings;
|
||||
import net.minecraft.world.gen.settings.DimensionGeneratorSettings;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
public interface IConnection
|
||||
{
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class IntegratedConnection implements IConnection
|
||||
{
|
||||
private final String folder;
|
||||
private final WorldSettings worldSettings;
|
||||
private final DimensionGeneratorSettings dimensionGeneratorSettings;
|
||||
|
||||
public IntegratedConnection(String folderName, WorldSettings worldSettings, DimensionGeneratorSettings dimensionGeneratorSettings)
|
||||
{
|
||||
this.folder = folderName;
|
||||
this.worldSettings = worldSettings;
|
||||
this.dimensionGeneratorSettings = dimensionGeneratorSettings;
|
||||
}
|
||||
|
||||
public String getFolder()
|
||||
{
|
||||
return this.folder;
|
||||
}
|
||||
|
||||
public WorldSettings getWorldSettings()
|
||||
{
|
||||
return this.worldSettings;
|
||||
}
|
||||
|
||||
public DimensionGeneratorSettings getDimensionGeneratorSettings()
|
||||
{
|
||||
return this.dimensionGeneratorSettings;
|
||||
}
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public static class DedicatedConnection implements IConnection
|
||||
{
|
||||
private final ServerData data;
|
||||
|
||||
public DedicatedConnection(ServerData data)
|
||||
{
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public ServerData getData()
|
||||
{
|
||||
return this.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,12 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
|
||||
import exopandora.worldhandler.builder.INBTWritable;
|
||||
import net.minecraft.nbt.INBT;
|
||||
import net.minecraft.nbt.StringNBT;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.Style;
|
||||
import net.minecraft.util.text.TextFormatting;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
@@ -31,8 +33,14 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
if(this.isSpecial())
|
||||
{
|
||||
return MutableStringTextComponent.getSpecialFormattedText(this.text);
|
||||
}
|
||||
|
||||
return this.text;
|
||||
}
|
||||
|
||||
@@ -43,16 +51,9 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFormattedText()
|
||||
public String getString()
|
||||
{
|
||||
String formatted = super.getFormattedText();
|
||||
|
||||
if(this.isSpecial())
|
||||
{
|
||||
return MutableStringTextComponent.getSpecialFormattedText(formatted);
|
||||
}
|
||||
|
||||
return formatted;
|
||||
return this.text;
|
||||
}
|
||||
|
||||
public boolean isSpecial()
|
||||
@@ -74,7 +75,49 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
|
||||
public String formatter(String string, Integer index)
|
||||
{
|
||||
return this.getStyle().getFormattingCode() + string;
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
if(this.getStyle() != null)
|
||||
{
|
||||
Style style = this.getStyle();
|
||||
|
||||
if(style.func_240711_a_() != null)
|
||||
{
|
||||
TextFormatting color = TextFormatting.getValueByName(style.func_240711_a_().func_240747_b_());
|
||||
|
||||
if(color != null)
|
||||
{
|
||||
builder.append(color);
|
||||
}
|
||||
}
|
||||
|
||||
if(style.getBold())
|
||||
{
|
||||
builder.append(TextFormatting.BOLD);
|
||||
}
|
||||
|
||||
if(style.getItalic())
|
||||
{
|
||||
builder.append(TextFormatting.ITALIC);
|
||||
}
|
||||
|
||||
if(style.getUnderlined())
|
||||
{
|
||||
builder.append(TextFormatting.UNDERLINE);
|
||||
}
|
||||
|
||||
if(style.getObfuscated())
|
||||
{
|
||||
builder.append(TextFormatting.OBFUSCATED);
|
||||
}
|
||||
|
||||
if(style.getStrikethrough())
|
||||
{
|
||||
builder.append(TextFormatting.STRIKETHROUGH);
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString() + string;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -91,13 +134,13 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
MutableStringTextComponent serial = (MutableStringTextComponent) this.deepCopy();
|
||||
MutableStringTextComponent serial = (MutableStringTextComponent) this.func_230532_e_(); //deepCopy
|
||||
serial.setText(MutableStringTextComponent.getSpecialFormattedText(this.getUnformattedComponentText()));
|
||||
return ITextComponent.Serializer.toJson(serial);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MutableStringTextComponent shallowCopy()
|
||||
public MutableStringTextComponent func_230531_f_() //shallowCopy
|
||||
{
|
||||
return new MutableStringTextComponent(this.text);
|
||||
}
|
||||
@@ -116,7 +159,7 @@ public class MutableStringTextComponent extends StringTextComponent implements I
|
||||
else
|
||||
{
|
||||
MutableStringTextComponent stringtextcomponent = (MutableStringTextComponent) object;
|
||||
return this.text.equals(stringtextcomponent.getText()) && super.equals(object);
|
||||
return this.text.equals(stringtextcomponent.getUnformattedComponentText()) && super.equals(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import exopandora.worldhandler.builder.INBTWritable;
|
||||
import exopandora.worldhandler.builder.component.IBuilderComponent;
|
||||
import exopandora.worldhandler.builder.component.impl.EntityNBT;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.block.Blocks;
|
||||
import net.minecraft.item.Items;
|
||||
import net.minecraft.nbt.CompoundNBT;
|
||||
import net.minecraft.nbt.DoubleNBT;
|
||||
import net.minecraft.nbt.INBT;
|
||||
@@ -54,7 +54,7 @@ public class NBTHelper
|
||||
|
||||
public static INBT serialize(ResourceLocation[] itemArray)
|
||||
{
|
||||
if(Arrays.stream(itemArray).allMatch(resource -> Blocks.AIR.getRegistryName().equals(resource)))
|
||||
if(Arrays.stream(itemArray).allMatch(resource -> Items.AIR.getRegistryName().equals(resource)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ import net.minecraftforge.registries.IForgeRegistryEntry;
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RegistryHelper
|
||||
{
|
||||
private static final Map<IForgeRegistry<?>, Function<?, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<?, String>>();
|
||||
private static final Map<IForgeRegistry<?>, Function<? extends ForgeRegistryEntry<?>, String>> FORGE = new HashMap<IForgeRegistry<?>, Function<? extends ForgeRegistryEntry<?>, String>>();
|
||||
|
||||
static
|
||||
{
|
||||
@@ -44,7 +44,7 @@ public class RegistryHelper
|
||||
|
||||
@Nullable
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> String translate(ResourceLocation resource)
|
||||
public static <T extends ForgeRegistryEntry<T>> String translate(ResourceLocation resource)
|
||||
{
|
||||
for(IForgeRegistry<?> registry : FORGE.keySet())
|
||||
{
|
||||
|
||||
156
src/main/java/exopandora/worldhandler/util/RenderUtils.java
Normal file
156
src/main/java/exopandora/worldhandler/util/RenderUtils.java
Normal file
@@ -0,0 +1,156 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.inventory.container.PlayerContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.vector.Vector3f;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class RenderUtils
|
||||
{
|
||||
public static void drawWatchIntoGui(MatrixStack matrix, AbstractGui gui, int width, int height, long worldTicks, boolean smooth)
|
||||
{
|
||||
float hour = TextUtils.toHour(worldTicks);
|
||||
float minute = TextUtils.toMinute(worldTicks);
|
||||
|
||||
if(smooth)
|
||||
{
|
||||
hour = (worldTicks + 6000) / 1000F;
|
||||
minute = (float) ((worldTicks + 6000F - Math.floor(hour) * 1000) * 6 / 100);
|
||||
}
|
||||
|
||||
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
|
||||
float rotationMinute = (360 / 60) * minute - 180F;
|
||||
|
||||
matrix.push();
|
||||
matrix.translate(width + 5, height + 5, 0F);
|
||||
matrix.scale(0.25F, 0.25F, 0.25F);
|
||||
|
||||
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationHour));
|
||||
AbstractGui.func_238467_a_(matrix, -1, -1, 1, 11, 0xFF383838);
|
||||
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationHour));
|
||||
|
||||
matrix.rotate(Vector3f.ZP.rotationDegrees(rotationMinute));
|
||||
AbstractGui.func_238467_a_(matrix, -1, -1, 1, 15, 0xFF6F6F6F);
|
||||
matrix.rotate(Vector3f.ZN.rotationDegrees(rotationMinute));
|
||||
|
||||
matrix.pop();
|
||||
|
||||
RenderUtils.color(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF(), Config.getSkin().getButtonAlphaF());
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
|
||||
|
||||
gui.func_238474_b_(matrix, width + 0, height, 48, 0, 10, 10);
|
||||
|
||||
matrix.push();
|
||||
matrix.scale(0.5F, 0.5F, 0.5F);
|
||||
Screen.func_238467_a_(matrix, (width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
public static void renderItemIntoGUI(MatrixStack matrix, ItemStack stack, int x, int y)
|
||||
{
|
||||
ItemRenderer itemRenderer = Minecraft.getInstance().getItemRenderer();
|
||||
TextureManager textureManager = Minecraft.getInstance().getTextureManager();
|
||||
IBakedModel bakedmodel = Minecraft.getInstance().getItemRenderer().getItemModelWithOverrides(stack, (World) null, (LivingEntity) null);
|
||||
|
||||
matrix.push();
|
||||
|
||||
textureManager.bindTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE);
|
||||
textureManager.getTexture(PlayerContainer.LOCATION_BLOCKS_TEXTURE).setBlurMipmapDirect(false, false);
|
||||
|
||||
RenderUtils.enableRescaleNormal();
|
||||
RenderUtils.enableAlphaTest();
|
||||
RenderSystem.defaultAlphaFunc();
|
||||
RenderSystem.enableBlend();
|
||||
RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
|
||||
RenderUtils.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
matrix.translate((float) x, (float) y, 100.0F + itemRenderer.zLevel);
|
||||
matrix.translate(8.0F, 8.0F, 0.0F);
|
||||
matrix.scale(1.0F, -1.0F, 1.0F);
|
||||
matrix.scale(16.0F, 16.0F, 16.0F);
|
||||
|
||||
IRenderTypeBuffer.Impl buffer = Minecraft.getInstance().getRenderTypeBuffers().getBufferSource();
|
||||
boolean flag = !bakedmodel.func_230044_c_();
|
||||
|
||||
if(flag)
|
||||
{
|
||||
RenderHelper.setupGuiFlatDiffuseLighting();
|
||||
}
|
||||
|
||||
itemRenderer.renderItem(stack, ItemCameraTransforms.TransformType.GUI, false, matrix, buffer, 15728880, OverlayTexture.NO_OVERLAY, bakedmodel);
|
||||
buffer.finish();
|
||||
|
||||
RenderSystem.enableDepthTest();
|
||||
|
||||
if(flag)
|
||||
{
|
||||
RenderHelper.setupGui3DDiffuseLighting();
|
||||
}
|
||||
|
||||
RenderUtils.disableAlphaTest();
|
||||
RenderUtils.disableRescaleNormal();
|
||||
|
||||
matrix.pop();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void color(float r, float g, float b, float a)
|
||||
{
|
||||
RenderSystem.color4f(r, g, b, a);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void color(float r, float g, float b)
|
||||
{
|
||||
RenderSystem.color3f(r, g, b);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void enableAlphaTest()
|
||||
{
|
||||
RenderSystem.enableAlphaTest();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void disableAlphaTest()
|
||||
{
|
||||
RenderSystem.disableAlphaTest();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void enableRescaleNormal()
|
||||
{
|
||||
RenderSystem.enableRescaleNormal();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void disableRescaleNormal()
|
||||
{
|
||||
RenderSystem.disableRescaleNormal();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public static void disableLighting()
|
||||
{
|
||||
RenderSystem.disableLighting();
|
||||
}
|
||||
}
|
||||
@@ -40,11 +40,11 @@ public class SignText implements INBTWritable
|
||||
{
|
||||
if(command != null && !command.isEmpty())
|
||||
{
|
||||
this.text.getStyle().setClickEvent(new ClickEvent(Action.RUN_COMMAND, command));
|
||||
this.text.getStyle().func_240715_a_(new ClickEvent(Action.RUN_COMMAND, command));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.text.getStyle().setClickEvent(null);
|
||||
this.text.getStyle().func_240715_a_(null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public class SignText implements INBTWritable
|
||||
|
||||
if(this.text.getStyle().isEmpty() && !this.hasCommand())
|
||||
{
|
||||
return this.text.getFormattedText();
|
||||
return this.text.getString();
|
||||
}
|
||||
|
||||
return this.text.toString();
|
||||
|
||||
@@ -1,119 +0,0 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class TextFormatting
|
||||
{
|
||||
public static String shortenString(String str, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
return TextFormatting.shortenString(str, "", maxWidth, fontRenderer);
|
||||
}
|
||||
|
||||
public static String shortenString(String str, String prefix, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
if(fontRenderer.getStringWidth(prefix + str) > (maxWidth - fontRenderer.getStringWidth(prefix)))
|
||||
{
|
||||
String result = prefix;
|
||||
|
||||
for(char c : str.toCharArray())
|
||||
{
|
||||
if(fontRenderer.getStringWidth(result + c + "...") < maxWidth)
|
||||
{
|
||||
result += c;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result + "...";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return prefix + str;
|
||||
}
|
||||
|
||||
public static String getTotalTimePlayed(long tick)
|
||||
{
|
||||
int days = 0;
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
int seconds = 0;
|
||||
|
||||
seconds = (int) (tick / 20);
|
||||
|
||||
if(seconds > 60)
|
||||
{
|
||||
int min = MathHelper.floor(seconds / 60);
|
||||
seconds = seconds % 60;
|
||||
minutes = min;
|
||||
}
|
||||
|
||||
if(minutes > 60)
|
||||
{
|
||||
int hrs = MathHelper.floor(minutes / 60);
|
||||
minutes = minutes % 60;
|
||||
hours = hrs;
|
||||
}
|
||||
|
||||
if(hours > 24)
|
||||
{
|
||||
int day = MathHelper.floor(hours / 24);
|
||||
hours = hours % 24;
|
||||
days = day;
|
||||
}
|
||||
|
||||
return String.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public static int getHour(long tick)
|
||||
{
|
||||
int hour = MathHelper.floor((tick + 6000) / 1000F) % 24;
|
||||
|
||||
return hour;
|
||||
}
|
||||
|
||||
public static int getMinute(long tick)
|
||||
{
|
||||
int hour = MathHelper.floor((tick + 6000F) / 1000F);
|
||||
int minute = MathHelper.floor((tick + 6000F - hour * 1000) * 6 / 100);
|
||||
|
||||
return minute;
|
||||
}
|
||||
|
||||
public static String formatWorldTime(long tick)
|
||||
{
|
||||
int hour = TextFormatting.getHour(tick);
|
||||
int minute = TextFormatting.getMinute(tick);
|
||||
|
||||
return String.format("%02d:%02d", hour, minute);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String formatNullable(String text, Object... parameters)
|
||||
{
|
||||
if(text == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return I18n.format(text, parameters);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String formatNonnull(String text, Object... parameters)
|
||||
{
|
||||
if(text == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return I18n.format(text, parameters);
|
||||
}
|
||||
}
|
||||
116
src/main/java/exopandora/worldhandler/util/TextUtils.java
Normal file
116
src/main/java/exopandora/worldhandler/util/TextUtils.java
Normal file
@@ -0,0 +1,116 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.IFormattableTextComponent;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.util.text.TranslationTextComponent;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class TextUtils
|
||||
{
|
||||
public static final StringTextComponent ARROW_LEFT = new StringTextComponent("<");
|
||||
public static final StringTextComponent ARROW_RIGHT = new StringTextComponent(">");
|
||||
public static final IFormattableTextComponent ARROW_LEFT_BOLD = new StringTextComponent("<").func_240699_a_(net.minecraft.util.text.TextFormatting.BOLD);
|
||||
public static final IFormattableTextComponent ARROW_RIGHT_BOLD = new StringTextComponent(">").func_240699_a_(net.minecraft.util.text.TextFormatting.BOLD);
|
||||
|
||||
public static IFormattableTextComponent stripText(IFormattableTextComponent string, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
return TextUtils.stripText(string, (IFormattableTextComponent) StringTextComponent.field_240750_d_, maxWidth, fontRenderer);
|
||||
}
|
||||
|
||||
public static IFormattableTextComponent stripText(IFormattableTextComponent string, IFormattableTextComponent prefix, int maxWidth, FontRenderer fontRenderer)
|
||||
{
|
||||
if(fontRenderer.func_238414_a_(prefix) + fontRenderer.func_238414_a_(string) > (maxWidth - fontRenderer.func_238414_a_(prefix)))
|
||||
{
|
||||
IFormattableTextComponent result = new StringTextComponent("").func_240703_c_(string.getStyle());
|
||||
|
||||
for(char c : string.getString().toCharArray())
|
||||
{
|
||||
IFormattableTextComponent extension = new StringTextComponent(result.getString() + c + "...").func_240703_c_(string.getStyle());
|
||||
|
||||
if(fontRenderer.func_238414_a_(extension) < maxWidth)
|
||||
{
|
||||
result = new StringTextComponent(result.getString() + c).func_240703_c_(string.getStyle());
|
||||
}
|
||||
else
|
||||
{
|
||||
return new StringTextComponent(result.getString() + "...").func_240703_c_(string.getStyle());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return prefix.func_230531_f_().func_230529_a_(string);
|
||||
}
|
||||
|
||||
public static String formatTotalTime(long tick)
|
||||
{
|
||||
int days = 0;
|
||||
int hours = 0;
|
||||
int minutes = 0;
|
||||
int seconds = 0;
|
||||
|
||||
seconds = (int) (tick / 20);
|
||||
|
||||
if(seconds > 60)
|
||||
{
|
||||
int min = MathHelper.floor(seconds / 60);
|
||||
seconds = seconds % 60;
|
||||
minutes = min;
|
||||
}
|
||||
|
||||
if(minutes > 60)
|
||||
{
|
||||
int hrs = MathHelper.floor(minutes / 60);
|
||||
minutes = minutes % 60;
|
||||
hours = hrs;
|
||||
}
|
||||
|
||||
if(hours > 24)
|
||||
{
|
||||
int day = MathHelper.floor(hours / 24);
|
||||
hours = hours % 24;
|
||||
days = day;
|
||||
}
|
||||
|
||||
return String.format("%d:%02d:%02d:%02d", days, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
public static int toHour(long tick)
|
||||
{
|
||||
int hour = MathHelper.floor((tick + 6000) / 1000F) % 24;
|
||||
|
||||
return hour;
|
||||
}
|
||||
|
||||
public static int toMinute(long tick)
|
||||
{
|
||||
int hour = MathHelper.floor((tick + 6000F) / 1000F);
|
||||
int minute = MathHelper.floor((tick + 6000F - hour * 1000) * 6 / 100);
|
||||
|
||||
return minute;
|
||||
}
|
||||
|
||||
public static String formatWorldTime(long tick)
|
||||
{
|
||||
int hour = TextUtils.toHour(tick);
|
||||
int minute = TextUtils.toMinute(tick);
|
||||
|
||||
return String.format("%02d:%02d", hour, minute);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static IFormattableTextComponent formatNonnull(String text, Object... parameters)
|
||||
{
|
||||
if(text == null)
|
||||
{
|
||||
return (IFormattableTextComponent) StringTextComponent.field_240750_d_;
|
||||
}
|
||||
|
||||
return new TranslationTextComponent(text, parameters);
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package exopandora.worldhandler.util;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
|
||||
import exopandora.worldhandler.config.Config;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.AbstractGui;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
public class UtilRender
|
||||
{
|
||||
public static void drawWatchIntoGui(AbstractGui gui, int width, int height, long worldTicks, boolean smooth)
|
||||
{
|
||||
float hour = TextFormatting.getHour(worldTicks);
|
||||
float minute = TextFormatting.getMinute(worldTicks);
|
||||
|
||||
if(smooth)
|
||||
{
|
||||
hour = (worldTicks + 6000) / 1000F;
|
||||
minute = (float) ((worldTicks + 6000F - Math.floor(hour) * 1000) * 6 / 100);
|
||||
}
|
||||
|
||||
float rotationHour = (360 / 12) * (hour >= 12 ? (hour - 12) : hour) - 180F;
|
||||
float rotationMinute = (360 / 60) * minute - 180F;
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.translatef(width + 5, height + 5, 0F);
|
||||
RenderSystem.scalef(0.25F, 0.25F, 0.25F);
|
||||
|
||||
RenderSystem.rotatef(rotationHour, 0F, 0F, 1F);
|
||||
Screen.fill(-1, -1, 1, 11, 0xFF383838);
|
||||
RenderSystem.rotatef(-rotationHour, 0F, 0F, 1F);
|
||||
|
||||
RenderSystem.rotatef(rotationMinute, 0F, 0F, 1F);
|
||||
Screen.fill(-1, -1, 1, 15, 0xFF6F6F6F);
|
||||
RenderSystem.rotatef(-rotationMinute, 0F, 0F, 1F);
|
||||
|
||||
RenderSystem.color3f(1.0F, 1.0F, 1.0F);
|
||||
RenderSystem.popMatrix();
|
||||
|
||||
RenderSystem.color3f(Config.getSkin().getButtonRedF(), Config.getSkin().getButtonGreenF(), Config.getSkin().getButtonBlueF());
|
||||
Minecraft.getInstance().getTextureManager().bindTexture(ResourceHelper.getIconTexture());
|
||||
|
||||
gui.blit(width + 0, height, 48, 0, 10, 10);
|
||||
|
||||
RenderSystem.pushMatrix();
|
||||
RenderSystem.scalef(0.5F, 0.5F, 0.5F);
|
||||
Screen.fill((width + 5) * 2 - 1, (height + 4) * 2 + 1, (width + 6) * 2 - 1, (height + 5) * 2 + 1, 0xFF000000);
|
||||
RenderSystem.popMatrix();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user