Proper Reformating

This commit is contained in:
Kam committed 2025-03-13 17:14:45 -04:00
1 parent ce75880aba
commit 180d257024
1179 files changed
+59847 -61583

No files matched your search

@@ -3,10 +3,7 @@ package noppes.npcs.client.gui;
import kamkeel.npcs.network.PacketClient;
import kamkeel.npcs.network.packets.request.magic.MagicSavePacket;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import noppes.npcs.client.gui.SubGuiColorSelector;
import noppes.npcs.client.gui.global.GuiNpcManageMagic;
import noppes.npcs.client.gui.util.*;
import noppes.npcs.constants.EnumTextureType;
@@ -46,12 +43,12 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
public void initGui() {
super.initGui();
int y = guiTop + 6;
int y = guiTop + 6;
addLabel(new GuiNpcLabel(1,"gui.name", guiLeft + 4, y + 5));
addLabel(new GuiNpcLabel(1, "gui.name", guiLeft + 4, y + 5));
addTextField(new GuiNpcTextField(1, this, this.fontRendererObj, guiLeft + 80, y, 200, 20, magic.name));
addLabel(new GuiNpcLabel(-10,"ID", guiLeft + 200 + 80 + 5, y + 2));
addLabel(new GuiNpcLabel(-10, "ID", guiLeft + 200 + 80 + 5, y + 2));
addLabel(new GuiNpcLabel(-11, magic.id + "", guiLeft + 200 + 80 + 5, y + 12));
y += 25;
@@ -61,7 +58,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
addTextField(new GuiNpcTextField(2, this, fontRendererObj, guiLeft + 80, y, 200, 20, magic.displayName));
String color = Integer.toHexString(magic.color);
while(color.length() < 6)
while (color.length() < 6)
color = 0 + color;
addButton(new GuiNpcButton(12, guiLeft + 80 + 5 + 200, y, 65, 20, color));
getButton(12).setTextColor(magic.color);
@@ -74,8 +71,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
// Interactions
if(allMagic == null){
allMagic = new GuiCustomScroll(this,0);
if (allMagic == null) {
allMagic = new GuiCustomScroll(this, 0);
allMagic.setSize(150, 107);
}
allMagic.guiLeft = guiLeft + 5;
@@ -84,8 +81,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
addTextField(new GuiNpcTextField(34, this, fontRendererObj, guiLeft + 5, guiTop + 30 + 160, 150, 20, search));
allMagic.setList(getSearchList());
if(interactionsScroll == null){
interactionsScroll = new GuiCustomScroll(this,1);
if (interactionsScroll == null) {
interactionsScroll = new GuiCustomScroll(this, 1);
interactionsScroll.setSize(150, 107);
}
interactionsScroll.guiLeft = guiLeft + 200;
@@ -97,7 +94,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
interactionField = new GuiNpcTextField(90, this, fontRendererObj, guiLeft + 245, guiTop + 30 + 160, 45, 20, "");
interactionField.setFloatsOnly();
addTextField(interactionField);
if(selectedInteraction != null){
if (selectedInteraction != null) {
interactionField.setText(interactionValues.get(selectedInteraction) + "");
} else {
interactionField.enabled = false;
@@ -115,11 +112,11 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
@Override
public void actionPerformed(GuiButton button) {
if(button.id == 99){
if (button.id == 99) {
close();
}
if(button.id == 13){
magic.type = EnumTextureType.values()[((GuiNpcButton)button).getValue()];
if (button.id == 13) {
magic.type = EnumTextureType.values()[((GuiNpcButton) button).getValue()];
}
if (button.id == 12) {
setSubGui(new SubGuiColorSelector(magic.color));
@@ -141,8 +138,8 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
}
if (button.id == 62) {
// Add All
for(String name : this.parent.magicData.keySet()){
if(!interactionNames.containsKey(name)){
for (String name : this.parent.magicData.keySet()) {
if (!interactionNames.containsKey(name)) {
interactionNames.put(name, this.parent.magicData.get(name));
interactionValues.put(name, 0.0f);
}
@@ -163,27 +160,26 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
@Override
public void unFocused(GuiNpcTextField guiNpcTextField) {
if(guiNpcTextField.id == 1) {
if(magic.id < 0)
if (guiNpcTextField.id == 1) {
if (magic.id < 0)
guiNpcTextField.setText("");
else{
else {
String name = guiNpcTextField.getText();
if(name.isEmpty() || ((GuiNpcManageMagic)this.parent).magicData.containsKey(name)){
if (name.isEmpty() || ((GuiNpcManageMagic) this.parent).magicData.containsKey(name)) {
guiNpcTextField.setText(magic.name);
}
else if(magic.id >= 0){
} else if (magic.id >= 0) {
String old = magic.name;
((GuiNpcManageMagic)this.parent).magicData.remove(old);
((GuiNpcManageMagic) this.parent).magicData.remove(old);
magic.name = name;
((GuiNpcManageMagic)this.parent).magicData.put(magic.name, magic.id);
((GuiNpcManageMagic)this.parent).rightScroll.replace(old, magic.name);
((GuiNpcManageMagic) this.parent).magicData.put(magic.name, magic.id);
((GuiNpcManageMagic) this.parent).rightScroll.replace(old, magic.name);
}
}
}
if(guiNpcTextField.id == 2){
if (guiNpcTextField.id == 2) {
magic.displayName = guiNpcTextField.getText();
}
if(guiNpcTextField.id == 3){
if (guiNpcTextField.id == 3) {
magic.iconTexture = guiNpcTextField.getText();
}
if (guiNpcTextField.id == 90 && selectedInteraction != null) {
@@ -191,18 +187,16 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
}
}
public void mouseClicked(int i, int j, int k)
{
public void mouseClicked(int i, int j, int k) {
super.mouseClicked(i, j, k);
if(k == 0 && allMagic != null)
if (k == 0 && allMagic != null)
allMagic.mouseClicked(i, j, k);
}
public void keyTyped(char c, int i)
{
public void keyTyped(char c, int i) {
super.keyTyped(c, i);
if(getTextField(34) != null && getTextField(34).isFocused()){
if(search.equals(getTextField(34).getText()))
if (getTextField(34) != null && getTextField(34).isFocused()) {
if (search.equals(getTextField(34).getText()))
return;
search = getTextField(34).getText().toLowerCase();
allMagic.setList(getSearchList());
@@ -210,26 +204,26 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
}
}
private List<String> getSearchList(){
private List<String> getSearchList() {
List<String> original = new ArrayList<>(this.parent.magicData.keySet());
if(search.isEmpty()){
if (search.isEmpty()) {
return original;
}
List<String> filtered = new ArrayList<>();
for(String name : original){
if(name.toLowerCase().contains(search)){
for (String name : original) {
if (name.toLowerCase().contains(search)) {
filtered.add(name);
}
}
return filtered;
}
public void processInteractions(){
public void processInteractions() {
interactionNames.clear();
interactionValues.clear();
for(int id : magic.interactions.keySet()){
for(String name : this.parent.magicData.keySet()){
if(this.parent.magicData.get(name) == id){
for (int id : magic.interactions.keySet()) {
for (String name : this.parent.magicData.keySet()) {
if (this.parent.magicData.get(name) == id) {
interactionNames.put(name, id);
interactionValues.put(name, magic.interactions.get(id));
}
@@ -237,22 +231,22 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
}
}
public void setInteractions(){
public void setInteractions() {
magic.interactions.clear();
for(String name : interactionNames.keySet()){
for (String name : interactionNames.keySet()) {
magic.interactions.put(interactionNames.get(name), interactionValues.get(name));
}
}
@Override
public void subGuiClosed(SubGuiInterface subgui) {
if(subgui instanceof SubGuiColorSelector){
if (subgui instanceof SubGuiColorSelector) {
magic.color = ((SubGuiColorSelector) subgui).color;
initGui();
}
}
public void close(){
public void close() {
setInteractions();
NBTTagCompound compound = new NBTTagCompound();
magic.writeNBT(compound);
@@ -262,7 +256,7 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
@Override
public void customScrollClicked(int i, int j, int k, GuiCustomScroll guiCustomScroll) {
if(guiCustomScroll.id == 1){
if (guiCustomScroll.id == 1) {
GuiNpcTextField.unfocus();
selectedInteraction = interactionsScroll.getSelected();
interactionField.enabled = true;
@@ -271,5 +265,6 @@ public class SubGuiMagic extends SubGuiInterface implements ITextfieldListener,
}
@Override
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {}
public void customScrollDoubleClicked(String selection, GuiCustomScroll scroll) {
}
}