本文整理匯總了Java中net.minecraft.entity.player.EntityPlayerMP.dropItem方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPlayerMP.dropItem方法的具體用法?Java EntityPlayerMP.dropItem怎麽用?Java EntityPlayerMP.dropItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.player.EntityPlayerMP
的用法示例。
在下文中一共展示了EntityPlayerMP.dropItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: execute
import net.minecraft.entity.player.EntityPlayerMP; //導入方法依賴的package包/類
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
if (args.length < 1)
throw new WrongUsageException(getUsage(sender), new Object[0]);
try {
ItemStack item = ItemFromData.getNewStack(args[0]);
NBTTagCompound attributes = item.getTagCompound().getCompoundTag("Attributes");
EntityPlayerMP entityplayermp = args.length > 1 ? getPlayer(server, sender, args[1])
: getCommandSenderAsPlayer(sender);
for (int i = 2; i < args.length; i++) {
String[] attr = args[i].split(":");
if(attr.length==2){
if(attr[0].equals("u"))
item.getTagCompound().setByte("UEffect", Byte.parseByte(attr[1]));
else if(MapList.nameToAttribute.containsKey(attr[0]))
attributes.setFloat(Integer.toString(MapList.nameToAttribute.get(attr[0]).id), Float.parseFloat(attr[1]));
else if(TF2Attribute.attributes[Integer.parseInt(attr[0])]!=null)
attributes.setFloat(attr[0], Float.parseFloat(attr[1]));
}
else if(attr[0].equals("a"))
item.getTagCompound().setBoolean("Australium", true);
else if(attr[0].equals("s"))
item.getTagCompound().setBoolean("Strange", true);
else if(attr[0].equals("v"))
item.getTagCompound().setBoolean("Valve", true);
}
EntityItem entityitem = entityplayermp.dropItem(item, false);
entityitem.setPickupDelay(0);
/*Chunk chunk=entityplayermp.world.getChunkFromBlockCoords(entityplayermp.getPosition());
int ausCount=0;
int leadCount=0;
int coppCount=0;
int diaCount=0;
for(int x=0;x<16;x++){
for(int y=0; y<256;y++){
for(int z=0; z<16;z++){
IBlockState state=chunk.getBlockState(x, y, z);
if(state.getBlock()==TF2weapons.blockAustraliumOre)
ausCount++;
else if(state.getBlock()==TF2weapons.blockLeadOre)
leadCount++;
else if(state.getBlock()==TF2weapons.blockCopperOre)
coppCount++;
else if(state.getBlock()==Blocks.DIAMOND_ORE)
diaCount++;
}
}
}*/
// notifyCommandListener(sender, this, "Found ores:"+ausCount+" "+leadCount+" "+coppCount+" "+diaCount, new Object[0]);
// entityitem.func_145797_a(entityplayermp.getCommandSenderName());
// func_152373_a(p_71515_1_, this, "commands.giveweapon.success",
// new Object[] {item.func_151000_E(),
// entityplayermp.getCommandSenderName()});
} catch (Exception e) {
throw new WrongUsageException(getUsage(sender), new Object[0]);
}
}