photos named via item_name instead of custom_name so the recipe book fills the copy recipe, copies keep an anvil name
This commit is contained in:
1 parent
e364d76da0
commit
4be03afa3f
3 files changed
+7
-2
No files matched your search
@@ -92,6 +92,10 @@ public final class CameraItems {
|
|||||||
&& meta.getMapView().getId() == mapId;
|
&& meta.getMapView().getId() == mapId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The photo's name, set as ITEM_NAME: a CUSTOM_NAME would keep the recipe book from placing the photo (vanilla
|
||||||
|
* Inventory.isUsableForCrafting skips custom-named stacks for the copy recipe's material ingredient).
|
||||||
|
*/
|
||||||
public static Component photoDisplayName() {
|
public static Component photoDisplayName() {
|
||||||
return plain("Foto", NamedTextColor.WHITE);
|
return plain("Foto", NamedTextColor.WHITE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -124,7 +124,8 @@ public class CraftingListener implements Listener {
|
|||||||
key,
|
key,
|
||||||
PersistentDataType.STRING,
|
PersistentDataType.STRING,
|
||||||
src.getPersistentDataContainer().get(key, PersistentDataType.STRING));
|
src.getPersistentDataContainer().get(key, PersistentDataType.STRING));
|
||||||
dst.displayName(CameraItems.photoDisplayName());
|
dst.itemName(CameraItems.photoDisplayName());
|
||||||
|
if (src.hasCustomName()) dst.customName(src.customName()); // anvil-renamed photo
|
||||||
copy.setItemMeta(dst);
|
copy.setItemMeta(dst);
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public final class PhotoService {
|
|||||||
PersistentDataType.STRING,
|
PersistentDataType.STRING,
|
||||||
UUID.randomUUID().toString());
|
UUID.randomUUID().toString());
|
||||||
meta.setMapView(mapView);
|
meta.setMapView(mapView);
|
||||||
meta.displayName(CameraItems.photoDisplayName());
|
meta.itemName(CameraItems.photoDisplayName());
|
||||||
map.setItemMeta(meta);
|
map.setItemMeta(meta);
|
||||||
CameraItems.give(player, map);
|
CameraItems.give(player, map);
|
||||||
playShutter(player);
|
playShutter(player);
|
||||||
|
|||||||
Reference in new issue
Block a user