Skip to content

Commit 416e15a

Browse files
Fix door and time rotor models in /trecipe command and custom instances
1 parent 52de81b commit 416e15a

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

src/main/java/me/eccentric_nz/TARDIS/commands/TARDISRecipeCommands.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
211211
return false;
212212
}
213213

214-
// Maps still seem to use numeric values
214+
// maps still seem to use numeric values
215215
private void showShapedRecipe(Player player, String str) {
216216
ShapedRecipe recipe = plugin.getFigura().getShapedRecipes().get(str);
217217
player.discoverRecipe(recipe.getKey());

src/main/java/me/eccentric_nz/TARDIS/recipes/TARDISShowShapedRecipeInventory.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@
22

33
import com.google.common.collect.Multimaps;
44
import me.eccentric_nz.TARDIS.TARDIS;
5+
import me.eccentric_nz.TARDIS.custommodels.keys.CentredDoorVariant;
56
import me.eccentric_nz.TARDIS.utility.ComponentUtils;
67
import net.kyori.adventure.text.Component;
78
import net.kyori.adventure.text.format.NamedTextColor;
89
import org.bukkit.Material;
10+
import org.bukkit.NamespacedKey;
911
import org.bukkit.inventory.*;
1012
import org.bukkit.inventory.meta.ItemMeta;
1113

1214
import java.util.List;
15+
import java.util.Locale;
1316
import java.util.Map;
1417

1518
public class TARDISShowShapedRecipeInventory implements InventoryHolder {
@@ -95,6 +98,17 @@ private ItemStack[] getRecipeItems() {
9598
im.addItemFlags(ItemFlag.values());
9699
im.setAttributeModifiers(Multimaps.forMap(Map.of()));
97100
}
101+
if (str.startsWith("Door")) {
102+
String r = str.replace("Door ", "").toLowerCase(Locale.ROOT);
103+
if (r.equals("door")) {
104+
r = "tardis_door";
105+
}
106+
im.setItemModel(new NamespacedKey(plugin, r + "_closed"));
107+
}
108+
if (str.startsWith("Time Rotor")) {
109+
String r = str.replace("Time Rotor ", "").toLowerCase(Locale.ROOT);
110+
im.setItemModel(new NamespacedKey(plugin, "time_rotor_" + r + "_off"));
111+
}
98112
result.setAmount(1);
99113
result.setItemMeta(im);
100114
stacks[17] = result;

src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/DoorCustomRecipe.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public void addRecipes() {
4141
ItemStack is = ItemStack.of(material);
4242
ItemMeta im = is.getItemMeta();
4343
String dn = TARDISStringUtils.capitalise(r);
44-
im.displayName(ComponentUtils.toWhite(dn + "Door "));
45-
im.setItemModel(new NamespacedKey(plugin, "block/tardis/" + r + "_0"));
44+
im.displayName(ComponentUtils.toWhite("Door " + dn));
45+
im.setItemModel(new NamespacedKey(plugin, r + "_closed"));
4646
is.setItemMeta(im);
4747
NamespacedKey key = new NamespacedKey(plugin, "door_" + r);
4848
ShapedRecipe recipe = new ShapedRecipe(key, is);

src/main/java/me/eccentric_nz/TARDIS/recipes/shaped/TimeRotorCustomRecipe.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public void addRecipes() {
5757
ItemMeta im = is.getItemMeta();
5858
String dn = TARDISStringUtils.capitalise(r);
5959
im.displayName(ComponentUtils.toWhite("Time Rotor " + dn));
60-
im.setItemModel(new NamespacedKey(plugin, "time_rotor/time_rotor_" + r + "_off"));
60+
im.setItemModel(new NamespacedKey(plugin, "time_rotor_" + r + "_off"));
6161
is.setItemMeta(im);
6262
NamespacedKey key = new NamespacedKey(plugin, "time_rotor_" + r);
6363
ShapedRecipe recipe = new ShapedRecipe(key, is);

0 commit comments

Comments
 (0)