canPlaceOn and canDestroy getters no longer return an unmodifiable list, methods for additions and removals are therefore removed

This commit is contained in:
Németh Noel 2021-02-28 22:39:38 +01:00
parent bcfaf71c7c
commit 2f725becf2
2 changed files with 6 additions and 40 deletions

View File

@ -213,30 +213,12 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
return canPlaceOn.contains(block); return canPlaceOn.contains(block);
} }
/**
* Adds the block to the list of blocks that
* this item can be placed on.
* @param block the block's namespaceID
*/
public void addCanPlaceOn(String block) {
canPlaceOn.add(block);
}
/**
* Removes the block from the set of blocks that
* this item can be placed on.
* @param block the block's namespaceID
*/
public void removeCanPlaceOn(String block) {
canPlaceOn.remove(block);
}
/** /**
* Gets the blocks that this item can be placed on * Gets the blocks that this item can be placed on
* @return an unmodifiable {@link Set} of blocks * @return the {@link Set} of blocks
*/ */
public Set<String> getCanPlaceOn() { public Set<String> getCanPlaceOn() {
return Collections.unmodifiableSet(canPlaceOn); return canPlaceOn;
} }
/** /**
@ -249,28 +231,12 @@ public class ItemStack implements DataContainer, PublicCloneable<ItemStack> {
return canDestroy.contains(block); return canDestroy.contains(block);
} }
/**
* Adds the block to the set of blocks that can be destroyed by this item.
* @param block the block's namespaceID
*/
public void addCanDestroy(String block) {
canDestroy.add(block);
}
/**
* Removes the block from the set of blocks that can be destroyed by this item.
* @param block the block's namespaceID
*/
public void removeCanDestroy(String block) {
canDestroy.remove(block);
}
/** /**
* Gets the blocks that this item can destroy * Gets the blocks that this item can destroy
* @return an unmodifiable {@link Set} of blocks * @return the {@link Set} of blocks
*/ */
public Set<String> getCanDestroy() { public Set<String> getCanDestroy() {
return Collections.unmodifiableSet(canDestroy); return canDestroy;
} }
/** /**

View File

@ -225,14 +225,14 @@ public final class NBTUtils {
{ {
if (nbt.containsKey("CanPlaceOn")) { if (nbt.containsKey("CanPlaceOn")) {
NBTList<NBTString> canPlaceOn = nbt.getList("CanPlaceOn"); NBTList<NBTString> canPlaceOn = nbt.getList("CanPlaceOn");
canPlaceOn.forEach(x -> item.addCanPlaceOn(x.getValue())); canPlaceOn.forEach(x -> item.getCanPlaceOn().add(x.getValue()));
} }
} }
//CanDestroy //CanDestroy
{ {
if (nbt.containsKey("CanDestroy")) { if (nbt.containsKey("CanDestroy")) {
NBTList<NBTString> canPlaceOn = nbt.getList("CanDestroy"); NBTList<NBTString> canPlaceOn = nbt.getList("CanDestroy");
canPlaceOn.forEach(x -> item.addCanDestroy(x.getValue())); canPlaceOn.forEach(x -> item.getCanDestroy().add(x.getValue()));
} }
} }
} }