Skip to content

Commit b4cebe0

Browse files
Fix Sonic Generator
1 parent a68d4ad commit b4cebe0

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/main/java/me/eccentric_nz/TARDIS/custommodels/GUISonicGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public Material getMaterial() {
108108

109109
public String getName() {
110110
String s = toString();
111-
return TARDISStringUtils.capitalise(s);
111+
return this == BIO_SCANNER_UPGRADE ? "Bio-scanner Upgrade" : TARDISStringUtils.capitalise(s);
112112
}
113113

114114
public String getLore() {

src/main/java/me/eccentric_nz/TARDIS/custommodels/keys/SonicVariant.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,13 @@ public NamespacedKey getKey() {
7878
public List<Float> getFloats() {
7979
return floats;
8080
}
81+
82+
public static SonicVariant getByFloat(Float f) {
83+
for (SonicVariant variant : values()) {
84+
if (!variant.getFloats().isEmpty() && f.equals(variant.getFloats().getFirst())) {
85+
return variant;
86+
}
87+
}
88+
return ELEVENTH;
89+
}
8190
}

src/main/java/me/eccentric_nz/TARDIS/sonic/TARDISSonicGeneratorMenuListener.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ public void onGeneratorMenuClick(InventoryClickEvent event) {
202202
generate(p, sonic, getCost(view));
203203
}
204204
}
205-
case 53 ->
206-
// close
207-
close(p);
205+
case 53 -> close(p); // close
208206
default -> {
209207
}
210208
}
@@ -217,7 +215,10 @@ private void save(Player p, ItemStack is, boolean close) {
217215
where.put("uuid", p.getUniqueId().toString());
218216
where.put("activated", 1);
219217
ItemMeta im = is.getItemMeta();
220-
String split = im.getItemModel().getKey().replace("sonic/", "");
218+
CustomModelDataComponent component = im.getCustomModelDataComponent();
219+
List<Float> floats = component.getFloats();
220+
Float model = floats.getFirst();
221+
String split = SonicVariant.getByFloat(model).toString().toLowerCase(Locale.ROOT);
221222
set.put("model", split);
222223
if (im.hasLore()) {
223224
List<Component> lore = im.lore();

todo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
| Priority | Feature | Link |
44
|----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------|
5-
| ![Static Badge](https://img.shields.io/badge/WIP-f90?style=flat-square) | **Update to 1.21.10**<br/>- Update resource pack - add WIDE console template icon<br/>- Use new Mannequin api?<br/>- Add new blocks to appropriate rooms e.g. firefly bush to Mangrove, dry grass to Iistabul?<br/>- Related to above - [#902](https://github.com/eccentricdevotion/TARDIS/issues/902) Room updates | [#902](https://github.com/eccentricdevotion/TARDIS/issues/902) |
5+
| ![Static Badge](https://img.shields.io/badge/WIP-f90?style=flat-square) | **Update to 1.21.10**<br/>- Update resource pack - fix sonic generator buttons<br/>- Use new Mannequin api?<br/>- Add new blocks to appropriate rooms e.g. firefly bush to Mangrove, dry grass to Iistabul?<br/>- Related to above - [#902](https://github.com/eccentricdevotion/TARDIS/issues/902) Room updates | [#902](https://github.com/eccentricdevotion/TARDIS/issues/902) |
66
| ![Static Badge](https://img.shields.io/badge/WIP-f90?style=flat-square) | **Fix bugs**<br/>! | - |
77
| ![Static Badge](https://img.shields.io/badge/1-f00?style=flat-square) | **Time Rotors and 3D Console Improvements**<br/>- Implement custom modelled consoles<br/>- Rotor/Console menu GUI<br/>- Change rotor placement in item frames<br/>- Additional models for cloister and off states | [#916](https://github.com/eccentricdevotion/TARDIS/issues/916) |
88
| ![Static Badge](https://img.shields.io/badge/1-f00?style=flat-square) | **Modelled controls**<br/>- Console lamp done | [#836](https://github.com/eccentricdevotion/TARDIS/issues/836) |

0 commit comments

Comments
 (0)