mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-01-21 06:26:55 +00:00
Better error handling in treasure disks
- Return a more sensible string for empty treasure disks (i.e. those given by /give). This should help identify packs which are giving items in non-supported ways. - Fix NPE when the treasure mount doesn't exist. Fixes #801
This commit is contained in:
parent
7fc55aa9a0
commit
8ff8b78ed8
@ -68,6 +68,8 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
public IMount createDataMount( @Nonnull ItemStack stack, @Nonnull World world )
|
||||
{
|
||||
IMount rootTreasure = getTreasureMount();
|
||||
if( rootTreasure == null ) return null;
|
||||
|
||||
String subPath = getSubPath( stack );
|
||||
try
|
||||
{
|
||||
@ -121,7 +123,7 @@ public class ItemTreasureDisk extends Item implements IMedia
|
||||
private static String getTitle( @Nonnull ItemStack stack )
|
||||
{
|
||||
CompoundNBT nbt = stack.getTag();
|
||||
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : "'alongtimeago' by dan200";
|
||||
return nbt != null && nbt.contains( NBT_TITLE ) ? nbt.getString( NBT_TITLE ) : "'missingno' by how did you get this anyway?";
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
Loading…
Reference in New Issue
Block a user