Replace wildcard with metadata 0 for display purposes, fixes #370
N.B. The output is still not visible for non-zero inputs when using wildcard trades, but for now this is good enough
This commit is contained in:
@@ -24,6 +24,7 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
||||
import net.minecraft.inventory.EntityEquipmentSlot.Type;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.*;
|
||||
@@ -795,6 +796,20 @@ public final class WizardryUtilities {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new {@link ItemStack} that is identical to the supplied one, except with the metadata changed to the
|
||||
* new value given.
|
||||
* @param toCopy The stack to copy
|
||||
* @param newMetadata The new metadata value
|
||||
* @return The resulting {@link ItemStack}
|
||||
*/
|
||||
public static ItemStack copyWithMeta(ItemStack toCopy, int newMetadata){
|
||||
ItemStack copy = new ItemStack(toCopy.getItem(), toCopy.getCount(), newMetadata);
|
||||
NBTTagCompound compound = toCopy.getTagCompound();
|
||||
if(compound != null) copy.setTagCompound(compound.copy());
|
||||
return copy;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given player is opped on the given server. If the server is a singleplayer or LAN server, this
|
||||
* means they have cheats enabled.
|
||||
|
||||
Reference in New Issue
Block a user