Skip to content

Commit a672182

Browse files
committed
Wings and linear interpolate
1 parent e4beb2b commit a672182

File tree

26 files changed

+765
-71
lines changed

26 files changed

+765
-71
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod_id = hysentials
99
mod_version = 1.2.1-beta1
1010
dev_version = 1.2.1-dev
1111

12-
dev = false
12+
dev = true
1313

1414
loom.platform = forge
1515

src/main/java/llc/redstone/hysentials/Hysentials.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import llc.redstone.hysentials.cosmetics.miya.MiyaCompanion;
1919
import llc.redstone.hysentials.cosmetics.pepper.PepperCompanion;
2020
import llc.redstone.hysentials.cosmetics.hats.technocrown.TechnoCrown;
21+
import llc.redstone.hysentials.cosmetics.wings.dragon.DragonCosmetic;
22+
import llc.redstone.hysentials.cosmetics.wings.tdarth.TdarthCosmetic;
2123
import llc.redstone.hysentials.guis.club.ClubDashboardHandler;
2224
import llc.redstone.hysentials.guis.container.ContainerHandler;
2325
import llc.redstone.hysentials.handlers.chat.modules.misc.Limit256;
@@ -50,7 +52,6 @@
5052
import llc.redstone.hysentials.handlers.sbb.SbbRenderer;
5153
import llc.redstone.hysentials.htsl.Cluster;
5254
import llc.redstone.hysentials.cosmetics.cubit.CubitCompanion;
53-
import llc.redstone.hysentials.util.blockw.OnlineCache;
5455
import llc.redstone.hysentials.websocket.Socket;
5556
import net.minecraft.client.Minecraft;
5657
import net.minecraft.client.gui.FontRenderer;
@@ -108,8 +109,6 @@ public class Hysentials {
108109
public static final Logger logger = LogManager.getLogger("Hysentials");
109110

110111
private final LanguageHandler languageHandler = new LanguageHandler();
111-
private final OnlineCache onlineCache = new OnlineCache();
112-
113112
private final ChatHandler chatHandler = new ChatHandler();
114113

115114
public final GuiDisplayHandler guiDisplayHandler = new GuiDisplayHandler();
@@ -136,6 +135,8 @@ public class Hysentials {
136135
public TechnoCrown technoCrown;
137136
public BlackCat blackCat;
138137
public KzeroBundle kzeroBundle;
138+
public TdarthCosmetic tdarthCosmetic;
139+
public DragonCosmetic dragonCosmetic;
139140

140141

141142

@@ -417,6 +418,8 @@ private void registerHandlers() {
417418
eventBus.register(hamsterCompanion = new HamsterCompanion());
418419
eventBus.register(technoCrown = new TechnoCrown());
419420
eventBus.register(kzeroBundle = new KzeroBundle());
421+
eventBus.register(tdarthCosmetic = new TdarthCosmetic());
422+
eventBus.register(dragonCosmetic = new DragonCosmetic());
420423
blackCat = LayerBlackCatHat.hat;
421424
CatHat.loadCatHats();
422425
BackpackCosmetic.loadBackpacks();
@@ -472,10 +475,6 @@ public Logger getLogger() {
472475
return logger;
473476
}
474477

475-
public OnlineCache getOnlineCache() {
476-
return onlineCache;
477-
}
478-
479478

480479
public static InputStream post(String url, JSONObject json) throws IOException {
481480
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();

src/main/java/llc/redstone/hysentials/capes/CustomCapeRenderLayer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public void doRenderLayer(AbstractClientPlayer abstractClientPlayer, float param
5353
if (!abstractClientPlayer.hasPlayerInfo() || abstractClientPlayer.isInvisible()
5454
|| !abstractClientPlayer.isWearing(EnumPlayerModelParts.CAPE)
5555
|| (BlockWAPIUtils.isWearingType(abstractClientPlayer.getUniqueID(), "backpack"))
56+
|| (BlockWAPIUtils.isWearingType(abstractClientPlayer.getUniqueID(), "wings"))
5657
|| abstractClientPlayer.getLocationCape() == null
5758
|| CosmeticConfig.disableCustomCapes) {
5859
return;

src/main/java/llc/redstone/hysentials/config/hysentialMods/FormattingConfig.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,14 @@ public void openRankHexConfig() {
109109
}
110110
}
111111

112+
@Switch(
113+
name = "Hover Outline Color",
114+
category = "General",
115+
subcategory = "Misc",
116+
description = "Change the outline color based on the items color."
117+
)
118+
public static boolean hoverOutlineColor = true;
119+
112120

113121
@RankAnnotation(
114122
name = "Default Rank",

src/main/java/llc/redstone/hysentials/config/hysentialMods/ReplaceConfig.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,13 @@ public class ReplaceConfig extends Config {
4444
new ReplaceStuff("Global")
4545
));
4646

47+
@Info(
48+
text = "If you are the club owner, you can edit this through the Club Dashboard.",
49+
type = InfoType.INFO,
50+
category = "Clubs",
51+
subcategory = "",
52+
size = 0
53+
)
4754
@ReplaceAnnotation(
4855
name = "Club Replace",
4956
description = "Replace things in clubs",

src/main/java/llc/redstone/hysentials/config/hysentialMods/replace/ReplaceOption.java

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ private void reload () {
7878
replace.replaceField = new ArrayList<>();
7979
replace.withField = new ArrayList<>();
8080
replace.removeButton = new ArrayList<>();
81+
replace.confirmButton = new ArrayList<>();
8182

8283
List<String> keys = new ArrayList<>(replace.replacements.keySet());
8384
keys.sort(String::compareTo);
@@ -90,43 +91,29 @@ private void reload () {
9091
}
9192
}
9293

94+
//874/2=437
9395
public void addElements(ReplaceStuff replace, String key, String value, boolean clubsPage) {
94-
TextInputField replaceField = new TextInputField(460, 32, false, "String to replace");
96+
TextInputField replaceField = new TextInputField(390, 32, false, "String to replace");
9597
replaceField.setInput(key);
9698
if (clubsPage && replace.clubReplacements.contains(key)) {
9799
replaceField.disable(true);
98100
}
99101
replace.replaceField.add(replaceField);
100102

101-
TextInputField withField = new TextInputField(460, 32, false, "String to replace with");
103+
TextInputField withField = new TextInputField(390, 32, false, "String to replace with");
102104
withField.setInput(value);
103105
replace.withField.add(withField);
104106

105107
replace.removeButton.add(new DeleteElement(32, 32));
106-
}
107108

108-
public void updateElements(ReplaceStuff replace, String key, String value, boolean clubsPage) {
109-
List<String> keys = new ArrayList<>(replace.replacements.keySet());
110-
keys.sort(String::compareTo);
111-
int index = keys.indexOf(key);
112-
replace.replaceField.get(index).setInput(key);
113-
replace.withField.get(index).setInput(value);
109+
replace.confirmButton.add(new BasicButton(96, 32, "Confirm", BasicButton.ALIGNMENT_CENTER, ColorPalette.PRIMARY));
114110
}
115111

116112
public static ReplaceOption create(Field field, Object parent) {
117113
ReplaceAnnotation color = field.getAnnotation(ReplaceAnnotation.class);
118114
return new ReplaceOption(field, parent, color.name(), color.description(), color.category(), color.subcategory());
119115
}
120116

121-
public void removeElements(ReplaceStuff replaceStuff, String key) {
122-
List<String> keys = new ArrayList<>(replaceStuff.replacements.keySet());
123-
keys.sort(String::compareTo);
124-
int index = keys.indexOf(key);
125-
replaceStuff.replaceField.remove(index);
126-
replaceStuff.withField.remove(index);
127-
replaceStuff.removeButton.remove(index);
128-
}
129-
130117
@Override
131118
public void draw(long vg, int x, int y, InputHandler inputHandler) {
132119
final NanoVGHelper nanoVGHelper = NanoVGHelper.INSTANCE;
@@ -148,15 +135,23 @@ public void draw(long vg, int x, int y, InputHandler inputHandler) {
148135
TextInputField replaceField = replace.replaceField.get(i);
149136
TextInputField withField = replace.withField.get(i);
150137
DeleteElement deleteElement = replace.removeButton.get(i);
138+
BasicButton confirmButton = replace.confirmButton.get(i);
151139

152140
replaceField.draw(vg, x, y, inputHandler);
153-
withField.draw(vg, x + 475, y, inputHandler);
141+
withField.draw(vg, x + 400, y, inputHandler);
154142

143+
confirmButton.draw(vg, x + 800, y, inputHandler);
144+
if (confirmButton.isClicked()) {
145+
update(replace, i);
146+
}
155147

156-
deleteElement.draw(vg, x + 950, y, inputHandler);
148+
deleteElement.draw(vg, x + 900, y, inputHandler);
157149
if (deleteElement.isClicked()) {
158150
replace.replacements.remove(replaceField.getInput());
159151
replace.replaceField.remove(i);
152+
replace.withField.remove(i);
153+
replace.removeButton.remove(i);
154+
replace.confirmButton.remove(i);
160155

161156
if (clubsPage && replace.clubReplacements.contains(replaceField.getInput())) {
162157
replace.deleted.add(replaceField.getInput());
@@ -195,29 +190,22 @@ public void keyTyped(char key, int keyCode) {
195190
if (currentTextInputField != null) {
196191
currentTextInputField.keyTyped(key, keyCode);
197192
}
193+
}
194+
195+
public void update(ReplaceStuff replaceStuff, int index) {
196+
TextInputField replaceField = replaceStuff.replaceField.get(index);
197+
TextInputField withField = replaceStuff.withField.get(index);
198+
String editKey = replaceStuff.replacements.keySet().toArray(new String[0])[index];
199+
if (editKey.equals(replaceField.getInput())) {
200+
replaceStuff.replacements.put(replaceField.getInput(), withField.getInput());
201+
} else {
202+
replaceStuff.replacements.put(replaceField.getInput(), withField.getInput());
203+
replaceStuff.replacements.remove(editKey);
204+
}
198205
try {
199-
ReplaceStuff icon = replacements.stream().filter(i -> i.isWithField(currentTextInputField) != null).findFirst().orElse(null);
200-
if (icon != null) {
201-
System.out.println(icon.replacements + " " + icon.isWithField(currentTextInputField) + " " + currentTextInputField.getInput());
202-
List<String> keys = new ArrayList<>(icon.replacements.keySet());
203-
keys.sort(String::compareTo);
204-
if (icon.isWithField(currentTextInputField) == null) return;
205-
int index = icon.isWithField(currentTextInputField) ? icon.withField.indexOf(currentTextInputField) : icon.replaceField.indexOf(currentTextInputField);
206-
if (index == -1) return;
207-
System.out.println(index + " " + keys.get(index) + " " + currentTextInputField.getInput() + " " + icon.replacements.get(keys.get(index)));
208-
if (icon.isWithField(currentTextInputField)) {
209-
icon.replacements.put(keys.get(index), currentTextInputField.getInput());
210-
} else {
211-
if (icon.replacements.containsKey(currentTextInputField.getInput()) || currentTextInputField.getInput().isEmpty()) {
212-
return;
213-
}
214-
icon.replacements.put(currentTextInputField.getInput(), icon.replacements.get(keys.get(index)));
215-
icon.replacements.remove(keys.get(index));
216-
}
217-
System.out.println(icon.replacements);
218-
}
219206
set(replacements);
220-
} catch (IllegalAccessException ignored) {
207+
} catch (IllegalAccessException e) {
208+
e.printStackTrace();
221209
}
222210
}
223211

src/main/java/llc/redstone/hysentials/config/hysentialMods/replace/ReplaceStuff.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class ReplaceStuff {
1717
transient public List<TextInputField> replaceField = new ArrayList<>();
1818
transient public List<TextInputField> withField = new ArrayList<>();
1919
transient public List<DeleteElement> removeButton = new ArrayList<>();
20+
transient public List<BasicButton> confirmButton = new ArrayList<>();
2021

2122
transient public BasicButton addIcon;
2223

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package llc.redstone.hysentials.cosmetics.wings.dragon;
2+
3+
import llc.redstone.hysentials.cosmetic.CosmeticUtilsKt;
4+
import llc.redstone.hysentials.cosmetics.wings.tdarth.TdarthModel;
5+
import net.minecraft.entity.player.EntityPlayer;
6+
import net.minecraft.util.ResourceLocation;
7+
8+
public class DragonCosmetic {
9+
ResourceLocation texture;
10+
DragonWingsModel model = new DragonWingsModel();
11+
public DragonCosmetic() {
12+
texture = new ResourceLocation("hysentials:wings/dragon.png");
13+
}
14+
public boolean canUse(EntityPlayer player) {
15+
return CosmeticUtilsKt.equippedCosmetic(player.getUniqueID(), "dragon")
16+
&& CosmeticUtilsKt.hasCosmetic(player.getUniqueID(), "dragon");
17+
}
18+
}

0 commit comments

Comments
 (0)